Thursday, May 17, 2018

MySQL InnoDB Cluster Sandbox

InnoDB Cluster is major revolution for MySQL Replication but it is often hard to test out new technologies without a major investment in time, hardware, and frustration.  But what if there was a quick and easy way to set up a test InnoDB Cluster?

Sandbox

The details on how to set up a Sandbox InnoDB Cluster  is detailed at https://dev.mysql.com/doc/refman/8.0/en/mysql-innodb-cluster-sandbox-deployment.html but for those seeking a quick and dirty example please keep reading.

Step 1 - Fire up the MySQL Shell and Crate Sandbox Instances

Start the MySQL shell and create a Sandbox instance. In this example we set up a sandbox instance at port 3310.


An InnoDB Cluster needs three nodes for fault tolerance so we need to fire up to more sandbox instances on ports 3311 and 3312.


Step 2 -- Create Cluster

Connect to one of the sandbox instances, the server of 3310 in this example. Now we use the shell to create a cluster names mydemo.


Step 3 -- Add Instances to Cluster

Now we add the other two sandbox instances to the cluster.


Check Status

And with that we can use cluster.status() to see that the sandbox InnoDB cluster is ready to use. We have two read only nodes and one read write node.

Step 4 -- Start MySQL Router

Finally we start MySQL Router!


And there is how you set up a test instance of an InnoDB cluster in just a few minutes.