Mysql
Mysql 8 和 Mysql 5.6 之間的 Master/Master 複製出錯
我已經在 Mysql 5.6 和 Mysql 8.0 伺服器之間設置了 master 到 master 複製。我可以讓兩個從伺服器在兩台伺服器上執行。除非在 Mysql 8.0 伺服器上發生更改(例如創建數據庫/表或插入行),否則Mysql 5.6 從站會遇到錯誤:
Mysql 5.6 > ‘顯示奴隸狀態\G;’
Last_Errno:1594
Last_Error:中繼日誌讀取失敗:無法解析中繼日誌事件條目。可能的原因是:主伺服器的二進制日誌已損壞(您可以通過在二進制日誌上執行“mysqlbinlog”來檢查),從伺服器的中繼日誌已損壞(您可以通過在中繼日誌上執行“mysqlbinlog”來檢查),a網路問題,或者主從的 MySQL 程式碼中的錯誤。如果您想檢查主伺服器的二進制日誌或從伺服器的中繼日誌,您將能夠通過在該從伺服器上發出“SHOW SLAVE STATUS”來知道它們的名稱。
我希望在保持版本相同的同時讓複製雙向工作。有什麼辦法可以實現嗎?
mysql 8 配置
[client] port = 3306 socket = /var/run/mysqld/mysqld.sock [mysqld] user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 datadir = /var/lib/mysql bind-address = 0.0.0.0 key_buffer_size = 16M max_allowed_packet = 16M myisam-recover-options = BACKUP max_connections = 1000 log_error = /var/log/mysql/error.log server-id = 2 log_bin = /var/log/mysql/mysql-bin.log binlog-format = row binlog_expire_logs_seconds = 432000 relay-log = /var/log/mysql/mysql-relay-bin.log relay-log-index = /var/log/mysql/mysql-relay-bin.index replicate-ignore-db = mysql,information_schema,performance_schema max_binlog_size = 100M binlog_ignore_db = mysql,information_schema,performance_schema binlog_checksum = NONE lower_case_table_names = 1
mysql 5.6 配置
[client] port = 3306 socket = /var/run/mysqld/mysqld.sock [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp lc-messages-dir = /usr/share/mysql skip-external-locking log_error=/var/log/mysql/mysql_error.log wait_timeout = 900 key_buffer = 16M max_allowed_packet = 16M thread_stack = 192K thread_cache_size = 8 myisam-recover = BACKUP max_connections = 1000 query_cache_limit = 1M query_cache_size = 16M server-id = 1 log_bin = /var/log/mysql/mysql-bin.log expire_logs_days = 5 relay-log = /var/log/mysql/mysql-relay-bin.log relay-log-index = /var/log/mysql/mysql-relay-bin.index replicate-ignore-db = mysql,information_schema,performance_schema max_binlog_size = 100M binlog-format = row binlog_ignore_db = mysql,information_schema,performance_schema lower_case_table_names = 1 [mysqldump] quick quote-names max_allowed_packet = 16M [mysql] [isamchk] key_buffer = 16M !includedir /etc/mysql/conf.d/
您不能擁有比從屬副本更高版本的主版本。MySQL-8.0 將生成 MySQL-5.6 無法理解的二進制日誌消息,因此您的錯誤“無法解析中繼日誌事件條目”。
一個主要版本之間也支持複製,例如 5.7 -> 8.0。