參考https://www.cnblogs.com/Canyon/p/12030781.html這篇文章開始配置時
啟動總是報錯:
2020-08-21T04:52:36.332502Z 10 [System] [MY-010597] [Repl] 'CHANGE MASTER TO FOR CHANNEL 'group_replication_applier' executed'. Previous state master_host='', master_port= 3306, master_log_file='', master_log_pos= 4, master_bind=''. New state master_host='<NULL>', master_port= 0, master_log_file='', master_log_pos= 4, master_bind=''. 2020-08-21T04:52:36.425811Z 0 [ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] Error connecting to the local group communication engine instance.' 2020-08-21T04:52:37.468858Z 0 [ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The member was unable to join the group. Local port: 33081' 2020-08-21T04:52:42.549863Z 0 [ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] Error connecting to the local group communication engine instance.' 2020-08-21T04:52:43.593257Z 0 [ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The member was unable to join the group. Local port: 33081' 2020-08-21T04:52:48.679199Z 0 [ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] Error connecting to the local group communication engine instance.' 2020-08-21T04:52:49.720298Z 0 [ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The member was unable to join the group. Local port: 33081' 2020-08-21T04:52:54.798558Z 0 [ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] Error connecting to the local group communication engine instance.' 2020-08-21T04:52:55.838872Z 0 [ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The member was unable to join the group. Local port: 33081'
白名單也設置了,防火牆端口也打開了,依舊不行。各種嘗試后發現原來是SELinux搞的鬼
解決方法如下:
1.關閉SELinux,但是這樣會不太安全,不是很推薦
setenforce 0
2.開放通訊端口(推薦)
yum install -y policycoreutils-python semanage port -a -t mysqld_port_t -p tcp 33081
子節點連接主節點報錯:
2020-08-21T07:07:49.285286Z 17 [System] [MY-010597] [Repl] 'CHANGE MASTER TO FOR CHANNEL 'group_replication_recovery' executed'. Previous state master_host='node1', master_port= 3306, master_log_file='', master_log_pos= 4, master_bind=''. New state master_host='node1', master_port= 3306, master_log_file='', master_log_pos= 4, master_bind=''. 2020-08-21T07:07:49.306446Z 23 [Warning] [MY-010897] [Repl] Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. 2020-08-21T07:07:49.307832Z 23 [ERROR] [MY-010584] [Repl] Slave I/O for channel 'group_replication_recovery': error connecting to master 'repl@node1:3306' - retry-time: 60 retries: 1 message: Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection. Error_code: MY-002061 2020-08-21T07:07:49.314038Z 17 [ERROR] [MY-011582] [Repl] Plugin group_replication reported: 'There was an error when connecting to the donor server. Please check that group_replication_recovery channel credentials and all MEMBER_HOST column values of performance_schema.replication_group_members table are correct and DNS resolvable.' 2020-08-21T07:07:49.314058Z 17 [ERROR] [MY-011583] [Repl] Plugin group_replication reported: 'For details please check performance_schema.replication_connection_status table and error log messages of Slave I/O for channel group_replication_recovery.'
原因 mysql8.0之后加密規則變成 caching_sha2_password了
解決方法:打開公鑰訪問
set global group_replication_recovery_get_public_key=on;
參考鏈接:
https://www.s-style.co.jp/blog/2018/12/3079/