Skip to main content

MetaDB Status Check and Basic Maintenance

This document describes how to check the MetaDB status in a high-availability NineData deployment and collect the key information required for follow-up maintenance.

In HA deployments, MetaDB runs in Kubernetes. Routine checks are typically completed with kubectl together with mysql and mysqlsh.

Step 1: Confirm Kubernetes Access​

  1. Sign in to a Master node that can access the NineData Kubernetes cluster.

  2. Run the following command to confirm that kubectl is available:

    kubectl version --client
  3. Confirm that the jz-component namespace exists:

    kubectl get ns jz-component

Step 2: Confirm MetaDB Credentials and Instance Status​

  1. Check whether the MetaDB Secret exists:

    kubectl get secret -n jz-component ninedata-pwds
  2. Check the MetaDB Pod status:

    kubectl get pods -n jz-component -o wide | grep ninedata-meta-cluster
  3. If you also want to view the planned instance count and current cluster state, run:

    kubectl get innodbcluster -n jz-component ninedata-meta-cluster -o yaml
    Parameter Notes
    • instances is the planned MetaDB instance count.
    • onlineInstances is the number of instances currently online.
    • status displays the current cluster state, such as ONLINE.

Step 3: Get the MetaDB Administrator Password​

Run the following command to store the root password in an environment variable for the current shell session:

ROOT_PWD=$(kubectl get secret -n jz-component ninedata-pwds -o jsonpath='{.data.rootPassword}' | base64 -d)

The following commands can reuse this variable directly without manually copying the password.

Step 4: Check Basic Instance Information with MySQL​

Run the following command to query the instance hostname, instance UUID, and read-only status:

kubectl exec -n jz-component ninedata-meta-cluster-0 -c mysql -- sh -lc \
"MYSQL_PWD='$ROOT_PWD' mysql -uroot -Nse \"select @@hostname as host, @@server_uuid as server_uuid, @@read_only as read_only;\""

In the returned result:

  • host is the current MetaDB instance name.
  • server_uuid is the unique identifier of the instance.
  • read_only = 0 means the current instance is writable.

Step 5: View Cluster Status with MySQL Shell​

Run the following command to obtain the detailed InnoDBCluster status:

kubectl exec -n jz-component ninedata-meta-cluster-0 -c sidecar -- sh -lc \
"mysqlsh --js --user=root --password='$ROOT_PWD' --host=127.0.0.1 --port=3306 -e 'var s=dba.getCluster().status(); print(JSON.stringify(s, null, 2))'"

Focus on the following fields:

  • defaultReplicaSet.status: the current cluster state.
  • statusText: the human-readable cluster status description.
  • primary: the current Primary instance address.
  • topology: the role, state, and version of each instance.

Step 6: Clear the Local Password Variable​

After the check finishes, clear the password variable from the current shell session:

unset ROOT_PWD

Maintenance Recommendations​

  • Perform MetaDB checks on a Master node where kubectl is available.
  • Before any high-risk maintenance action, review both the innodbcluster instance count and the mysqlsh cluster status output.
  • When MetaDB is deployed as a single instance, it does not tolerate failures. Plan related operations during a maintenance window.
  • If you need multi-instance switchover, node rebuild, or topology adjustment, confirm the actual MetaDB deployment model first and then follow the matching maintenance procedure.