openGauss启动、停止、查看状态、切换主备

匣子里的大橘 秀才 2021-08-19 10:53:38

转载自:https://www.modb.pro/db/86035

  • 查看各节点状态
    Last login: Mon Jul 19 17:27:53 CST 2021 on pts/0
    [omm@node1 ~]$ 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            | node     node_ip         instance                            state
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    1  node1 192.168.59.26   6001 opt/huawei/install/data/d1 P Primary Normal | 2  node2 192.168.59.27   6002 opt/huawei/install/data/d2 S Standby Normal | 3  node3 192.168.59.28   6003 opt/huawei/install/data/d3 C Cascade Normal
    [omm@node1 ~]$ gs_om -t status -h node2
    -----------------------------------------------------------------------
    
    
    cluster_state             : Normal
    redistributing            : No
    
    
    -----------------------------------------------------------------------
    
    
    node                      : 2
    node_name                 : node2
    instance_id               : 6002
    node_ip                   : 192.168.59.27
    data_path                 : /opt/huawei/install/data/d2
    type                      : Datanode
    instance_state            : Normal
    az_name                   : AZ1
    instance_role             : Standby
    HA_state                  : Streaming
    sender_sent_location      : 0/6845098
    sender_write_location     : 0/6845098
    sender_flush_location     : 0/6845098
    sender_replay_location    : 0/6845098
    receiver_received_location: 0/6845098
    receiver_write_location   : 0/6845098
    receiver_flush_location   : 0/6845098
    receiver_replay_location  : 0/6845098
    sync_percent              : 100%
    sync_state                : Async
    
    
    -----------------------------------------------------------------------
    
    
    [omm@node1 ~]$ 
    [omm@node1 ~]$ 
    [omm@node1 ~]$ 
    [omm@node1 ~]$ gs_om -t status -h node3
    -----------------------------------------------------------------------
    
    
    cluster_state             : Normal
    redistributing            : No
    
    
    -----------------------------------------------------------------------
    
    
    node                      : 3
    node_name                 : node3
    instance_id               : 6003
    node_ip                   : 192.168.59.28
    data_path                 : /opt/huawei/install/data/d3
    type                      : Datanode
    instance_state            : Normal
    az_name                   : AZ1
    instance_role             : Cascade Standby
    HA_state                  : Normal
    sender_sent_location      : 0/68451B0
    sender_write_location     : 0/68451B0
    sender_flush_location     : 0/68451B0
    sender_replay_location    : 0/68451B0
    receiver_received_location: 0/68451B0
    receiver_write_location   : 0/68451B0
    receiver_flush_location   : 0/68451B0
    receiver_replay_location  : 0/68451B0
    sync_percent              : 100%
    sync_state                : Async
    upstream_nodeIp           : 192.168.59.27:15401
    
    
    -----------------------------------------------------------------------
    
    
    [omm@node1 ~]$ gs_om -t status -h node1
    -----------------------------------------------------------------------
    
    
    cluster_state             : Normal
    redistributing            : No
    
    
    -----------------------------------------------------------------------
    
    
    node                      : 1
    node_name                 : node1
    instance_id               : 6001
    node_ip                   : 192.168.59.26
    data_path                 : /opt/huawei/install/data/d1
    type                      : Datanode
    instance_state            : Normal
    az_name                   : AZ1
    static_connections        : 2
    HA_state                  : Normal
    instance_role             : Primary
    
    
    -----------------------------------------------------------------------
  • 关闭、启动、重启openGauss群集
    [omm@node1 ~]$ gs_om -t stop
    Stopping cluster.
    =========================================
    Successfully stopped cluster.
    =========================================
    End stop cluster.
    [omm@node1 ~]$ gs_om -t status
    -----------------------------------------------------------------------
    
    
    cluster_name    : Cluster_openGauss
    cluster_state   : Unavailable
    redistributing  : No
    
    
    -----------------------------------------------------------------------
    [omm@node1 ~]$ gs_om -t status --detail
    [   Cluster State   ]
    
    
    cluster_state   : Unavailable
    redistributing  : No
    current_az      : AZ_ALL
    
    
    [  Datanode State   ]
    
    
    node     node_ip         instance                            state            | node     node_ip         instance                            state            | node     node_ip         instance                            state
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    1  node1 192.168.59.26   6001 opt/huawei/install/data/d1 P Down    Manually stopped | 2  node2 192.168.59.27   6002 opt/huawei/install/data/d2 S Down    Manually stopped | 3  node3 192.168.59.28   6003 opt/huawei/install/data/d3 C Down    Manually stopped
    [omm@node1 ~]$ gs_om -t start
    Starting cluster.
    =========================================
    [SUCCESS] node1
    2021-07-20 17:53:25.332 60f69d15.1 [unknown] 139907310331648 [unknown] 0 dn_6001_6002 01000  0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (16 Mbytes) or shared memory (1496 Mbytes) is larger.
    [SUCCESS] node2
    2021-07-20 17:53:28.046 60f69d17.1 [unknown] 140135379003136 [unknown] 0 dn_6001_6002 01000  0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (16 Mbytes) or shared memory (1496 Mbytes) is larger.
    [SUCCESS] node3
    2021-07-20 17:53:30.896 60f69d1a.1 [unknown] 139820708103936 [unknown] 0 dn_6001_6002 01000  0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (16 Mbytes) or shared memory (1496 Mbytes) is larger.
    =========================================
    Successfully started.
    [omm@node1 ~]$ gs_om -t status
    -----------------------------------------------------------------------
    
    
    cluster_name    : Cluster_openGauss
    cluster_state   : Normal
    redistributing  : No
    -----------------------------------------------------------------------
    [omm@node1 ~]$ 
    [omm@node1 ~]$ gs_om -t stop & gs_om -t start
    [1] 7772
    Stopping cluster.
    =========================================
    Starting cluster.
    =========================================
    [SUCCESS] node1
    2021-07-20 17:54:48.867 60f69d68.1 [unknown] 139885120349952 [unknown] 0 dn_6001_6002 01000  0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (16 Mbytes) or shared memory (1496 Mbytes) is larger.
    Successfully stopped cluster.
    =========================================
    End stop cluster.
    [SUCCESS] node2
    2021-07-20 17:54:51.576 60f69d6b.1 [unknown] 140327226377984 [unknown] 0 dn_6001_6002 01000  0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (16 Mbytes) or shared memory (1496 Mbytes) is larger.
    [SUCCESS] node3
    2021-07-20 17:54:53.604 60f69d6d.1 [unknown] 140109769361152 [unknown] 0 dn_6001_6002 01000  0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (16 Mbytes) or shared memory (1496 Mbytes) is larger.
    =========================================
    Successfully started.
    [1]+  Done                    gs_om -t stop
    [omm@node1 ~]$ 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            | node     node_ip         instance                            state
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    1  node1 192.168.59.26   6001 opt/huawei/install/data/d1 P Standby Normal | 2  node2 192.168.59.27   6002 opt/huawei/install/data/d2 S Primary Normal | 3  node3 192.168.59.28   6003 opt/huawei/install/data/d3 C Cascade Normal
  • 切换主备

        登录备机,在omm用户下操作。

