Replication

mariadb:複製主從具有相同的 MySQL 伺服器 ID

  • December 19, 2020

我是一個新手 mariadb 使用者,試圖在 fedora33 上使用 mariadb-10.4.17 設置一個具有多個從屬的主控。

我相信在某一時刻,除了在從屬設備上執行它之外,我還無意中在實際主控設備上執行了“更改主控設備”命令。似乎它執行了一段時間,但我剛剛在 master 的日誌中註意到以下內容:

2020-12-17  8:27:57 0 [Note] Reading of all Master_info entries succeeded
2020-12-17  8:27:57 0 [Note] Added new Master_info '' to hash table
2020-12-17  8:27:57 21 [Note] Slave I/O thread: Start asynchronous replication to master 'repuser@havoc.myserver.com:3306' in log 'mysql-bin.000674' at position 465296935
2020-12-17  8:27:59 21 [Note] Slave I/O thread: connected to master 'repuser@havoc.myserver.com:3306',replication started in log 'mysql-bin.000674' at position 465296935
2020-12-17  8:27:59 21 [ERROR] Slave I/O: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it). Internal MariaDB error code: 1593

“mysql-bin.000674”文件在文件系統的任何地方都不存在。我現在已經停止了奴隸,但是我應該做些什麼嗎?

目前的從站都沒有使用相同的 ID,並且伺服器本身未顯示在從站列表中。

MariaDB [(none)]> show slave hosts;
+-----------+-------------------------------+------+-----------+
| Server_id | Host                          | Port | Master_id |
+-----------+-------------------------------+------+-----------+
|        22 | armor.myserver.com            | 3306 |       590 |
|        11 | xavier.myserver.com           | 3306 |       590 |
|         2 | mail03.myserver.com           | 3306 |       590 |

在主伺服器上使用RESET SLAVE ALL可以忘記從屬複製設置到自身。

引用自:https://dba.stackexchange.com/questions/281771