Taking Leaves Offline with Cluster Downtime

Steps for Offline Maintenance

Step 1: Prior to performing any offline maintenance, SingleStore recommends that you take a backup as a standard precautionary measure. Refer to Back Up and Restore Data.

Step 2: Run the following commands from the master aggregator :

SHOW LEAVES

SHOW AGGREGATORS

SHOW CLUSTER STATUS

EXPLAIN RESTORE REDUNDANCY

EXPLAIN REBALANCE PARTITIONS

From the output of these commands, confirm that the following are true.

  • All leaves are online.

  • All aggregators are online.

  • There are no partitions with the “orphan” role.

REBALANCE or RESTORE REDUNDANCY commands need not be run.

Step 3: From the master aggregator, run the SNAPSHOT DATABASE command for each database.

Step 4: From the master aggregator, run the _SYNC_SNAPSHOT <databasename>; command for each database

This command makes sure that a snapshot is triggered on the replica and the replica also has a successful snapshot.

Step 5: Use sdb-admin stop-node to stop all the SingleStore nodes in the following sequence: first the master aggregator, then child aggregators, and finally the leaves.

If you are not able to stop the nodes in the specified order then you need to run SET GLOBAL leaf_failure_detection=OFF; from the master aggregator before stopping the nodes.

Step 6: Perform the maintenance tasks on the hosts as required.

Step 7: Use sdb-admin start-node to start all the SingleStore nodes in the following sequence: first, the leaf nodes, then the child aggregators, and finally the master aggregator. Note that the leaf nodes must be fully recovered before the child aggregators are started.

If you had turned leaf_failure_detection off in step 5, then run SET GLOBAL leaf_failure_detection=ON; from the master aggregator.

This procedure applies to self-managed deployments managed with SingleStore Tools. For Kubernetes operator-managed clusters, refer to Taking Leaves Offline on Kubernetes with Cluster Downtime instead of the sdb-admin commands.

Taking Leaves Offline on Kubernetes with Cluster Downtime

Use this procedure only for clusters managed by the SingleStore Kubernetes Operator. For maintenance that can be performed without taking the cluster offline, use the following steps:

Prerequisites

  • Confirm that the cluster is healthy and that all required backups and maintenance approvals are complete.

    • Check the MemsqlCluster phase:

      kubectl get memsql <cluster-name> -n <namespace> -o jsonpath="{.status.phase}"
    • The phase must be Running.

    • Confirm that your most recent backup completed according to your backup policy. Query the backup history from the MA:

      SELECT database_name, status, start_timestamp, end_timestamp
      FROM information_schema.mv_backup_history
      WHERE status = 'Success'
      ORDER BY start_timestamp DESC;
    • Refer to MV_BACKUP_HISTORY for more information on columns.

  • Confirm that the availability zone has enough spare capacity to reschedule pods displaced from the node under maintenance, or that your cluster autoscaler can provision additional capacity on demand. The exact verification steps depend on your Kubernetes environment and autoscaler configuration.

  • Do not modify the MemsqlCluster custom resource or change the Operator version during the maintenance window. The Operator can defer and replay specification changes, replace StatefulSets, or restart pods while the cluster is recovering.

Scale the Cluster Down

This procedure takes the cluster fully offline. Once all SingleStore pods are scaled to zero, you can perform maintenance on the Kubernetes nodes that hosted them and bring the cluster back up on the same pool of hosts. No additional spare capacity is required.

  1. Scale the Operator deployment to zero replicas so that it does not reconcile the temporary StatefulSet changes during maintenance.

    kubectl scale deployment <operator-deployment> --replicas=0
  2. Scale the node StatefulSets to zero replicas directly with kubectl; do not use the MemsqlCluster custom resource for this temporary maintenance operation.

    kubectl scale statefulset <statefulset-name> --replicas=0

    Repeat this for the Master Aggregator (MA), child aggregators, and leaf nodes in the order confirmed for your Operator version.

  3. Perform the required host maintenance.

