mysql-cluster插入数据时报表满错误,导致的原因有很多,如内存不足、磁盘空间不够等等,
以下列出了出错现象、原因、及解决方法
一、最近向Billinfo、 Commodity两个表灌数据时,两张表总数据量到100万条时就报表满了,查看了数据节点的内存和磁盘空间均发现剩余空间很大。
这时在管理节点的ndb_mgm>下发现提示
Node 2: Data usage is 95%(4 32K pages of total 2560)
Node 2: Index usage is 94%(8 8K pages of total 2304)
Node 3: Data usage is 95%(4 32K pages of total 2560)
Node 3: Index usage is 94%(8 8K pages of total 2304)
原来是数据节点的DateMemory 和Index Memory的空间用完了
解决方法如下:
1.关闭cluster:在管理节点上用命令 [root@sg204 mysql-cluster]# bin/ndb_mgm -e shutdown
出现提示
Connected to Management Server at: localhost:1186
3 NDB Cluster node(s) have shutdown.
Disconnecting to allow management server to shutdown.
可以看到管理节点和数据节点已经关闭
或者在 ndb_mgm>下 用命令 id stop 来关闭,如管理节点的Id为1,用ndb_mgm> 1 stop 即可关闭管理节点
2.修改管理节点上的配置文件config.ini
[NDBD DEFAULT]
NoOfReplicas= 2
DataMemory = 4096M
IndexMemory = 800M
BackupMemory = 63M
将DataMemory改为4096M,IndexMemory改为800M
3.启动mysql-cluster,启动顺序为 管理节点——数据节点——SQL节点
启动管理节点:[root@sg204 mysql-cluster]# libexec/ndb_mgmd -f /opt/mysql-cluster/etc/config.ini --reload
注意:一定要加上--reload 不然新配置的config.ini文件不会生效,用的还是缓存冲老的config.ini
启动数据节点:[root@sg206 mysql-cluster]# libexec/ndbd
OK这时cluster已经按新的config.ini配置文件来运行了,进到管理节点,输入命令查看
[root@sg204 mysql-cluster]# bin/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 @10.30.9.206 (mysql-5.1.56 ndb-7.1.19, Nodegroup: 0, Master)
id=3 @10.30.9.207 (mysql-5.1.56 ndb-7.1.19, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @10.30.9.204 (mysql-5.1.56 ndb-7.1.19)
[mysqld(API)] 2 node(s)
id=4 @10.30.9.208 (mysql-5.1.56 ndb-7.1.19)
id=5 @10.30.9.211 (mysql-5.1.56 ndb-7.1.19)
ndb_mgm> all report memory;
Node 2: Data usage is 0%(22 32K pages of total 131072)
Node 2: Index usage is 0%(16 8K pages of total 102432)
Node 3: Data usage is 0%(22 32K pages of total 131072)
Node 3: Index usage is 0%(16 8K pages of total 102432)
这时DataMemory已经变为4096M了(131072*32/1024 )