Skip to content

Checking your reading list…

Retry verification

Stay curious. Build better.

Appearance

Choose how BestHub looks on this device.

Changes apply immediately.

Search articles

Open Discover with these filters

Suggested searches

GaussDB High Availability Validation: Failover Times, Failure Scenarios & Backup Impact
Databases 24 min read

GaussDB High Availability Validation: Failover Times, Failure Scenarios & Backup Impact

This article details GaussDB centralized database high availability testing across a 3AZ deployment, measuring failover times for primary node failures (10-102s), replica failures (read-only 6-150s), backup impact (primary backup reduces TPS 40%), AZ switchover (~9s), and network degradation effects, while noting zombie detection delays and connection handling requirements.

Test Environment Preparation

1.1 Deployment Architecture

The test environment uses a production-grade same-city 3AZ three-node cluster deployment, with one database server per node. Each AZ represents a separate data center module. The architecture includes:

CM Agent : Management service component started by OMM (1s interval). Responsible for CMS and DN process keep-alive, start/stop, arbitration metric collection, and command execution. Runs on every host. Failure may cause loss of start/stop capability and instance fault detection.

CM Server : Management service component started by CMA (1s interval). Judges instance state from CM Agent reports, decides if repair is needed, and issues commands to CM Agent. Stores cluster topology in ETCD.

OM Monitor : Management service component started by crontab (1min interval). Handles keep-alive and start/stop of OMM, etcd, and cm_agent processes.

DN Node : Data service component started by CMA (1s interval). Stores business data, executes queries, returns results. Primary/standby replication uses Quorum or Paxos protocol.

ETCD Node : Management service component auto-started by OMM (1s interval). Assists CMS leader election, persists arbitration info, saves cluster topology.

Note : DN primary, ETCD primary, and CM Server primary are not necessarily on the same host; they distribute across servers.

Deployment architecture diagram
Deployment architecture diagram

1.2 High Availability Test Scripts

1.2.1 Benchmark-TPCC Test

Script Configuration

db=postgers
driver=com.huawei.gaussdb.jdbc.Driver
conn=jdbc:gaussdb://xx.xx.xx.xx:port, xx.xx.xx.xx:port/dbxx?currentSchema=xx&targetServerType=master&socketTimeout=60&connectionTimeout=2&LoginTimeout=6&ltRowFetchSize=1000

Run Commands

## Prepare data
sh runDatabaseBuild.sh props.gs
## Run test
sh runBenchmark.sh props.gs
## Clean data
sh runDatabaseDestroy.sh props.gs

1.2.2 Sysbench Test

Install Sysbench with PostgreSQL support

yum install -y make automake libtool pkgconfig libaio-devel
yum install -y openssl-devel mysql-devel postgresql-devel
./autogen.sh
./configure -prefix=xx --with-pgsql
make && make install

Modify GaussDB Parameters and Restart

## Modify parameter password_encryption_type
Gs_guc set -Z datanode -N all -c "password_encryption_type=1"
## Modify gs_hba.conf, add:
Host all all 0.0.0.0/0 md5
## Apply changes
## Reconfigure user password (required for md5)
=> alter user xxxx identified by 'xxxx';
Because sysbench connects to gaussdb using md5 encryption, which is not enabled by default.

Prepare and Run

## Prepare statement
sysbench oltp_read_write.lua --db-driver=pgsql --pgsql-host=xx.xx.xx.xx --pgsql-port=xx --pgsql-user=xx --pgsql-password=xx --pgsql-db=xx --tables=10 --table-size=1000000 --threads=10 --time=300 --report-interval=1 prepare
## Run statement
sysbench oltp_read_write.lua --db-driver=pgsql --pgsql-host=xx.xx.xx.xx --pgsql-port=xx --pgsql-user=xx --pgsql-password=xx --pgsql-db=xx --tables=10 --table-size=1000000 --threads=10 --time=300 --report-interval=1 run

1.2.3 Interrupt and Continue Execution

Since TPCC and sysbench exit on error, a monitor script restarts tasks on interruption to verify business recovery time during faults.

#!/bin/sh

# Input variable
log_output=$1

# Process to monitor
PROCESS_NAME="runBenchmark.sh"

# Start command
cd /tmp/benchmarksq5.0/run
START_COMMAND="/bin/sh /tmp/benchmarksq5.0/run/runBenchmark.sh props.gs >> $1"

# Log file
LOG_FILE="/tmp/monitor_and_restart.log"

