MySQL Cluster-备份恢复初步测试
参考文档
http://blog.chinaunix.net/uid-20639775-id-1617795.html
http://xxtianxiaxing.iteye.com/blog/563063
http://dev.mysql.com/doc/refman/5.0/en/mysql-cluster-single-user-mode.html
http://www.mysqlab.net/knowledge/kb/detail/topic/backup/id/8309
在 http://blog.csdn.net/mchdba/article/details/10544585 的第八小节里面进行扩展测试
8.1 sql节点上面录入数据:
建立测试的数据库和表
CREATE DATABASE bg;
CREATE TABLE bgt1 (id INT,`name` VARCHAR(20),PRIMARY KEY(`id`))ENGINE=NDBCLUSTER;
INSERT INTO bgt1 VALUES(1,'zhang1'),(2,'zhang2'),(3,'zhang3'),(4,'zhang4');
8.2 管理节点上面,开始备份
ndb_mgm> start backup
Waiting for completed, this may take several minutes
Node 4: Backup 1 started from node 1
Node 4: Backup 1 started from node 1 completed
StartGCP: 184725 StopGCP: 184772
#Records: 722078 #LogRecords: 0
Data: 287345616 bytes Log: 0 bytes
ndb_mgm>
8.3 再次插入几条数据(为了保持和正式环境尽可能接近,在插入数据中间穿插了flush logs操作!)
INSERT INTO bgt1 VALUES(5,'zhang5'),(6,'zhang6');
flush logs;
INSERT INTO bgt1 VALUES(7,'zhang7'),(8,'zhang8');
8.4 删掉SQL节点的数据。
mysql> drop database bg;
Query OK, 2 rows affected (6.16 sec)
8.5 关闭MYSQLD服务器。
[root@banggo data]# /etc/rc.d/init.d/mysqld stop
Shutting down MySQL......120718 18:58:11 mysqld_safe mysqld from pid file /usr/local/mysql/data/banggo.local.pid ended
[确定]
[1]+ Done /usr/local/mysql/bin/mysqld_safe
[root@banggo data]#
[root@banggo data]# /etc/rc.d/init.d/mysqld stop
Shutting down MySQL.... [确定]
[root@banggo data]#
8.6 重新启动节点
ndb_mgm> shutdown
Node 4: Cluster shutdown initiated
Node 4: Node shutdown completed.
2 NDB Cluster node(s) have shutdown.
Disconnecting to allow management server to shutdown.
ndb_mgm> exit
[root@banggo mysql-cluster]# ndb_mgmd -f /usr/local/mysql/cluster-conf/config.ini --reload