无法在MySQL InnoDB集群上添加新实例

时间:2019-07-20 23:57:04

标签: mysql innodb mysql-innodb-cluster

我正在设置由三个实例组成的新MySQL InnoDB集群8.0.16:

  1. srv-mysql-01
  2. srv-mysql-02
  3. srv-mysql-03

我在mysql shell中运行JS脚本以构建集群:

mysqlsh --interactive --file=/tmp/MakeCluster.js

脚本:

var dbPass = "Somepassword"
var clusterName = "cluster"

try {
  print('Setting up InnoDB cluster...\n');
  shell.connect('admin@srv-mysql-01:3306', dbPass)
  var cluster = dba.createCluster(clusterName);
  print('Adding instances to the cluster.');
  cluster.addInstance({user: "admin", host: "srv-mysql-02", password: dbPass})
  print('.');
  cluster.addInstance({user: "admin", host: "srv-mysql-03", password: dbPass})
  print('.\nInstances successfully added to the cluster.');
  print('\nInnoDB cluster deployed successfully.\n');
} catch(e) {
  print('\nThe InnoDB cluster could not be created.\n\nError: ' + e.message + '\n');
}

集群已成功创建,但是在将第二个实例添加到集群时会出现以下错误:

A new InnoDB cluster will be created on instance 'admin@srv-mysql-01:3306'.

Validating instance at srv-mysql-01:3306...

This instance reports its own address as 192.168.100.201

Instance configuration is suitable.
Creating InnoDB cluster 'cluster' on 'admin@srv-mysql-01:3306'...

Adding Seed Instance...
Cluster successfully created. Use Cluster.addInstance() to add MySQL instances.
At least 3 instances are needed for the cluster to be able to withstand up to
one server failure.

Adding instances to the cluster.A new instance will be added to the InnoDB cluster. Depending on the amount of
data on the cluster this might take from a few seconds to several hours.

Adding instance to the cluster ...

Validating instance at srv-mysql-02:3306...

This instance reports its own address as 192.168.100.202

Instance configuration is suitable.

The InnoDB cluster could not be created.

Error: Cluster.addInstance: WARNING: Not running locally on the server and can not access its error log.
ERROR: 
Group Replication join failed.
ERROR: Error joining instance to cluster: 'srv-mysql-02: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.

我想修复此错误。

我使用shell命令dba.checkInstanceConfiguration()检查了所有实例是否存在问题,并且没有出现错误。

但是在第2个实例的MySQL登录中有一些错误:

2019-07-20T23:24:43.085920Z 0 [ERROR] [MY-011526] [Repl] Plugin group_replication reported: 'This member has more executed transactions than those present in the group. Local transactions: 77aabf2e-aa76-11e9-9a4d-525400f0e95b:1-2 > Group transactions: 114adc66-ab3f-11e9-a109-525400f0e95b:1-7,

....

2019-07-20T23:24:43.086303Z 0 [ERROR] [MY-011522] [Repl] Plugin group_replication reported: 'The member contains transactions not present in the group. The member will now exit the group.'

my.conf

[mysqld]

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

bind-address=192.168.100.202
port=3306

# Replication part
server_id=202
gtid_mode=ON
enforce_gtid_consistency=ON
master_info_repository=TABLE
relay-log=srv-mysql-02-relay-bin
relay_log_info_repository=TABLE
binlog_checksum=NONE
log_slave_updates=ON
log_bin=binlog
binlog_format=ROW

# plugin-load = group_replication.so

default_authentication_plugin=mysql_native_password

# Group replication part
transaction_write_set_extraction=XXHASH64
loose-group_replication_start_on_boot=OFF
loose-group_replication_local_address="192.168.100.202:33061"
loose-group_replication_bootstrap_group=OFF
report_port=3306
report_host=192.168.100.202

[mysql]
default-character-set=utf8

任何帮助将不胜感激。

0 个答案:

没有答案
相关问题