# Infinite monitoring loop
while true; do
    # Check if process exists
    if ! pgrep -x "$PROCESS_NAME" > /dev/null; then
        echo "$(date): $PROCESS_NAME is not running. Restarting..." | tee -a "$LOG_FILE"
        eval $START_COMMAND
        if [ $? -eq 0 ]; then
            echo "$(date): $PROCESS_NAME restarted successfully." | tee -a "$LOG_FILE"
        else
            echo "$(date): Failed to restart $PROCESS_NAME." | tee -a "$LOG_FILE"
        fi
    else
        echo "$(date): $PROCESS_NAME is running." | tee -a "$LOG_FILE"
    fi
    sleep 1
done

High Availability Test Scenarios

2.1 DN Primary Node Failure Validity

2.1.1 Test Objective

Examine impact on business when DN primary node is abnormal: can DN nodes switch normally, and what is the business impact duration?

2.1.2 Fault Scenarios

DN Primary Process Stop

# Query node info
Cm_ctl query -Cv
# Stop operation
Cm_ctl stop -n 1 -D /xx/dn_6001

TPS drops to 0 for ~16s — DN primary/standby switchover time.

DN Primary Process Kill

ps -fu $USER | grep 'bin/gaussdb' | grep -v 'grep' | awk '{print $2}' | xargs kill -9

TPS drops to 0 for ~10s — DN primary/standby switchover time.

DN Primary Process Hang (SIGSTOP)

ps -fu $USER | grep 'bin/gaussdb' | grep -v 'grep' | awk '{print $2}' | xargs kill -19

TPS drops to 0 for ~102s — detection of DN primary anomaly and switchover. Process hang triggers DN zombie detection mechanism.

DN Primary Server Network Interface Disabled

## Disable NIC
ifdown eth0
## Restore NIC
ifup eth0

DN primary switches quickly, but application connections hang without response; old connections are not released and the link is broken . Application side must have link timeout disconnection mechanism. New connection requests use the new DN primary.

DN Primary Server Reboot

## Reboot server
reboot

TPS drops to 0 for ~14s — DN primary/standby switchover time.

2.1.3 DN Zombie Detection Mechanism

When DN process is in D, T, Z states or connection timeout (zombie state), it cannot handle requests, causing business interruption. CM supports periodic detection of zombie state based on configured values; after consecutive zombie detections reach configured count, restart recovery is triggered.

Zombie detection flow
Zombie detection flow

If enable_e2e_rto is enabled, a single zombie detection sets instance state to UNKNOWN, triggering leader arbitration. Default is disabled; controlled by agent_phony_dead_check_interval (default 10s) and phony_dead_effective_time (default 5 times).

Connection-type zombie: default (10 * 5) seconds before marking zombie and triggering restart.

D/T state zombie: to avoid false positives from normal D state or gstack-induced T state, requires persistent unchanged state for 3 minutes before restart.

Coredump: D/T states also appear; upon detecting database core flag, no restart is performed but instance is set to UNKNOWN, triggering leader arbitration.

2.2 DN Replica Node Failure Validity

2.2.1 Test Objective

Examine business impact when a single DN standby or all DN standbys are abnormal.

2.2.2 Fault Scenarios

Single DN Process Stop : No business impact; process requires manual start.

Single DN Process Kill : No business impact; process auto-restarted by CMA after 1s.

Single DN Process Hang : No business impact; zombie detection triggers, kill and auto-restart after ~100s.

Single DN Server NIC Disabled : No business impact; recovers when network restores.

Single DN Server Reboot : No business impact; DN process auto-starts after standby reboot.

All DN Standby Processes Kill : Business becomes read-only for ~6s — standby DN process recovery time.

All DN Standby Processes Hang : Business becomes read-only for ~150s — detection, kill, and restart of standby DN processes. Zombie detection triggered.

All DN Standby Network Anomaly : Business becomes read-only ; impact duration equals network recovery time.

All DN Nodes Server Reboot : Business becomes read-only for ~110s — standby DN server reboot recovery time.

2.3 ETCD Node Failure Validity

2.3.1 Test Objective

Examine business impact when ETCD nodes are abnormal.

2.3.2 Fault Scenarios

Kill All ETCD Processes : No business impact; ETCD processes auto-restarted by OMM after 1s. ETCD primary switches .

Hang All ETCD Processes : No business impact; ETCD processes killed and auto-restarted by OMM after 1s. ETCD primary switches .

2.4 CM Server Component Failure Validity

2.4.1 Test Objective

Examine business impact when CM Server components are abnormal.

2.4.2 Fault Scenarios

