Rejoining a Node to MySQL's InnoDB cluster

What is InnoDB Cluster?
Hot off of Oracle Open World 2016 is the lab release of MySQL's InnoDB Cluster. InnoDB Cluster uses the Group Replication plugin to allow for virtually synchronous replication, while also providing a MySQL Router that is aware of the cluster state. By connecting your application to the router, your application will be able to withstand failover of any node participating in the cluster. InnoDB Cluster also provides a new MySQL Shell to interact with the cluster commands. MySQL's server team gives us a very good hands-on tutorial if you're interested in getting started with InnoDB Cluster. The tutorial includes steps to setup and deploy a local sandbox Cluster. It also provides steps to kill a node and shows how the MySQL Router handles the failure. One thing that was missing for me was how to rejoin the node to the cluster.How to rejoin a node to the cluster?
If you followed the tutorial, you should come to the point where you killed the master node. Your cluster status would look like this: [code type="sql"] mysql-js> cluster.status() { "clusterName": "pythian", "defaultReplicaSet": { "status": "Cluster is NOT tolerant to any failures.", "topology": { "localhost:3320": { "address": "localhost:3320", "status": "ONLINE", "role": "HA", "mode": "R/W", "leaves": { "localhost:3330": { "address": "localhost:3330", "status": "ONLINE", "role": "HA", "mode": "R/O", "leaves": {} }, "localhost:3310": { "address": "localhost:3310", "status": "OFFLINE", "role": "HA", "mode": "R/O", "leaves": {} } } } } } } [/code] Keep in mind, it shows this because I'm connected from the MySQL Router. That appears to be working. So let's bring the failed node back online: [code type="sql"] mysql-js> dba.startLocalInstance(3310) The MySQL sandbox instance on this host in /home/vagrant/mysql-sandboxes/3310 will be started Starting MySQL instance... Instance localhost:3310 successfully started. [/code] Great! So is the node re-joined to the cluster? [code type="sql"] mysql-js> cluster.status() { "clusterName": "pythian", "defaultReplicaSet": { "status": "Cluster is NOT tolerant to any failures.", "topology": { "localhost:3320": { "address": "localhost:3320", "status": "ONLINE", "role": "HA", "mode": "R/W", "leaves": { "localhost:3330": { "address": "localhost:3330", "status": "ONLINE", "role": "HA", "mode": "R/O", "leaves": {} }, "localhost:3310": { "address": "localhost:3310", "status": "OFFLINE", "role": "HA", "mode": "R/O", "leaves": {} } } } } } } [/code] Nope. Also note that this cluster is not tolerant to any failures. After perusing the commands available to dba and cluster(which is an alias to dba.getCluster()), I gather that you need to do two steps to rejoin the node to the instance:- Validate the instance can join with dba.validateInstance().
- Issue a rejoin command with cluster.rejoinInstance()
Conclusion
MySQL's InnoDB Cluster is an interesting new Lab Technology. It encompasses three new tools or technologies:- Group Replication, which was announced a couple of years ago, and which might challenge Galera in the coming years.
- The MySQL Router allows your application to be cluster aware, without requiring driver changes in your code.
- The new MySQL Shell to interact with the cluster drivers. It has two modes: javascript and sql