vmware虛擬機器centos7上的MySQL主從報錯解決一例
vmware虛擬機器上centos的MySQL主從報錯slave have equal MySQL Server UUIDs
環境描述:
用vmware workstation裝的centos 7,並做了MySQL主從
主庫IP:192.168.0.1
從庫IP:192.168.0.2
檢視從庫狀態,發現有錯誤:
mysql> show slave status \G
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: 192.168.0.1
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 275142280
Relay_Log_File: localhost-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: No
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 275142280
Relay_Log_Space: 154
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 1593
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.
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID:
Master_Info_File: /usr/local/mysql/data/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp: 171008 14:02:31
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)
檢視主庫的server_id變數
mysql> show global variables like 'server_id';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id | 1 |
+---------------+-------+
1 row in set (0.09 sec)
檢視從庫的server_id變數
mysql> show global variables like 'server_id';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id | 2 |
+---------------+-------+
1 row in set (0.00 sec)
檢視主從庫的server_uuid,發現是一樣的值
mysql> show global variables like 'server_uuid';
+---------------+--------------------------------------+
| Variable_name | Value |
+---------------+--------------------------------------+
| server_uuid | ddfd39f0-ab3a-11e7-931a-000c296ce70e |
+---------------+--------------------------------------+
1 row in set (0.00 sec)
原因是第二臺機器是克隆的第一臺的虛擬機器,所以server_uuid一樣
解決方法:
重新生成第二臺機器的server_uuid值。
找到如下檔案並重命令:
[root@localhost data]# cat /usr/local/mysql/data/auto.cnf
[auto]
server-uuid=ddfd39f0-ab3a-11e7-931a-000c296ce70e
[root@localhost data]# cd /usr/local/mysql/data
[root@localhost data]# mv auto.cnf auto.cnf.bak
重啟mysql:
[root@localhost data]# service mysqld restart
Shutting down MySQL.... SUCCESS!
Starting MySQL. SUCCESS!
發現生成了新的server_uuid:
[root@localhost data]# cat auto.cnf
[auto]
server-uuid=ad5691da-abf0-11e7-81a8-000c299df6f5
再次登陸從庫mysql並查詢狀態,狀態已正常:
[root@localhost data]# mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.18-log MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show slave status \G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.0.1
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 275142280
Relay_Log_File: localhost-relay-bin.000003
Relay_Log_Pos: 320
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 275142280
Relay_Log_Space: 531
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID: ddfd39f0-ab3a-11e7-931a-000c296ce70e
Master_Info_File: /usr/local/mysql/data/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)
環境描述:
用vmware workstation裝的centos 7,並做了MySQL主從
主庫IP:192.168.0.1
從庫IP:192.168.0.2
檢視從庫狀態,發現有錯誤:
mysql> show slave status \G
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: 192.168.0.1
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 275142280
Relay_Log_File: localhost-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: No
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 275142280
Relay_Log_Space: 154
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 1593
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.
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID:
Master_Info_File: /usr/local/mysql/data/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp: 171008 14:02:31
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)
檢視主庫的server_id變數
mysql> show global variables like 'server_id';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id | 1 |
+---------------+-------+
1 row in set (0.09 sec)
檢視從庫的server_id變數
mysql> show global variables like 'server_id';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id | 2 |
+---------------+-------+
1 row in set (0.00 sec)
檢視主從庫的server_uuid,發現是一樣的值
mysql> show global variables like 'server_uuid';
+---------------+--------------------------------------+
| Variable_name | Value |
+---------------+--------------------------------------+
| server_uuid | ddfd39f0-ab3a-11e7-931a-000c296ce70e |
+---------------+--------------------------------------+
1 row in set (0.00 sec)
原因是第二臺機器是克隆的第一臺的虛擬機器,所以server_uuid一樣
解決方法:
重新生成第二臺機器的server_uuid值。
找到如下檔案並重命令:
[root@localhost data]# cat /usr/local/mysql/data/auto.cnf
[auto]
server-uuid=ddfd39f0-ab3a-11e7-931a-000c296ce70e
[root@localhost data]# cd /usr/local/mysql/data
[root@localhost data]# mv auto.cnf auto.cnf.bak
重啟mysql:
[root@localhost data]# service mysqld restart
Shutting down MySQL.... SUCCESS!
Starting MySQL. SUCCESS!
發現生成了新的server_uuid:
[root@localhost data]# cat auto.cnf
[auto]
server-uuid=ad5691da-abf0-11e7-81a8-000c299df6f5
再次登陸從庫mysql並查詢狀態,狀態已正常:
[root@localhost data]# mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.18-log MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show slave status \G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.0.1
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 275142280
Relay_Log_File: localhost-relay-bin.000003
Relay_Log_Pos: 320
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 275142280
Relay_Log_Space: 531
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID: ddfd39f0-ab3a-11e7-931a-000c296ce70e
Master_Info_File: /usr/local/mysql/data/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15498/viewspace-2145741/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 解決 VMware 建立虛擬機器時 unsuccessful報錯虛擬機
- 虛擬機器VMware“內部錯誤”的解決方法虛擬機
- 虛擬主機伺服器錯誤404解決方法伺服器
- VMware虛擬機器如何設定使主機和虛擬機器不同IP虛擬機
- vmware開啟虛擬機器就藍屏重啟 vmware虛擬機器藍屏解決方法虛擬機
- vmware虛擬機器與主機檔案共享虛擬機
- vmware克隆虛擬機器centos6.5,虛擬機器從新配置虛擬機CentOS
- 解決VMware安裝RedHat虛擬機器無法上網的問題Redhat虛擬機
- VMware虛擬機器虛擬機
- VM 虛擬機器linux從主機複製檔案到虛擬機器錯誤虛擬機Linux
- vmware ubuntu虛擬機器問題彙總解決Ubuntu虛擬機
- VMware虛擬機器與主機共享資料夾虛擬機
- vmware虛擬機器執行卡慢的解決辦法虛擬機
- “vmware tools 只能虛擬機器中安裝”的解決方法虛擬機
- 主機網路連線到VMware虛擬機器的方法虛擬機
- 執行VMWare虛擬機器報錯“打不開 /dev/vmmon:斷裂管道”的問題解決之法虛擬機dev
- vmware開啟虛擬機器就藍色畫面重啟 vmware虛擬機器藍色畫面解決方法虛擬機
- VMware Workstaion-從零建立centos虛擬機器AICentOS虛擬機
- Dr.com環境下VMware虛擬機器和主機共享上網方法虛擬機
- Win10系統虛擬機器VMware開機黑屏的解決方法Win10虛擬機
- Java連線虛擬機器的redis報錯問題解決辦法Java虛擬機Redis
- Vmware虛擬機器在M1上無法連線網路的解決方法虛擬機
- VMware Workstation Pro 的 CentOS7 虛擬機器橋接 Windows 網路CentOS虛擬機橋接Windows
- 虛擬機器巢狀 VMWare虛擬機巢狀
- RHEL7/CentOS7虛擬機器異常關閉導致vmware tool啟動指令碼報錯CentOS虛擬機指令碼
- VMWARE虛擬機器的Ubuntu通過橋接方式連線主機虛擬機Ubuntu橋接
- vmware虛擬機器橋接模式無法上網虛擬機橋接模式
- MySQL主從複製問題解決一例MySql
- 【虛擬機器】VMware-VMware Tool安裝虛擬機
- Vmware虛擬機器CentOS7、Ubuntu20系統設定靜態IP,且主機和虛擬機器系統能相互ping通。虛擬機CentOSUbuntu
- VMware虛擬機器優化,提高虛擬機器執行速度的方法?虛擬機優化
- VirtualBox 主機ping不通虛擬機器的解決辦法虛擬機
- centos Vmware虛擬機器 Oh no,something has gone wrong! 解決方法CentOS虛擬機Go
- 一文詳解vmware虛擬機器nat、橋接、僅主機模式的區別虛擬機橋接模式
- 禁止VMware虛擬機器開機程式虛擬機
- VMware僅主機模式虛擬機器無法ping通物理機模式虛擬機
- VMware 虛擬機器一鍵去虛擬化工具虛擬機
- 在VMware上安裝CentOS版本的Linux虛擬機器CentOSLinux虛擬機