DEV Community

tongxi
tongxi

Posted on

openGauss Querying Status

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

Prerequisites
openGaussThe database has started.

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

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.
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

Logs of the primary node or WALs do not exist, or 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 openGauss the 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 port instance state

1 pekpopgsci00235 10.244.62.204 5432 6001 /opt/gaussdb/cluster/data/dn1 P Primary Normal
2 pekpopgsci00238 10.244.61.81 5432 6002 /opt/gaussdb/cluster/data/dn1 S Standby Normal

Top comments (0)