web-dev-qa-db-ja.com

MySQL InnoDBクラスターに新しいインスタンスを追加できません

3つのインスタンスで構成される新しいMySQL InnoDBクラスター8.0.16を設定しています。

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

ビルドクラスターのmysqlシェルでJSスクリプトを実行します。

_mysqlsh --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');
}
_

クラスターは正常に作成されましたが、2番目のインスタンスをクラスターに追加するときに、以下のエラーが発生します。

_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.
_

このエラーを修正したいのですが。

シェルコマンド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

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
_

任意の助けいただければ幸いです。

1
Alexey

私は問題の解決策を見つけました:

1. dba.checkInstanceConfiguration()およびdba.configureInstance()を使用して、すべてのインスタンスを構成および検証する必要があります。
2。クラスターに追加するインスタンスのポート番号を指定します。
私のスクリプトの例:
cluster.addInstance({user: "admin", Host: "srv-mysql-02", port:3306, password: dbPass})

1
Alexey