[omm@node1 ~]$ gs_ctl switchover -D /opt/huawei/install/data/d1/
[2021-07-20 17:59:51.465][9769][][gs_ctl]: gs_ctl switchover ,datadir is opt/huawei/install/data/d1 
[2021-07-20 17:59:51.465][9769][][gs_ctl]: switchover term (1)
[2021-07-20 17:59:51.474][9769][][gs_ctl]: waiting for server to switchover.........
[2021-07-20 17:59:57.527][9769][][gs_ctl]: done
[2021-07-20 17:59:57.527][9769][][gs_ctl]: switchover completed (/opt/huawei/install/data/d1)
[omm@node1 ~]$ 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            | node     node_ip         instance                            state
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1  node1 192.168.59.26   6001 opt/huawei/install/data/d1 P Primary Normal | 2  node2 192.168.59.27   6002 opt/huawei/install/data/d2 S Standby Normal | 3  node3 192.168.59.28   6003 opt/huawei/install/data/d3 C Cascade Normal
[omm@node1 ~]$ gs_om -t status -h node1
-----------------------------------------------------------------------


cluster_state             : Normal
redistributing            : No


-----------------------------------------------------------------------


node                      : 1
node_name                 : node1
instance_id               : 6001
node_ip                   : 192.168.59.26
data_path                 : /opt/huawei/install/data/d1
type                      : Datanode
instance_state            : Normal
az_name                   : AZ1
static_connections        : 2
HA_state                  : Normal
instance_role             : Primary


-----------------------------------------------------------------------


[omm@node1 ~]$ gs_om -t status -h node2
-----------------------------------------------------------------------


cluster_state             : Normal
redistributing            : No


-----------------------------------------------------------------------


node                      : 2
node_name                 : node2
instance_id               : 6002
node_ip                   : 192.168.59.27
data_path                 : /opt/huawei/install/data/d2
type                      : Datanode
instance_state            : Normal
az_name                   : AZ1
instance_role             : Standby
HA_state                  : Streaming
sender_sent_location      : 0/68475E0
sender_write_location     : 0/68475E0
sender_flush_location     : 0/68475E0
sender_replay_location    : 0/68475E0
receiver_received_location: 0/68475E0
receiver_write_location   : 0/68475E0
receiver_flush_location   : 0/68475E0
receiver_replay_location  : 0/68475E0
sync_percent              : 100%
sync_state                : Async


-----------------------------------------------------------------------


[omm@node1 ~]$ gs_om -t status -h node3
-----------------------------------------------------------------------


cluster_state             : Normal
redistributing            : No


-----------------------------------------------------------------------


node                      : 3
node_name                 : node3
instance_id               : 6003
node_ip                   : 192.168.59.28
data_path                 : /opt/huawei/install/data/d3
type                      : Datanode
instance_state            : Normal
az_name                   : AZ1
instance_role             : Cascade Standby
HA_state                  : Normal
sender_sent_location      : 0/68475E0
sender_write_location     : 0/68475E0
sender_flush_location     : 0/68475E0
sender_replay_location    : 0/68475E0
receiver_received_location: 0/68475E0
receiver_write_location   : 0/68475E0
receiver_flush_location   : 0/68475E0
receiver_replay_location  : 0/68475E0
sync_percent              : 100%
sync_state                : Async
upstream_nodeIp           : 192.168.59.27:15401


-----------------------------------------------------------------------

 

...全文
3544 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_45727884 2023-07-30
  • 打赏
  • 举报
回复

写的很好,但是没什么用。

孤远无梦 2021-08-26
  • 打赏
  • 举报
回复

openGause万岁!

Gauss松鼠会 探花 2021-08-19
  • 打赏
  • 举报
回复

好文,顶

79,358

社区成员

发帖
与我相关
我的任务
社区描述
汇集数据库的爱好者和关注者,大家共同学习、探索、分享数据库前沿知识和技术,像松鼠一样剥开科学的坚果;交流Gauss及其他数据库的使用心得和经验,互助解决问题,共建数据库技术交流圈。
数据库数据仓库 企业社区 北京·海淀区
社区管理员
  • Gauss松鼠会
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

欢迎大家同时关注Gauss松鼠会专家酷哥。

https://www.zhihu.com/people/ku-ge-78-98

试试用AI创作助手写篇文章吧