Welcome to the third part of this series. I’m glad you’re still reading, as hopefully this means you find this subject interesting at least. Previously we presented the first two components of MySQL InnoDB Cluster: Group Replication and MySQL Router and now we will discuss the last component, MySQL Shell.
This is the last component in the cluster and I love it. Oracle have created this tool to centralize cluster management, providing a friendly, command-line based user interface.
The tool can be defined as an advanced MySQL shell, which is much more powerful than the well known MySQL client. With the capacity to work with both relational and document (JSON) data, the tool provides an extended capability to interact with the database from a single place.
MySQL Shell is also able to understand different languages:
A very interesting feature provided with MySQL Shell is the ability to establish different connections to different servers/clusters from within the same shell. There is no need to exit to connect to a different server, just issuing the command connect will make this happen. As DBA, I find this pretty useful when handling multiple clusters/servers.
Some of the features present in this tool:
Samples of new tool and execution modes:
|
1 |
#switch modes<br>sql<br>js<br>py<br><br>#connect to instance<br>connect user@host:[port]<br><br>#create a cluster (better to handle through variables)<br>var cluster=dba.createCluster('percona')<br><br>#add instances to cluster<br>cluster.addInstance('[email protected]:3306')<br><br>#check cluster status<br>cluster.status()<br><br>#using another variable<br>var cluster2=dba.getCluster('percona')<br>cluster.status()<br><br>#get cluster structure<br>cluster.describe()<br><br>#rejoin instance to cluster - needs to be executed locally to the instance<br>cluster.rejoinInstance()<br><br>#rejoin instance to cluster - needs to be executed locally to the instance<br>cluster.rejoinInstance()<br><br>#recover from lost quorum<br>cluster.forceQuorumUsingPartitionOf('root@localhost:3306')<br><br>#recover from lost quorum<br>cluster.rebootClusterFromCompleteOutage()<br><br>#destroy cluster<br>cluster.dissolve({force:true}); |
Personally, I think this tool is a very good replacement for the classic MySQL client. Sadly, mysql-server installations do not include MySQL shell by default, but it is worth getting used to. I recommend you try it.
We finally reached the end of this series. I hope you have enjoyed this short introduction to what seems to be Oracle’s bid to have a built-in High Availability solution based on InnoDB. It may become a good competitor to Galera-based solutions. Still, there is a long way to go, as the tool was only just released as GA (April 2018). There are a bunch of things that need to be addressed before it becomes consistent enough to be production-ready. In my personal opinion, it is not—yet. Nevertheless, I think it is a great tool that will eventually be a serious player in the HA field as it’s an excellent, flexible and easy to deploy solution.
Resources
RELATED POSTS