VastbaseG100

基于openGauss内核开发的企业级关系型数据库。

Menu

状态查询

背景信息

Vastbase支持通过查询结果确认Vastbase单机或者集群的运行状态是否正常。

前提条件

Vastbase已经启动。

操作步骤

单机

1、以操作系统用户vastbase登录数据库主节点。

2、使用如下命令查询Vastbase状态:

vb_ctl status [-D datadir]

集群

切换至dcs安装路径验证dcs服务,在任意节点执行如下任意语句:

cd /vastbase/dcs
./dcsctl member list
./dcsctl cluster-health

切换至has安装路径验证has服务,在任意节点执行:

cd /vastbase/has
./hasctl -c vastbase.yml list

参数说明

-D, --pgdata=DATADIR

指定数据目录的位置。DATADIR的取值必须为有效的数据目录。

示例

  • 单机状态下,使用vb_ctl命令查询单机数据库的状态。

    vb_ctl status
    

    回显为:

    vb_ctl status,datadir is /home/vastbase/data/vastbase
    vb_ctl: server is running (PID: 23466)
    /home/vastbase/local/vastbase/bin/vastbase
    
  • 集群环境下,进行数据库状态查询。

    • 验证DCS

      方法1:

      cd /vastbase/dcs
      ./dcsctl member list
      

      回显为:

      731d64afbb3e4bbe: name=dcs2 peerURLs=http://192.168.31.62:2380 clientURLs=http://192.168.31.62:2379 isLeader=true
              
      87b732e2ee432741: name=dcs3 peerURLs=http://192.168.31.63:2380 clientURLs=http://192.168.31.63:2379 isLeader=false
              
      d12240768e542c8f: name=dcs1 peerURLs=http://192.168.31.61:2380 clientURLs=http://192.168.31.61:2379 isLeader=false
      

      方法2:

      cd /vastbase/dcs
      ./dcsctl cluster-health
      

      回显为:

      member 731d64afbb3e4bbe is healthy: got healthy result from http://192.168.31.62:2379
              
      member 87b732e2ee432741 is healthy: got healthy result from http://192.168.31.63:2379
              
      member d12240768e542c8f is healthy: got healthy result from http://192.168.31.61:2379
              
      cluster is healthy
      
    • 验证HAS

      cd /vastbase/has
      ./hasctl -c vastbase.yml list
      

      回显为:

      =========================>>> Group:vastbase_ha_inst, Xlog Location:28035E08 <<<=========================
      +-----------+---------------+--------------+---------+----+-----------+------------------------------+
      |   Member  |      Host     |     Role     |  State  | TL | Lag in MB |           Message            |
      +-----------+---------------+--------------+---------+----+-----------+------------------------------+
      | vastbase1 | 192.168.31.61 |    Leader    | running |  1 |         0 | promote[2022-06-28 17:40:05] |
      | vastbase2 | 192.168.31.62 |              | running |  1 |         0 |  start[2022-06-28 17:40:21]  |
      | vastbase3 | 192.168.31.63 | Sync standby | running |  1 |         0 |  start[2022-06-28 17:40:16]  |
      +-----------+---------------+--------------+---------+----+-----------+------------------------------+