{question}
How to disable SingleStore node auto restart after host reboot?
{question}
{answer}
In this article, we will discuss how to disable SingleStore Node autostart in the event of a planned maintenance operation (Host Reboot). This can be achieved by using the below option in the toolbox:
sdb-admin disable-nodes-autostart [flags]
For Linux versions that support systemd, disable the use of systemd for restarting all nodes on specified hosts at startup.
To execute this command, the user running memsqlctl must have sudo privileges on the specified hosts. The sudo privileges can be revoked post the command execution.
To learn more about the command, click here.
NOTE: If you disable the autostart. Make sure to start the nodes manually on every planned or unplanned reboot. It is recommended to stop the leaf nodes first before performing the reboot of the host to ensure cluster health.
Let's take the below cluster, which has 4 Nodes on 2 Hosts (10.0.0.11,10.0.0.12):
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 |
+------------+------------+-----------+------+---------------+--------------+---------+----------------+--------------------+--------------+
| 87B36292E2 | Master | 10.0.0.11 | 3306 | Running | True | 7.3.11 | Online | | 0.0.0.0 |
| 2197F1413D | Aggregator | 10.0.0.12 | 3306 | Running | True | 7.3.11 | Online | | 0.0.0.0 |
| 2BA5F3B4E5 | Leaf | 10.0.0.11 | 3307 | Running | True | 7.3.11 | Online | 1 | 0.0.0.0 |
| F6DB441CBC | Leaf | 10.0.0.12 | 3307 | Running | True | 7.3.11 | Online | 1 | 0.0.0.0 |
+------------+------------+-----------+------+---------------+--------------+---------+----------------+--------------------+--------------+
Disabling the autostart like below:
admin@ip-10-0-0-11:~$ sdb-admin disable-nodes-autostart --all
✓ Successfully connected to host 10.0.0.11
✓ Successfully connected to host 10.0.0.12
Toolbox will perform the following actions:
· Disable the service on the following hosts:
- 10.0.0.11
- 10.0.0.12
Would you like to continue? [y/N]: y
✓ Disabled node-restart on startup on host 10.0.0.11
✓ Disabled node-restart on startup on host 10.0.0.12
Stopping all the nodes:
admin@ip-10-0-0-11:~$ sdb-admin stop-node --all -y
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 |
+------------+------------+-----------+------+---------------+--------------+---------+----------------+--------------------+--------------+
| 87B36292E2 | Master | 10.0.0.11 | 3306 | Stopped | False | 7.3.11 | Unknown | | 0.0.0.0 |
| 2197F1413D | Aggregator | 10.0.0.12 | 3306 | Stopped | False | 7.3.11 | Unknown | | 0.0.0.0 |
| 2BA5F3B4E5 | Leaf | 10.0.0.11 | 3307 | Stopped | False | 7.3.11 | Unknown | | 0.0.0.0 |
| F6DB441CBC | Leaf | 10.0.0.12 | 3307 | Stopped | False | 7.3.11 | Unknown | | 0.0.0.0 |
+------------+------------+-----------+------+---------------+--------------+---------+----------------+--------------------+--------------+
Rebooting both the hosts (10.0.0.11,10.0.0.12):
admin@ip-10-0-0-12:~$ sudo reboot
admin@ip-10-0-0-11:~$ sudo reboot
Checking in after host reboot, we can see nodes hasn't been started automatically by the OS:
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 |
+------------+------------+-----------+------+---------------+--------------+---------+----------------+--------------------+--------------+
| 87B36292E2 | Master | 10.0.0.11 | 3306 | Stopped | False | 7.3.11 | Unknown | | 0.0.0.0 |
| 2197F1413D | Aggregator | 10.0.0.12 | 3306 | Stopped | False | 7.3.11 | Unknown | | 0.0.0.0 |
| 2BA5F3B4E5 | Leaf | 10.0.0.11 | 3307 | Stopped | False | 7.3.11 | Unknown | | 0.0.0.0 |
| F6DB441CBC | Leaf | 10.0.0.12 | 3307 | Stopped | False | 7.3.11 | Unknown | | 0.0.0.0 |
+------------+------------+-----------+------+---------------+--------------+---------+----------------+--------------------+--------------+
Starting the nodes manually:
admin@ip-10-0-0-11:~$ sdb-admin start-node --all -y
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 |
+------------+------------+-----------+------+---------------+--------------+---------+----------------+--------------------+--------------+
| 87B36292E2 | Master | 10.0.0.11 | 3306 | Running | True | 7.3.11 | Online | | 0.0.0.0 |
| 2197F1413D | Aggregator | 10.0.0.12 | 3306 | Running | True | 7.3.11 | Online | | 0.0.0.0 |
| 2BA5F3B4E5 | Leaf | 10.0.0.11 | 3307 | Running | True | 7.3.11 | Online | 1 | 0.0.0.0 |
| F6DB441CBC | Leaf | 10.0.0.12 | 3307 | Running | True | 7.3.11 | Online | 1 | 0.0.0.0 |
+------------+------------+-----------+------+---------------+--------------+---------+----------------+--------------------+--------------+
We can enable node autostart using the below command:
admin@ip-10-0-0-11:~$ sdb-admin enable-nodes-autostart --all
✓ Successfully connected to host 10.0.0.11
✓ Successfully connected to host 10.0.0.12
Toolbox will perform the following actions
· Write the service file and enable the service on the following hosts
- 10.0.0.11
- 10.0.0.12
Would you like to continue? [y/N]: y
✓ Successfully wrote service file to "10.0.0.11"
✓ Successfully wrote service file to "10.0.0.12"
✓ Successfully enabled nodes to start on reboot on host 10.0.0.11
✓ Successfully enabled nodes to start on reboot on host 10.0.0.12
To learn more about the command, click here.
{answer}