参考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/