Mysql InnoDb cluster adding new instance causes exception

Attiq Ur Rehman asked:

I have created Centos 7 VM instance on Google cloud. I installed MySql 8.0 on this. Configured all proper settings. Edited my.cnf. After finalizing my instance I created the snapshot of this instance and created two more instances from this snapshot.

I have to configure the Mysql InnoDB cluster using MySQL shell. Now the issue is there all newly created instance has the same UUID as their master node. When I try to add the new instance in InnoDB cluster it shows me the following error. I am literally stuck here. please anyone guide me how can I change the UUID of newly created machines. So that new noded can be added in MySQL Cluster.

Following is the error for

cluster1.addInstance('[email protected]*******:3306', { memberSslMode: 'REQUIRED', ipWhitelist:'**********************'}); 

    Cluster.addInstance: Cannot add an instance with the same server UUID (1ddc0de3-8050-11e8-8cc0-42010a8e0003) of an active member of the cluster 'server2:3306'. Please change the server UUID of the instance to add, all members must have a unique server UUID. (RuntimeError)

[[email protected] server3]# ls -ltr /dev/disk/by-uuid/
total 0
lrwxrwxrwx. 1 root root 10 Jul  5 13:19 51a7c7e4-4490-4c13-a7aa-446d8606cef5 -> ../../sda1

[[email protected] ~]# ls -ltr /dev/disk/by-uuid/
total 0
lrwxrwxrwx. 1 root root 10 Jul  5 12:19 51a7c7e4-4490-4c13-a7aa-446d8606cef5 -> ../../sda1

My answer:

The server UUID is stored in the file auto.cnf. Your snapshot should not contain this file, so that MySQL in each created instance generates its own unique UUID. Delete it and create a new snapshot.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.