我在 Ubuntu 上设置了 MySQL Cluster。我的 ndb_mgmd.cnf 文件如下所示:
[NDBD DEFAULT]
NoOfReplicas=2
DataDir= /var/lib/mysql-cluster
# Management Node
[NDB_MGMD]
NodeId=1
HostName=192.168.204.20
DataDir=/var/lib/mysql-cluster
# Storage Nodes (one for each node)
[NDBD]
NodeId=2
HostName=192.168.204.25
DataDir=/var/lib/mysql-cluster
[NDBD]
NodeId=3
HostName=192.168.204.26
DataDir=/var/lib/mysql-cluster
# SQL Nodes (one for each node)
[MYSQLD]
NodeId=4
HostName=192.168.204.30
现在我想编辑这个配置,所以我改变了这个文件:
[NDBD DEFAULT]
NoOfReplicas=2
DataDir= /var/lib/mysql-cluster
# Management Node
[NDB_MGMD]
NodeId=1
HostName=192.168.204.20
DataDir=/var/lib/mysql-cluster
# Storage Nodes (one for each node)
[NDBD]
NodeId=2
HostName=192.168.204.25
DataDir=/var/lib/mysql-cluster
[NDBD]
NodeId=3
HostName=192.168.204.26
DataDir=/var/lib/mysql-cluster
# SQL Nodes (one for each node)
[MYSQLD]
NodeId=4
HostName=192.168.204.25
[MYSQLD]
NodeId=5
HostName=192.168.204.26
但
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.204.25)
id=3 (not connected, accepting connect from 192.168.204.26)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.204.20 (mysql-5.1.51 ndb-7.1.9)
[mysqld(API)] 1 node(s)
id=4 (not connected, accepting connect from 192.168.204.30)
我试过:
sudo /etc/init.d/mysql-ndb-mgm restart
sudo ndb_mgmd --initial
sudo ndb_mgmd -f /etc/mysql/ndb_mgmd.cnf
什么都没起作用。有什么帮助吗?
答案1
MySQL Cluster 将其自身配置缓存到通常位于 /usr/mysql-cluster 的文件中(使用 rm Linux 命令行将其删除并重新启动 ndb_mgmd)。通常,使用 --initial 启动 ndb_mgmd 可以解决此类问题,但您也可以使用 --skip-config-cache。
干杯,瓦格纳·比安奇