{question}
Can I manage multiple clusters from a single SingleStore Toolbox instance?
{question}
{answer}
Yes, you are able to manage multiple existing clusters from one SingleStore toolbox instance using the below options:
--state-file, --cache-file, --backup-cache
along with all the toolbox commands,
Command:
sdb-admin --state-file /path/to/toolbox-state.hcl --cache-file /path/to/toolbox-cache.hcl --backup-cache /path/to/toolbox-cache-backup.hcl list-nodes
It's recommended to use all three options always and all three paths needed to point to a separate file.
For Example: Let's take the below cluster. We running the command from 10.0.0.11 (Master Node)
admin@ip-10-0-0-11:~$ sdb-admin list-nodes
+------------+------------+-----------+------+---------------+--------------+---------+----------------+--------------------+--------------+
| MemSQL ID | Role | Host | Port | Process State | Connectable? | Version | Recovery State | Availability Group | Bind Address |
+------------+------------+-----------+------+---------------+--------------+---------+----------------+--------------------+--------------+
| 6BB259B1A1 | Master | 10.0.0.11 | 3306 | Running | True | 7.3.13 | Online | | 0.0.0.0 |
| E61CC0C7D6 | Aggregator | 10.0.0.12 | 3306 | Running | True | 7.3.13 | Online | | 0.0.0.0 |
| 234DA40DC2 | Leaf | 10.0.0.11 | 3307 | Running | True | 7.3.13 | Online | 1 | 0.0.0.0 |
| A438C485BE | Leaf | 10.0.0.12 | 3307 | Running | True | 7.3.13 | Online | 1 | 0.0.0.0 |
+------------+------------+-----------+------+---------------+--------------+---------+----------------+--------------------+--------------+
Now we are going to manage some other clusters using the same toolbox on 10.0.0.11.
Below you will see a separate cluster with separate hosts / ports. The Next Step is to move the toolbox config files (state-file) of the below cluster to the 10.0.0.11 node so that we can manage the below cluster from one toolbox instance.
Note: All the hosts should be registered with the ssh key and the corresponding ssh keys should be moved to the 10.0.0.11 node so that the 10.0.0.11 node can connect to the remote nodes mentioned on the state file:
admin@ip-10-0-1-164:~$ sdb-admin list-nodes
+------------+--------+----------------------------------------+------+---------------+--------------+---------+----------------+--------------------+--------------+
| MemSQL ID | Role | Host | Port | Process State | Connectable? | Version | Recovery State | Availability Group | Bind Address |
+------------+--------+----------------------------------------+------+---------------+--------------+---------+----------------+--------------------+--------------+
| 2F6D352CE5 | Master | ec2-3-92-203-9.compute-1.amazonaws.com | 3306 | Running | True | 7.3.13 | Online | | 0.0.0.0 |
| 2D06DD61DA | Leaf | ec2-3-92-203-9.compute-1.amazonaws.com | 3307 | Running | True | 7.3.13 | Online | 1 | 0.0.0.0 |
| B8C20677F2 | Leaf | ec2-3-92-203-9.compute-1.amazonaws.com | 3308 | Running | True | 7.3.13 | Online | 1 | 0.0.0.0 |
+------------+--------+----------------------------------------+------+---------------+--------------+---------+----------------+--------------------+--------------+
So to manage the above cluster from 10.0.0.11:
- SSH Key files should be present to connect with the remote clusters.
- Ownership and Permission needed to be fixed for SSH Key files.
- The toolbox-state.hcl needs to be edited in case there is a change in the path to the SSH key on the new toolbox host.
- If the toolbox-cache-backup.hcl is not created yet, create an empty file and set a path to it as below.
Managing the cluster using the config options:
admin@ip-10-0-0-11:~$ sdb-admin --state-file /var/lib/memsql/cluster2config/toolbox-state.hcl --cache-file /var/lib/memsql/cluster2config/toolbox-cache.hcl --backup-cache /var/lib/memsql/cluster2config/toolbox-cache-backup.hcl list-nodes
+------------+--------+----------------------------------------+------+---------------+--------------+---------+----------------+--------------------+--------------+
| MemSQL ID | Role | Host | Port | Process State | Connectable? | Version | Recovery State | Availability Group | Bind Address |
+------------+--------+----------------------------------------+------+---------------+--------------+---------+----------------+--------------------+--------------+
| 2F6D352CE5 | Master | ec2-3-92-203-9.compute-1.amazonaws.com | 3306 | Running | True | 7.3.13 | Online | | 0.0.0.0 |
| 2D06DD61DA | Leaf | ec2-3-92-203-9.compute-1.amazonaws.com | 3307 | Running | True | 7.3.13 | Online | 1 | 0.0.0.0 |
| B8C20677F2 | Leaf | ec2-3-92-203-9.compute-1.amazonaws.com | 3308 | Running | True | 7.3.13 | Online | 1 | 0.0.0.0 |
+------------+--------+----------------------------------------+------+---------------+--------------+---------+----------------+--------------------+--------------+
For prettier and easy usage we can create symlink like below,
$ ln -s /var/lib/memsql/cluster2config/toolbox-state.hcl /home/admin/cluster_state
$ ln -s /var/lib/memsql/cluster2config/toolbox-cache.hcl /home/admin/cluster_cache
$ ln -s /var/lib/memsql/cluster2config/toolbox-cache-backup.hcl /home/admin/cluster_backup_cache
$ sdb-admin --state-file ~/cluster_state --cache-file ~/cluster_cache --backup-cache ~/cluster_backup_cache list-nodes
+------------+--------+----------------------------------------+------+---------------+--------------+---------+----------------+--------------------+--------------+
| MemSQL ID | Role | Host | Port | Process State | Connectable? | Version | Recovery State | Availability Group | Bind Address |
+------------+--------+----------------------------------------+------+---------------+--------------+---------+----------------+--------------------+--------------+
| 2F6D352CE5 | Master | ec2-3-92-203-9.compute-1.amazonaws.com | 3306 | Running | True | 7.5.6 | Online | | 0.0.0.0 |
| 2D06DD61DA | Leaf | ec2-3-92-203-9.compute-1.amazonaws.com | 3307 | Running | True | 7.5.6 | Online | 1 | 0.0.0.0 |
| B8C20677F2 | Leaf | ec2-3-92-203-9.compute-1.amazonaws.com | 3308 | Running | True | 7.5.6 | Online | 1 | 0.0.0.0 |
+------------+--------+----------------------------------------+------+---------------+--------------+---------+----------------+--------------------+--------------+
Important Note: If there have been changes to the cluster via toolbox on MA like register/unregister of a node. You need to make sure to register/unregister the node on the other toolbox as well. Toolbox would not share information with the other separate instances of Toolbox.
{answer}