NDBCluster - How to run two ndb_mgmd on the same box?
For the test propose, I want to save some resource, so I decided to start two management processes for PRIMARY and STANDBY clusters on the same machine.
Unfortunately, we cannot just invoke ndb_mgmd with different configuration files twice, because some files on disk will be overwritten.
We have to do the following things:
Two folders for the cache of configuration files
- /usr/local/mysql/mysql-cluster
- /usr/local/mysql/mysql-standby
Two DataDir folders which used for log files and lock files, if using the same NodeId number for both clusters.
- /var/lib/mysql-cluster
- /var/lib/mysql-standby
Two configuration files
- /var/lib/mysql-cluster/config.ini
- /var/lib/mysql-cluster/standby.ini
Change the following parameters for standby cluster.
- DataDir, if using the same NodeId for the management node</li>
- NodeId, if using the same DataDir for the management node</li>
- PortNumber in [ndb_mgmd]</li>
- ServerPort in [ndbd default] if the standby cluster on the same machines with primary cluster.
- The data node / sql node information in [ndbd] and [mysqld]
For my configuration
Then, start the Primary Cluster
/usr/local/mysql/bin/ndb_mgmd -f /var/lib/mysql-cluster/config.ini
Next, the Standby Cluster
/usr/local/mysql/bin/ndb_mgmd -f /var/lib/mysql-cluster/standby.ini --configdir /usr/local/mysql/mysql-standby