DEV Community

Michael
Michael

Posted on • Originally published at gbase.cn

GBase 8c High Availability with VIP: A Step-by-Step Verification Guide

This walkthrough demonstrates how to deploy a GBase 8c primary‑standby cluster with a virtual IP (VIP) and verify automatic failover. GBase 8c is a China‑domestically developed database from GBASE, designed for transactional workloads.

Environment

IP Hostname Role
10.x.x.31 gbase8c_7_31 Primary
10.x.x.35 gbase8c_7_35 Standby
10.x.x.34 - VIP

Package: GBase8cV5_S5.0.0B28_centos7.8_x86_64.tar.gz

Pre‑Installation (Both Nodes)

  1. Update /etc/hosts with hostname entries.
  2. Disable firewall and SELinux.
  3. Install dependencies: expect, bzip2.
  4. Create user gbase with sudo privileges.
  5. Set up passwordless SSH for both root and gbase between nodes.

Silent Installation

  1. On the primary node, create /data/install_package, upload and extract the tarballs.
  2. Prepare an XML cluster configuration file defining node names, IPs, directories, and CM server settings.
  3. Run gs_preinstall as root with the XML file.
  4. Change ownership to gbase, then run gs_install to complete deployment.
  5. Confirm the cluster is Normal with gs_om -t status --detail. You should see one Primary and one Standby datanode.

Configuring the Virtual IP

  1. Add a VIP resource named CM_VIP with the floating address:
   cm_ctl res --add --res_name="CM_VIP" --res_attr="resources_type=VIP,float_ip=10.x.x.34"
Enter fullscreen mode Exit fullscreen mode
  1. Bind each node to an instance of the VIP:
   cm_ctl res --edit --res_name="CM_VIP" --add_inst="res_instance_id=6001,node_id=1" --inst_attr="base_ip=10.x.x.31"
   cm_ctl res --edit --res_name="CM_VIP" --add_inst="res_instance_id=6002,node_id=2" --inst_attr="base_ip=10.x.x.35"
Enter fullscreen mode Exit fullscreen mode
  1. Set CM parameters for failover (adjust the gateway to your environment):
   cm_ctl set --param --server -k "cms_enable_failover_on2nodes=1"
   cm_ctl set --param --server -k "cms_network_isolation_timeout=10"
   cm_ctl set --param --server -k "cms_enable_db_crash_recovery=1"
   cm_ctl set --param --server -k "third_party_gateway_ip=10.x.x.1"
Enter fullscreen mode Exit fullscreen mode
  1. Restart the database. Afterwards cm_ctl show and ip a should display the VIP on the primary.

High Availability Validation

Planned Switchover

Run cm_ctl switchover -n 2 -D /data/gbasedb/database/data/dn on the primary. The standby becomes the new primary, and the VIP floats accordingly. Switch back with -n 1.

Automatic Failover

Reboot the current primary node. The standby automatically promotes to Primary; the VIP drifts to the new primary, and the cluster returns to a healthy state.

This process confirms that your GBase 8c high‑availability setup works correctly. The VIP ensures client connections automatically redirect to the current primary, keeping your gbase database available during both planned and unplanned outages.

Top comments (0)