The slave I/O thread stops because master and slave have equal MySQL server UUID
The slave I/O thread stops because master and slave have equal MySQL server UUIDs
The slave I/O thread stops because master and slave have equal MySQL server UUIDs; these UUIDs must be different for replication to work.
問題原因:
replication 架構中需要保證每個 mysql 例項 UUID(UUID 儲存在 datadir 目錄下的 auto.cnf 檔案中 ) 唯一,就跟 server_id 一樣需要保證主從架構中所有 mysql 例項 server_id 唯一。之所以出現會出現這樣的問題,是因為我的從庫主機是克隆的主庫所在的主機,所以 auto.cnf 檔案中儲存的 UUID 會出現重複 (server_id 已經在 my.cnf 檔案中修改過 )
問題解決
關於該問題的解決方案其實很簡單,停掉備庫例項,刪除備庫 data 資料夾下的的 auto.cnf ( Windows 下檔名為 auto ) 檔案,啟動備庫例項,此時備庫就會產生一個新的 auto.cnf 檔案 ( 產生新的 UUID) 。
最近在部署MySQL主從複製架構的時候,碰到了"Last_IO_Error: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs; these UUIDs must be different for replication to work." 這個錯誤提示。即主從架構中使用了相同的UUID。檢查server_id系統變數,已經是不同的設定,那原因是?接下來為具體描述。
1、錯誤訊息
mysql> show slave staus;
Last_IO_Error: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs;
these UUIDs must be different for replication to work.
2、檢視主從的server_id變數
master_mysql> show variables like 'server_id';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id | 33 |
+---------------+-------+
slave_mysql> show variables like 'server_id';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id | 11 |
+---------------+-------+
-- 從上面的情形可知,主從mysql已經使用了不同的server_id
3、解決故障
###檢視auto.cnf檔案
[root@dbsrv1 ~] cat /data/mysqldata/auto.cnf ### 主上的uuid
[auto]
server-uuid=62ee10aa-b1f7-11e4-90ae-080027615026
[root@dbsrv2 ~]# more /data/mysqldata/auto.cnf ###從上的uuid,果然出現了重複,原因是克隆了虛擬機器,只改server_id不行
[auto]
server-uuid=62ee10aa-b1f7-11e4-90ae-080027615026
[root@dbsrv2 ~]# mv /data/mysqldata/auto.cnf /data/mysqldata/auto.cnf.bk ###重新命名該檔案
[root@dbsrv2 ~]# service mysql restart ###重啟mysql
Shutting down MySQL.[ OK ]
Starting MySQL.[ OK ]
[root@dbsrv2 ~]# more /data/mysqldata/auto.cnf ###重啟後自動生成新的auto.cnf檔案,即新的UUID
[auto]
server-uuid=6ac0fdae-b5d7-11e4-a9f3-0800278ce5c9
###再次檢視slave的狀態已經正常
[root@dbsrv1 ~]# mysql -uroot -pxxx -e "show slave status\G"|grep Running
Warning: Using a password on the command line interface can be insecure.
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
###主庫端檢視自身的uuid
master_mysql> show variables like 'server_uuid';
+---------------+--------------------------------------+
| Variable_name | Value |
+---------------+--------------------------------------+
| server_uuid | 62ee10aa-b1f7-11e4-90ae-080027615026 |
+---------------+--------------------------------------+
1 row in set (0.00 sec)
###主庫端檢視從庫的uuid
master_mysql> show slave hosts;
+-----------+------+------+-----------+--------------------------------------+
| Server_id | Host | Port | Master_id | Slave_UUID |
+-----------+------+------+-----------+--------------------------------------+
| 33 | | 3306 | 11 | 62ee10aa-b1f7-11e4-90ae-080027615030 |
| 22 | | 3306 | 11 | 6ac0fdae-b5d7-11e4-a9f3-0800278ce5c9 |
+-----------+------+------+-----------+--------------------------------------+
### Author : Leshami
### Blog :
http://www.linuxidc.com
4、延生參考
a、有關server_id的描述
The server ID, used in replication to give each master and slave a unique identity. This variable is set
by the --server-id option. For each server participating in replication, you should pick a
positive integer in the range from 1 to 232– 1(2的32次方減1) to act as that server's ID.
b、有關 server_uuid的描述
Beginning with MySQL 5.6, the server generates a true UUID in addition to the --server-id
supplied by the user.
This is available as the global, read-only variable server_uuid
(全域性只讀變數)
When starting, the MySQL server automatically obtains a UUID as follows:
a). Attempt to read and use the UUID written in the file data_dir/auto.cnf (where data_dir is
the server's data directory); exit on success.
b). Otherwise, generate a new UUID and save it to this file, creating the file if necessary.
The auto.cnf file has a format similar to that used for my.cnf or my.ini files. In MySQL 5.6,
auto.cnf has only a single [auto] section containing a single server_uuid [1992] setting and
value;
Important
The auto.cnf file is automatically generated; you should not attempt to write
or modify this file
Also beginning with MySQL 5.6, when using MySQL replication, masters and slaves know one
another's UUIDs. The value of a slave's UUID can be seen in the output of SHOW SLAVE HOSTS. Once
START SLAVE has been executed (but not before), the value of the master's UUID is available on the
slave in the output of SHOW SLAVE STATUS.
In MySQL 5.6.5 and later, a server's server_uuid is also used in GTIDs for transactions originating
on that server. For more information, see Section 16.1.3, “Replication with Global Transaction
About Me
........................................................................................................................ ● 本文作者:小麥苗,部分內容整理自網路,若有侵權請聯絡小麥苗刪除 ● 本文在itpub( http://blog.itpub.net/26736162 )、部落格園( http://www.cnblogs.com/lhrbest )和個人微 信公眾號( xiaomaimiaolhr )上有同步更新 ● 本文itpub地址: http://blog.itpub.net/26736162 ● 本文部落格園地址: http://www.cnblogs.com/lhrbest ● 本文pdf版、個人簡介及小麥苗雲盤地址: http://blog.itpub.net/26736162/viewspace-1624453/ ● 資料庫筆試面試題庫及解答: http://blog.itpub.net/26736162/viewspace-2134706/ ● DBA寶典今日頭條號地址: http://www.toutiao.com/c/user/6401772890/#mid=1564638659405826 ........................................................................................................................ ● QQ群號: 230161599 (滿) 、618766405 ● 微 信群:可加我微 信,我拉大家進群,非誠勿擾 ● 聯絡我請加QQ好友 ( 646634621 ) ,註明新增緣由 ● 於 2019-07-01 06:00 ~ 2019-07-31 24:00 在西安完成 ● 最新修改時間:2019-07-01 06:00 ~ 2019-07-31 24:00 ● 文章內容來源於小麥苗的學習筆記,部分整理自網路,若有侵權或不當之處還請諒解 ● 版權所有,歡迎分享本文,轉載請保留出處 ........................................................................................................................ ● 小麥苗的微店 : https://weidian.com/s/793741433?wfr=c&ifr=shopdetail ● 小麥苗出版的資料庫類叢書 : http://blog.itpub.net/26736162/viewspace-2142121/ ● 小麥苗OCP、OCM、高可用網路班 : http://blog.itpub.net/26736162/viewspace-2148098/ ● 小麥苗騰訊課堂主頁 : https://lhr.ke.qq.com/ ........................................................................................................................ 使用 微 信客戶端 掃描下面的二維碼來關注小麥苗的微 信公眾號( xiaomaimiaolhr )及QQ群(DBA寶典)、新增小麥苗微 信, 學習最實用的資料庫技術。
........................................................................................................................ |
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26736162/viewspace-2650827/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 故障案例:主從同步報錯Fatal error: The slave I/O thread stops because master and slave have equal MySQL server主從同步ErrorthreadASTMySqlServer
- MySQL報錯Slave: received end packet from server, apparent master shutdownMySqlServerAPPAST
- Mysql 5.6 Master和Slave 主備切換MySqlAST
- MySQL [ERROR] Slave I/O: Found a Gtid_log_event or Previous_gtids_log_eventMySqlError
- Mysql Master-slave複製簡單配置記錄MySqlAST
- Setup MariaDB Master/Slave Replication for Docker MariaDBASTDocker
- Mysqldump實現mysql的master-slave主從複製MySqlAST
- mysql slave 跟進 master 的關鍵狀態指標MySqlAST指標
- Innobackupex實現mysql線上搭建master-slave主從複製MySqlAST
- MySQL複製跳過錯誤--slave_skip_errors、sql_slave_skip_counter、slave_exec_modeMySqlError
- 資料庫讀寫分離Master-Slave資料庫AST
- 分散式資料中的坑(一)Master-Slave架構分散式AST架構
- 使用etcd選舉sdk實踐master/slave故障轉移AST
- MYSQL Slave開機啟動指令碼MySql指令碼
- Mysql修改server uuidMySqlServerUI
- CentOS中MySQL5.6 資料庫主從(Master/Slave)同步安裝與配置詳解CentOSMySql資料庫AST
- [MySQL進階之路][No.0002] SHOW SLAVE STATUSMySql
- MySQL複製命令slave被REPLICA命令取代MySql
- 基於Kubernetes構建企業Jenkins master/slave CI/CD平臺JenkinsAST
- jenkins 動態 slaveJenkins
- slave-skip-errorsError
- MySQ 資料庫主從同步安裝與配置詳解(Master/Slave)資料庫主從同步AST
- 實屬無奈!Redis 作者被迫修改 master-slave 架構的描述RedisAST架構
- 從Mysql slave system lock延遲說開去MySql
- MySQL:關於Wating for Slave workers to free pending events等待MySql
- 故障分析 | MySQL : slave_compressed_protocol 導致 crashMySqlProtocol
- sql_slave_skip_counterSQL
- zabbix應用-監控mysql slave 主從狀態MySql
- MySQL中slave監控的延遲情況分析MySql
- STM8S I2C Slave模式錯誤解決模式
- Redis for linux原始碼&叢集(cluster)&主從(master-slave)&哨兵(sentinel)安裝配置RedisLinux原始碼AST
- kubernetes跑jenkins動態slaveJenkins
- 【MySQL】六、常見slave 延遲原因以及解決方法MySql
- MySQL主從複製配置引數 -- logs-slave-updatesMySql
- MySQL 8.0 Reference Manual(讀書筆記73節--Thread Concurrency for InnoDB and I/O Threads)MySql筆記thread
- MySQL:show slave status 關鍵值和MGRrelay log的清理策略MySql
- mysql同步問題之Slave延遲很大最佳化方法MySql
- Mysql 建立心跳錶來監控Replication的Slave是否延遲MySql