Unable to add new instance on MySQL InnoDB cluster I'm setting up new MySQL InnoDB cluster 8.0.16 consisting of three instances:


srv-mysql-01
srv-mysql-02
srv-mysql-03


I run JS-script in mysql shell for build cluster:

mysqlsh --file=/tmp/MakeCluster.js


Script:

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




Cluster has been created successfully but while adding 2-th instance to cluster it give below error:

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.


I'd like to fix this error. 

I checked all instances on possible problems using shell-command dba.checkInstanceConfiguration() and didn't look errors.

But there are some errors in MySQL log on 2-th instance:

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 &gt; 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


Any help would be appreciated.
I found solution the issue:

1.It's neccessary to configure and validate every instance with dba.checkInstanceConfiguration() and dba.configureInstance().
2.Specify port number of instance which we'll add to the cluster.
Example in my script:
cluster.addInstance({user: "admin", host: "srv-mysql-02", port:3306, password: dbPass})