1. Home
  2. Docs
  3. ClusterControl
  4. Administration
  5. Graceful Shutdown

Graceful Shutdown

In a testing environment, you might need to perform a shutdown on ClusterControl and monitored database hosts in a graceful way. Depending on the clustering technology, the order of startup and shutting down is vital to keep the whole cluster in sync and ensure a smooth start-up operation in the future.

It’s recommended to let the ClusterControl node to be the last one to shut down since it needs to oversee the state of the monitored hosts and saves it into the CMON database. When starting up the database cluster at the later stage, ClusterControl will perform a proper start-up procedure based on the last known state of the monitored hosts.

ClusterControl needs to know whether the database cluster that you are shutting down was shutdown outside of the ClusterControl domain. Therefore, the proper steps to shut down the database hosts are:

MySQL Replication

Shutting down:

  1. Shutdown the application manually. This usually outside of the ClusterControl domain.
  2. Shutdown the Keepalived (if exists) by doing system shut down or through ClusterControl UI.
  3. Shutdown the load balancer service (if exists) by doing system shut down or through ClusterControl UI.
  4. Shutdown the slaves by using ClusterControl → Nodes → pick the server → Shutdown Node → Execute.
  5. Shutdown the master by using ClusterControl → Nodes → pick the server → Shutdown Node → Execute.
  6. Shutdown ClusterControl host by doing system shut down.

Starting up:

  1. Start ClusterControl host. Ensure you are able to connect to the UI and see the last state of the database cluster.
  2. Start the master. If auto recover is turned on, this master will be started automatically.
  3. Once the master is started, start the remaining slaves.
  4. Start the load balancer service (if exists).
  5. Start the virtual IP service (if exists).
  6. Start the application manually. This usually outside of the ClusterControl domain.

MySQL Galera

Shutting down:

  1. Shutdown the application manually. This usually outside of the ClusterControl domain.
  2. Shutdown the Keepalived (if exists) by doing system shut down or through ClusterControl UI.
  3. Shutdown the load balancer service (if exists) by doing system shut down or through ClusterControl UI.
  4. Shutdown the database cluster by using ClusterControl → Cluster Actions → Stop Cluster → Proceed.
  5. Shutdown ClusterControl host by doing system shut down.

Starting up:

  1. Start ClusterControl host. Ensure you are able to connect to the UI and see the last state of the database cluster.
  2. If auto-recovery is turned on, the cluster will be started automatically. Otherwise, go to ClusterControl → Cluster Actions → Bootstrap Cluster → Proceed.
  3. If auto-recovery is turned on, the load balancer and virtual IP service will be started automatically. Otherwise, start the load balancer service and virtual IP service accordingly.
  4. Start the application manually. This usually outside of the ClusterControl domain.

MySQL Cluster (NDB)

Shutting down:

  1. Shutdown the application manually. This usually outside of the ClusterControl domain.
  2. Shutdown the Keepalived (if exists) by doing system shut down or through ClusterControl UI.
  3. Shutdown the load balancer service (if exists) by doing system shut down or through ClusterControl UI.
  4. Shutdown the MySQL API servers by using ClusterControl → Nodes → pick the server → Shutdown Node → Execute.
  5. Shutdown the Data (NDB) servers by using ClusterControl → Nodes → pick the server → Shutdown Node → Execute.
  6. Shutdown the MySQL Cluster management servers by using ClusterControl → Nodes → pick the server → Shutdown Node → Execute.
  7. Shutdown ClusterControl host by doing system shut down.

Starting up:

  1. Start ClusterControl host. Ensure you are able to connect to the UI and see the last state of the database cluster.
  2. If auto recover is turned on, the cluster will be started automatically. Otherwise, start the nodes in this order – MySQL management, MySQL data, MySQL API.
  3. Start the load balancer service (if exists).
  4. Start the virtual IP service (if exists).
  5. Start the application manually. This usually outside of the ClusterControl domain.

MongoDB ReplicaSet

Shutting down:

  1. Shutdown the application manually. This usually outside of the ClusterControl domain.
  2. Shutdown the secondaries by using ClusterControl → Nodes → pick the server → Shutdown Node → Execute.
  3. Shutdown the primary by using ClusterControl → Nodes → pick the server → Shutdown Node → Execute.
  4. Shutdown ClusterControl host by doing a system shut down.

Starting up:

  1. Start ClusterControl host. Ensure you are able to connect to the UI and see the last state of the database cluster.
  2. Start the primary. If auto recover is turned on, this primary will be started automatically.
  3. Once the primary is started, start the remaining secondaries.
  4. Start the application manually. This usually outside of the ClusterControl domain.

PostgreSQL/TimeScaleDB Replication

Shutting down:

  1. Shutdown the application manually. This usually outside of the ClusterControl domain.
  2. Shutdown the slaves by using ClusterControl → Nodes → pick the server → Shutdown Node → Execute.
  3. Shutdown the master by using ClusterControl → Nodes → pick the server → Shutdown Node → Execute.
  4. Shutdown ClusterControl host by doing system shut down.

Starting up:

  1. Start ClusterControl host. Ensure you are able to connect to the UI and see the last state of the database cluster.
  2. Start the master. If auto recover is turned on, this master will be started automatically.
  3. Once the master is started, start the remaining slaves.
  4. Start the application manually. This usually outside of the ClusterControl domain.
Note

If the database server was being shut down gracefully outside of ClusterControl knowledge (through command line init script, systemd or kill -15), ClusterControl would still attempt to recover the database node if Node AutoRecovery is turned on. Unless the node is marked as ‘Under Maintenance’.

Was this article helpful to you? Yes 1 No