【問題描述】:
在master停機維護啟動服務之后,slave的Slave_IO_Running狀態(tài)被置為NO
Slave_SQL_Running為Yes,猜測應該是master的鍋
繼續(xù)檢查網絡,權限等問題之后仍然為不可用
也嘗試重新
change master to ...., ...., ....,
master_log_file = 'master-bin.034555',
master_log_pos = 98;
依舊不可用
-
160322 9:42:51 [Note] Slave SQL thread initialized, starting replication in log 'master-bin.034555' at position 98, relay log './MySQLd-relay-bin.0000
-
01' position: 4
-
160322 9:43:01 [Note] Slave I/O thread: connected to master 'repl@*.*.*.*:3306', replication started in log 'master-bin.034555' at position 98
-
160322 9:43:01 [ERROR] Error reading packet from server: Misconfigured master -server id was not set ( server_errno=1236)
-
160322 9:43:01 [ERROR] Got fatal error 1236: 'Misconfigured master - server id was not set' from master when reading data from binary log
-
160322 9:43:01 [Note] Slave I/O thread exiting, read up to log 'master-bin.034555', position 98
-
160322 9:43:07 [Note] Error reading relay log event: slave SQL thread was killed
檢查配置文件發(fā)現#server-id = xxx 被注釋
【解決方案】:
由于server_id為“Dynamic Variable”
故到master中手動執(zhí)行
-
mysql> SET GLOBAL server_id=3028;
-
Query OK, 0 rows affected(0.00 sec)
最后在將配置文件中添加
server-id=3028
在slave上檢查:
-
mysql> SHOWSLAVE STATUS\G
-
*************************** 1. row***************************
-
Slave_IO_State: Waitingfor masterto send event
-
Master_Host: 192.168.30.28
-
Master_User: repl
-
Master_Port: 3306
-
Connect_Retry: 60
-
Master_Log_File:master-bin.034556
-
Read_Master_Log_Pos: 59312658
-
Relay_Log_File: mysqld-relay-bin.000002
-
Relay_Log_Pos: 64698308
-
Relay_Master_Log_File:master-bin.034555
-
Slave_IO_Running: Yes
-
Slave_SQL_Running: Yes
-
…………………………
-
Seconds_Behind_Master: 10071
-
1 rowin set (0.00 sec)
解決。
同樣,某些時候在start slave時報錯“The server is not configured as slave”,
同樣也很有可能是server-id的緣故,只需要手動在主和從庫上執(zhí)行:
SET GLOBAL server_id = xxx,并保證兩臺server-id不一樣即可,最后寫入my.cnf中。
作者微信公眾號(持續(xù)更新)
當前題目:【MySQL】Server-id導致Slave_IO_Running:No主從復制故障
當前URL:
http://weahome.cn/article/jsgdio.html