Querying Status

Background

GaussDB KernelopenGauss allows you to view the status of the entire GaussDB KernelopenGauss. The query result shows whether openGaussthe database or a single host is running properly.

Prerequisites

openGaussThe database has started.

Procedure

  1. Log in as the OS user omm to the primary node of the database.

  2. Run the following command to query openGaussthe database status:

    gs_om -t status --detail
    

    Table 1 describes parameters in the query result.

    To query the instance status on a host, add -h to the command. For example:

    gs_om -t status -h plat2 
    

    plat2 indicates the name of the host to be queried.

Parameter Description

Table 1 Node role description

Field

Description

Value

cluster_state

openGaussThe database status, which indicates whether the entire openGaussdatabase is running properly.

  • Normal: openGaussThe database is available and the data has redundancy backup. All the processes are running and the primary/standby relationship is normal.
  • Unavailable: openGaussThe database is unavailable.
  • Degraded: openGaussThe database is available and faulty database nodes and primary database nodes exist.

node

Host name.

Specifies the name of the host where the instance is located. If multiple AZs exist, the AZ IDs will be displayed.

node_ip

Host IP Address.

Specifies the IP address of the host where the instance is located.

instance

Instance ID.

Specifies the instance ID.

state

Instance role

  • Normal: a single host instance.
  • Primary: The instance is a primary instance.
  • Standby: The instance is a standby instance.
  • Cascade Standby: The instance is a cascaded standby instance.
  • Secondary: The instance is a secondary instance.
  • Pending: The instance is in the quorum phase.
  • Unknown: The instance status is unknown.
  • Down: The instance is down.
  • Abnormal: The node is abnormal.
  • Manually stopped: The node has been manually stopped.

Each role has different states, such as startup and connection. The states are described as follows:

Table 2 Node state description

State

Description

Normal

The node starts up normally.

Need repair

The node needs to be restored.

Starting

The node is starting up.

Wait promoting

The node is waiting for upgrade. For example, after the standby node sends an upgrade request to the primary node, the standby node is waiting for the response from the primary node.

Promoting

The standby node is being upgraded to the primary node.

Demoting

The node is being downgraded, for example, the primary node is being downgraded to the standby node.

Building

The standby node fails to be started and needs to be rebuilt.

Catchup

The standby node is catching up with the primary node.

Coredump

The node program breaks down.

Unknown

The node status is unknown.

If a node is in Need repair state, you need to rebuild the node to restore it. Generally, the reasons for rebuilding a node are as follows:

Table 3 Node rebuilding causes

State

Description

Normal

The node starts up normally.

WAL segment removed

WALs of the primary node do not exist, and logs of the standby node are later than those of the primary node.

Disconnect

Standby node cannot be connected to the primary node.

Version not matched

The binary versions of the primary and standby nodes are inconsistent.

Mode not matched

Nodes do not match the primary and standby roles. For example, two standby nodes are connected.

System id not matched

The database system IDs of the primary and standby nodes are inconsistent. The system IDs of the primary and standby nodes must be the same.

Timeline not matched

The log timelines are inconsistent.

Unknown

Unknown cause.

Examples

View openGaussthe database status details, including instance status.

gs_om -t status --detail
[   Cluster State   ]

cluster_state   : Normal
redistributing  : No
current_az      : AZ_ALL

[  Datanode State   ]

node               node_ip         instance                                 state            | node               node_ip         instance                                 state
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1  pekpopgsci00235 10.244.62.204   6001 /opt/gaussdb/cluster/data/dn1 P Primary Normal | 2  pekpopgsci00238 10.244.61.81    6002 /opt/gaussdb/cluster/data/dn1 S Standby Normal
gs_om -t status --detail
[  CMServer State   ]

node      node_ip         instance                                 state
--------------------------------------------------------------------------
1  host40 10.243.40.20    1    /usr1/cm_gauss/cluster/cm/cm_server Primary
2  host39 10.243.39.8     2    /usr1/cm_gauss/cluster/cm/cm_server Standby
3  host15 10.243.15.65    3    /usr1/cm_gauss/cluster/cm/cm_server Standby

[    ETCD State     ]

node      node_ip         instance                         state
------------------------------------------------------------------------
1  host40 10.243.40.20    7001 /usr1/cm_gauss/cluster/etcd StateFollower
2  host39 10.243.39.8     7002 /usr1/cm_gauss/cluster/etcd StateFollower
3  host15 10.243.15.65    7003 /usr1/cm_gauss/cluster/etcd StateLeader

[   Cluster State   ]

cluster_state   : Normal
redistributing  : No
balanced        : Yes
current_az      : AZ_ALL

[  Datanode State   ]

node      node_ip         instance                        state            | node      node_ip         instance                        state            | node      node_ip         instance                        state
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1  host40 10.243.40.20    6001 /usr1/cm_gauss/cluster/dn1 P Primary Normal | 2  host39 10.243.39.8     6002 /usr1/cm_gauss/cluster/dn1 S Standby Normal | 3  host15 10.243.15.65    6003 /usr1/cm_gauss/cluster/dn1 S Standby Normal
Feedback
编组 3备份
    openGauss 2024-05-05 00:44:49
    cancel