我正在参与 MySQL HA 配置。目前,我在管理节点上设置了 config.ini:
root@ndb-mgmd:~# cat config.ini |grep -v ^#
[tcp default]
SendBufferMemory=2M
ReceiveBufferMemory=2M
[ndb_mgmd default]
DataDir=/var/lib/mysql-cluster
[ndb_mgmd]
HostName=ndb-mgmd
[ndbd default]
NoOfReplicas=2
LockPagesInMainMemory=1
DataMemory=100M
IndexMemory=50M
NoOfFragmentLogFiles=300
DataDir=/var/lib/mysql-cluster
MaxNoOfConcurrentOperations=1000
SchedulerSpinTimer=400
SchedulerExecutionTimer=100
RealTimeScheduler=1
TimeBetweenGlobalCheckpoints=1000
TimeBetweenEpochs=200 RedoBuffer=32M
MaxNoOfTables=1024
MaxNoOfOrderedIndexes=256
[ndbd]
HostName=192.168.0.20
[ndbd]
HostName=192.168.0.21
启动ndb_mgmd后,节点的ip显示不同:
root@ndb-mgmd:~# ndb_mgmd --config-file=/var/lib/mysql-cluster/config.ini
MySQL Cluster Management Server mysql-5.7.18 ndb-7.6.3
root@ndb-mgmd:~# ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 (not connected, accepting connect from 192.168.0.21)
id=3 (not connected, accepting connect from 192.168.0.22)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.0.30 (mysql-5.7.18 ndb-7.6.3)
[mysqld(API)] 2 node(s)
id=4 (not connected, accepting connect from 192.168.0.21)
id=5 (not connected, accepting connect from 192.168.0.22)
“192.168.0.22”来自哪里?
答案1
我已经想通了。 “--config-dir”也应该在 ndb_mgmd cmdlet 中使用。所以,完整的字符串是
ndb_mgmd --config-dir=/var/lib/mysql-cluster --config-file=/var/lib/mysql-cluster/config.ini