dba.createCluster('mycluster')
随着最近在 Ubuntu 18.04.1 LTS 上将 MySQL 从 8.0.13 升级到 8.0.14,当我按照以下步骤使用 MySQL Shell 界面从头开始创建 3 台机器的 InnoDB 集群时,我开始收到错误:
MySQL | JS > dba.createCluster('mycluster')
A new InnoDB cluster will be created on instance 'root@server1:3306'.
Validating instance at server1:3306...
This instance reports its own address as server1
Instance configuration is suitable.
Creating InnoDB cluster 'mycluster' on 'root@server1:3306'...
Dba.createCluster: ERROR: Error starting cluster: 'server1:3306'
Query failed. MySQL Error (3092): ClassicSession.query: The server is not
configured properly to be an active member of the group.
Please see more details on error log..
Query: START group_replication: MySQL Error (3092): ClassicSession.query:
The server is not configured properly to be an active member of the group.
Please see more details on error log. (RuntimeError)
请注意,在运行上述命令之前我已经运行dba.checkInstanceConfiguration('server1')
并dba.configureInstance('server1')
成功。
/var/log/mysql/error.log
运行后立即查看文件dba.createCluster('mycluster')
,这是我得到的结果:
[System] [MY-010597] [Repl] 'CHANGE MASTER TO FOR CHANNEL 'group_replication_recovery' executed'. Previous state master_host='', master_port= 3306, master_log_file='', master_log_pos= 4, master_bind=''. New state master_host='', master_port= 3306, master_log_file='', master_log_pos= 4, master_bind=''.
[Warning] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] Automatically adding IPv4 localhost address to the whitelist. It is mandatory that it is added.'
[Warning] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] Automatically adding IPv6 localhost address to the whitelist. It is mandatory that it is added.'
[System] [MY-010597] [Repl] 'CHANGE MASTER TO FOR CHANNEL 'group_replication_applier' executed'. Previous state master_host='<NULL>', master_port= 0, 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=''.
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] Unable to announce tcp port 33061. Port already in use?'
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] Error joining the group while waiting for the network layer to become ready.'
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The member was unable to join the group. Local port: 33061'
[ERROR] [MY-011640] [Repl] Plugin group_replication reported: 'Timeout on wait for view after joining group'
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The member is leaving a group without being on one.'
正如上面的日志输出所示,我在端口 33061 上没有运行任何程序。在运行命令之前和之后,dba.createCluster
我得到的是:
# netstat -ltupn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 612/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 816/sshd
tcp 0 0 10.131.16.221:33060 0.0.0.0:* LISTEN 870/mysqld
tcp 0 0 10.131.16.221:33062 0.0.0.0:* LISTEN 870/mysqld
tcp 0 0 10.131.16.221:3306 0.0.0.0:* LISTEN 870/mysqld
udp 0 0 127.0.0.53:53 0.0.0.0:* 612/systemd-resolve
预期的行为是在10.131.16.221:33061
运行后在上面的输出中出现一个新条目dba.createCluster
,但没有任何变化......
以下是我的/etc/mysql/mysql.conf.d/mysqld.cnf
文件中的内容:
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
log-error = /var/log/mysql/error.log
admin-address = server1
bind-address = server1
mysqlx_bind_address = server1
session_track_gtids = OWN_GTID
log_timestamps = SYSTEM
default-authentication-plugin = mysql_native_password
这就是我运行时显示的服务器组复制设置:
MySQL | SQL > show variables like '%replication%'
+-----------------------------------------------------+--------------------------------------+
| Variable_name | Value |
+-----------------------------------------------------+--------------------------------------+
| group_replication_allow_local_lower_version_join | OFF |
| group_replication_auto_increment_increment | 7 |
| group_replication_bootstrap_group | ON |
| group_replication_communication_debug_options | GCS_DEBUG_NONE |
| group_replication_components_stop_timeout | 31536000 |
| group_replication_compression_threshold | 1000000 |
| group_replication_consistency | EVENTUAL |
| group_replication_enforce_update_everywhere_checks | OFF |
| group_replication_exit_state_action | READ_ONLY |
| group_replication_flow_control_applier_threshold | 25000 |
| group_replication_flow_control_certifier_threshold | 25000 |
| group_replication_flow_control_hold_percent | 10 |
| group_replication_flow_control_max_quota | 0 |
| group_replication_flow_control_member_quota_percent | 0 |
| group_replication_flow_control_min_quota | 0 |
| group_replication_flow_control_min_recovery_quota | 0 |
| group_replication_flow_control_mode | QUOTA |
| group_replication_flow_control_period | 1 |
| group_replication_flow_control_release_percent | 50 |
| group_replication_force_members | |
| group_replication_group_name | de380568-1fc9-11e9-9a08-cad7c4f1e463 |
| group_replication_group_seeds | |
| group_replication_gtid_assignment_block_size | 1000000 |
| group_replication_ip_whitelist | AUTOMATIC |
| group_replication_local_address | server1:33061 |
| group_replication_member_expel_timeout | 0 |
| group_replication_member_weight | 50 |
| group_replication_poll_spin_loops | 0 |
| group_replication_recovery_complete_at | TRANSACTIONS_APPLIED |
| group_replication_recovery_get_public_key | OFF |
| group_replication_recovery_public_key_path | |
| group_replication_recovery_reconnect_interval | 60 |
| group_replication_recovery_retry_count | 10 |
| group_replication_recovery_ssl_ca | |
| group_replication_recovery_ssl_capath | |
| group_replication_recovery_ssl_cert | |
| group_replication_recovery_ssl_cipher | |
| group_replication_recovery_ssl_crl | |
| group_replication_recovery_ssl_crlpath | |
| group_replication_recovery_ssl_key | |
| group_replication_recovery_ssl_verify_server_cert | OFF |
| group_replication_recovery_use_ssl | ON |
| group_replication_single_primary_mode | ON |
| group_replication_ssl_mode | REQUIRED |
| group_replication_start_on_boot | ON |
| group_replication_transaction_size_limit | 150000000 |
| group_replication_unreachable_majority_timeout | 0 |
| innodb_replication_delay | 0 |
+-----------------------------------------------------+--------------------------------------+
我不知道我的设置可能出了什么问题,因为我按照相同的步骤使用 MySQL 版本 8.0.13,并且在我的 Ubuntu 18.04 LTS 环境中使用相同的 MySQL 设置一切都运行良好...只有在 MySQL 版本 8.0.14 上才会开始发生这种情况。
有人遇到过同样的问题吗?非常感谢您的帮助或线索!
答案1
这是 8.0.14 中的一个错误,在 8.0.15 中问题已解决
https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-15.html