Kill All CM Server Processes : No business impact; CM Server processes auto-restarted by CMA after 1s. CM Server primary switches .

Hang All CM Server Processes : No business impact; CM Server processes killed and auto-restarted by CMA after 1s. CM Server primary switches .

2.5 CM Agent Component Failure Validity

2.5.1 Test Objective

Examine business impact when CM Agent is abnormal.

2.5.2 Fault Scenarios

Kill All CM Agent Processes : No business impact; CM Server processes auto-restarted by OMM after 1s.

Hang All CM Agent Processes : No business impact; CM Server processes killed and auto-restarted by OMM after 1s.

2.6 Backup Impact Verification

2.6.1 Test Objective

Examine impact of GaussDB primary and standby backups on read/write business.

2.6.2 Test Scenarios

Primary Node Backup : TPS drops ~40% during backup; recovers after backup ends.

Standby Node Backup : No significant change in TPS or response time; no business impact.

Standby Backup Impact on Standby Read Business : No significant change in standby read TPS or response time; no business impact.

2.7 AZ Failover Impact Verification

2.7.1 Test Objective

Examine business impact during manual AZ failover.

2.7.2 Test Scenarios

DN Node AZ Switchover via cm_ctl

# Switchover operation
cm_ctl switchover -z AZ2

TPS drops to 0 for ~9s — DN primary/standby AZ switchover time.

AZ Switchover via TPOPS Management Platform : TPS drops to 0 for ~9s — same switchover time.

2.8 DN Primary Server Performance Degradation

2.8.1 Test Objective

Examine business impact when DN primary server network performance degrades.

2.8.2 Test Scenarios

High Network Latency on DN Primary

# Simulate high latency
tc qdisc add dev eth0 root netem delay 2ms 0.3ms
# Cancel
tc qdisc del dev eth0 root netem delay 2ms 0.3ms

TPS drops ~60% during fault; recovers after network restore.

High Network Jitter on DN Primary

# Simulate high jitter
tc qdisc add dev eth0 root netem delay 0.1ms 2ms
# Cancel
tc qdisc del dev eth0 root netem delay 0.1ms 2ms

TPS drops ~40% during fault; recovers after network restore.

High Network Retransmission on DN Primary

# Simulate high packet loss
tc qdisc add dev eth0 root netem loss 10%
# Cancel
tc qdisc del dev eth0 root netem loss 10%

TPS drops ~95% during fault; recovers after network restore.

High Availability Test Summary

Overall, GaussDB provides automatic switchover capability for DN primary process and server anomalies, and supports manual AZ-level switchover. Key test results:

DN primary anomaly: normal switchover to standby; TPS drops to 0 for ~10s .

DN standby anomaly: CMA auto-restarts process. When all standbys fail, database becomes read-only to ensure high reliability ; recovery time equals standby recovery time.

DN process hang or port pseudo-alive: DN triggers zombie detection ; anomaly handling takes 100-200s.

DN primary network anomaly: DN primary/standby switches but old application-to-primary connections are not released immediately (network communication broken, cannot send packets). Application or driver must configure link timeout disconnection so old connections release promptly and new connections establish via new primary. Otherwise requests fail on stale connections.

ETCD, CM Server, CM Agent anomalies: No business impact ; only affects monitoring and switchover functions. ETCD primary and CM Server primary anomalies trigger their own primary/standby switch.

GaussDB supports manual AZ-level switchover ; TPS drops to 0 for ~10s .

Backup impact: Primary backup reduces TPS ~40% , so backup must run on standby . Standby backup has no impact on primary or standby business.

Summary table
Summary table

However, testing revealed ETCD primary and CM Server primary do not support manual AZ switchover, and ETCD nodes do not support manual start/stop — functional details needing improvement.

References:

GaussDB Database Product Documentation

GaussDB Database High Availability Deployment Solution (http://mp.weixin.qq.com/s?__biz=MzI3MzUzMjIxNA==&mid=2247485797&idx=1&sn=38e1b4c80e0cc1f88dc8c917c017f216&chksm=eb209d3cdc57142a73207c0171acb0b0156e5cb50c2b3cb6f4118d725362e90db13c5903b40e&scene=21#wechat_redirect)

About this article

For questions about attribution, corrections or content rights, please contactadmin@besthub.devand we will review it promptly.

high availabilityGaussDBdatabase reliability3AZ deploymentbackup impactfailover testingnetwork degradationzombie detection

Discussion 0

Questions, practical examples and thoughtful responses.

Open full discussion