Bring the Cluster Back Online

  1. Bring the MA StatefulSet online first using kubectl. The Operator startup probe attaches nodes by querying the MA.The MA must be available before dependent nodes can start normally.

    kubectl scale statefulset <master-aggregator-statefulset> --replicas=<ma_count>

    Set <ma_count> to the value of spec.masterAggregatorSpec.count in the MemsqlCluster resource: 1 for a single-MA cluster or 3 when MA HA (MA consensus) is enabled. For leaves and child aggregators, use the counts from spec.leafSpec.count and spec.aggregatorSpec.count, respectively.

  2. Bring the StatefulSets back online in the following order:

    • For redundancy level 2, scale both leaf StatefulSets (one per availability group) to spec.leafSpec.count. For redundancy level 1, scale the single leaf StatefulSet.

      kubectl scale statefulset <leaf-ag1-statefulset> --replicas=<leaf-count>
      kubectl scale statefulset <leaf-ag2-statefulset> --replicas=<leaf-count>
    • Scale the child aggregator StatefulSet to spec.aggregatorSpec.count.

      kubectl scale statefulset <child-aggregator-statefulset> --replicas=<ca-count>
    • After the cluster is healthy, scale the Operator deployment back up:

      kubectl scale deployment <operator-deployment> --replicas=1

Do not change the MemsqlCluster specification or the Operator version until recovery is complete and the cluster reports healthy.

Online Maintenance Alternative

For Kubernetes clusters, prefer an online maintenance workflow when the maintenance task permits it. The NoSchedule taint evicts SingleStore pods from the tainted Kubernetes node, and the Operator reschedules them onto other Kubernetes nodes in the same AZ. Spare capacity in the AZ is required so the Operator has somewhere to place the evicted pods.

  1. Confirm that spare capacity is available for pod rescheduling.

  2. Apply a NoSchedule taint to the Kubernetes node being maintained. Use the taint key and value appropriate for your environment.

    kubectl taint node <kubernetes-node-name> <key>=<value>:NoSchedule
  3. Trigger the Operator-managed rolling restart by updating an annotation under the node specification's objectMetaOverrides.annotations field. Add this annotation to each spec section that contains nodes: masterAggregatorSpec, childAggregatorSpec, and leafSpec. To perform maintenance across all Kubernetes nodes in the cluster, add the annotation to all three sections so the Operator rolls each node type in turn.

    spec:
    masterAggregatorSpec:
    objectMetaOverrides:
    annotations:
    <restart-annotation-key>: "<unique-value>"
    childAggregatorSpec:
    objectMetaOverrides:
    annotations:
    <restart-annotation-key>: "<unique-value>"
    leafSpec:
    objectMetaOverrides:
    annotations:
    <restart-annotation-key>: "<unique-value>"
  4. Wait for the Operator-managed rollout to finish and verify that the cluster is healthy before removing the taint.

The Operator detects the spec change and performs a rolling restart of the affected pods, keeping the cluster online. Persistent volumes are preserved across the restart.The annotation key is arbitrary. The Operator triggers the restart when the annotation value changes, regardless of the key. Select a key such as maintenance-annotation-key and update its value for each maintenance run. For example:

spec:
leafSpec:
objectMetaOverrides:
annotations:
maintenance-annotation-key: "2026-10-23-run-1"

For the next maintenance run, change the value (for example, to "2026-10-24-run-1") to trigger another rolling restart.

Last modified:

Was this article helpful?

Verification instructions

Note: You must install cosign to verify the authenticity of the SingleStore file.

Use the following steps to verify the authenticity of singlestoredb-server, singlestoredb-toolbox, singlestoredb-studio, and singlestore-client SingleStore files that have been downloaded.

You may perform the following steps on any computer that can run cosign, such as the main deployment host of the cluster.

  1. (Optional) Run the following command to view the associated signature files.

    curl undefined
  2. Download the signature file from the SingleStore release server.

    • Option 1: Click the Download Signature button next to the SingleStore file.

    • Option 2: Copy and paste the following URL into the address bar of your browser and save the signature file.

    • Option 3: Run the following command to download the signature file.

      curl -O undefined
  3. After the signature file has been downloaded, run the following command to verify the authenticity of the SingleStore file.

    echo -n undefined |
    cosign verify-blob --certificate-oidc-issuer https://oidc.eks.us-east-1.amazonaws.com/id/CCDCDBA1379A5596AB5B2E46DCA385BC \
    --certificate-identity https://kubernetes.io/namespaces/freya-production/serviceaccounts/job-worker \
    --bundle undefined \
    --new-bundle-format -
    Verified OK

Try Out This Notebook to See What’s Possible in SingleStore

Get access to other groundbreaking datasets and engage with our community for expert advice.