mysqlhigh-availabilitymysql-5.7mysql-innodb-cluster

Mysql server 5.7 - Can't add new cluster instance with mysql shell 'cluster.addInstance()'


Hello I am trying to setup a mysql InnoDB cluster architecture so far I installed mysql server 5.7 on 3 different servers and configured mysql clustering using the following commands:

dba.checkInstanceConfiguration();
dba.configureLocalInstance();
var cluster = dba.createCluster("myCluster");
cluster.addInstance("admin@db2:3306") // My username is admin, and the instance hostname is db2.

Problem is when running the last command mysql shell shows this error:

WARNING: A GTID set check of the MySQL instance at 'db2:3306' determined that it contains transactions that do not originate from the cluster, which must be discarded before it can join the cluster.

db2:3306 has the following errant GTIDs that do not exist in the cluster:
26224bda-bc5b-11ea-9a6e-000c29646186:1-27,
799fe52b-bd3b-11ea-a5ee-005056241c59:1-31,
f1e4837b-b6ce-11ea-b1c5-000c29646186:1

WARNING: Discarding these extra GTID events can either be done manually or by completely overwriting the state of db2:3306 with a physical snapshot from an existing cluster member. To use this method by default, set the 'recoveryMethod' option to 'clone'.

Having extra GTID events is not expected, and it is recommended to investigate this further and ensure that the data can be removed prior to choosing the clone recovery method.
ERROR: The target instance must be either cloned or fully provisioned before it can be added to the target cluster.
Built-in clone support is available starting with MySQL 8.0.17 and is the recommended method for provisioning instances.
Cluster.addInstance: Instance provisioning required (MYSQLSH 51153)

I tried dumping the entire database using the command mysqldump -uroot -proot --all-databases --triggers --routines --events --master-data > /dump.sqland imported it to the target instance but the problem persists.

How can I resolve this using mysql 5.7 please?


Solution

  • Ok I resolved this by emptying the table: mysql.gtid_executed, then restarted the server and its now correctly linked.