MySQL主从同步、读写分离配置步骤、问题解决(3)
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
1 row in set (0.00 sec)
ERROR:
No query specified
8、查看Master上面的状态;
mysql> show master status;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| updatelog.000012 | 15016 | data | mysql |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
由此可见两者的File、Position存在问题,所要要去Slave上设置对应主库的Master_Log_File、Read_Master_Log_Pos;执行如下语句;
mysql>slave stop;
mysql>CHANGE MASTER TO MASTER_HOST='192.168.0.1',MASTER_USER='test', MASTER_PASSWORD='******',MASTER_LOG_FILE='updatelog.000012',MASTER_LOG_POS=15016;
确保Slave_IO_Running: Yes 、Slave_SQL_Running: Yes都要为YES才能证明Slave的I/O和SQL进行正常。
9、解锁主库表;
UNLOCK TABLES;
到此主从MySQL服务器配置完成,测试结果如下;
mysql> show master status;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| updatelog.000012 | 717039 | data | mysql |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.0.1
Master_User: test
Master_Port: 3306
Connect_Retry: 60
相关新闻>>
- 发表评论
-
- 最新评论 更多>>