mysql-cluster中的sql node(主)與單獨的mysql server(從)做主從復制(錯誤解決) 集群環境: www.2cto.com mysql-cluster 7.2.8 (mysql 5.5.27 ; ndb 7.2.8) 192.168.55.11 mgm node (nodeid=1) 192.168.55.10 data node (nodeid=2)+ sql node (nodeid=4) 192.168.55.9 data node (nodeid=3)+ sql node(nodeid=5) MySQL服務器: 192.168.55.133 mysql 啟動:# /var/lib/mysql/bin/mysqld_safe & 關閉:# /var/lib/mysql/bin/mysqladmin shutdown 進入數據庫:# /var/lib/mysql/bin/mysql -u root -p 主從環境搭配: www.2cto.com 主:master(sql node (nodeid=4)) [mysqld] server-id = 1 log-bin = mysql-bin binlog_format = row binlog-do-db = db_name1 binlog-do-db = db_name2 binlog-ignore-db = db_name3 從:slave(mysql) [mysqld] server-id = 3 log-bin = mysql-bin binlog_format = row binlog-do-db = db_name1 binlog-do-db = db_name2 binlog-ignore-db = db_name3 55.133 55.9 # mysqld_safe --ndb_nodeid=5 --user=mysql --server_id=1 & # mysql -u mysql -p mysql> show master status; +------------------+----------+------------------+------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +------------------+----------+------------------+------------------+ | mysql-bin.000003 | 112 | db_name1,db_name2 | db_name3 | +------------------+----------+------------------+------------------+ 1 row in set (0.00 sec) mysql> grant replication slave on *.* to [email protected] identified by '908'; # 如果權限不夠,切換到root mysql> flush privileges; 55.133 # /var/lib/mysql/bin/mysqld_safe & # /var/lib/mysql/bin/mysql -u root -p mysql> change master to master_host='192.168.55.9', master_user='slaveuser', master_password='000', master_log_file='mysql-bin.000003', master_log_pos=112; mysql> start slave; mysql> show slave status\G; 提示錯誤: Last_IO_Error: error connecting to master '[email protected]:3306' - retry-time: 60 retries: 86400 但是通過:# mysql -h 192.168.55.9 -u slavemysql -p 可成功登錄遠程9上的數據庫。 # 在55.9上 mysql> grant all on *.* [email protected] identified by '908'; 也已經成功授權 錯誤已經修正:參考:http://www.BkJia.com/database/201212/175808.html