一、集群环境使用 gs_om 工具进行启停
主节点实例状态
[omm@node1 mogdb]$ ps -ef|grep mog|grep -v grep
omm 109049 1 4 10:25 pts/1 00:00:22 /data/mogdb/app/bin/mogdb -D /data/mogdb/data/db1 -M primary
备节点实例状态
[omm@node2 ~]$ ps -ef|grep mog|grep -v grep
omm 14266 1 12 10:25 ? 00:01:12 /data/mogdb/app/bin/mogdb -D /data/mogdb/data/db1 -M standby
1、启动实例
[omm@node1 mogdb]$ gs_om -t start
Starting cluster.
=========================================
[SUCCESS] node1
2021-12-09 10:24:12.408 [unknown] [unknown] localhost 140284866000640 0 0 [BACKEND] WARNING: Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (16 Mbytes) or shared memory (4700 Mbytes) is larger.
[SUCCESS] node2
2021-12-09 10:24:19.875 [unknown] [unknown] localhost 140537012578048 0 0 [BACKEND] WARNING: Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (16 Mbytes) or shared memory (4700 Mbytes) is larger.
=========================================
Successfully started.
2、关闭实例
[omm@node1 mogdb]$ gs_om -t stop
Stopping cluster.
=========================================
Successfully stopped cluster.
=========================================
End stop cluster.
3、重启实例
[omm@node1 mogdb]$ gs_om -t restart
Stopping cluster.
=========================================
Successfully stopped cluster.
=========================================
End stop cluster.
Starting cluster.
=========================================
[SUCCESS] node1
2021-12-09 10:25:38.659 [unknown] [unknown] localhost 140624450180864 0 0 [BACKEND] WARNING: Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (16 Mbytes) or shared memory (4700 Mbytes) is larger.
[SUCCESS] node2
2021-12-09 10:25:42.711 [unknown] [unknown] localhost 140716486657792 0 0 [BACKEND] WARNING: Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (16 Mbytes) or shared memory (4700 Mbytes) is larger.
=========================================
Successfully started.
4、查看实例状态
[omm@node1 mogdb]$ gs_om -t status
-----------------------------------------------------------------------
cluster_name : dbCluster
cluster_state : Normal
redistributing : No
-----------------------------------------------------------------------
[omm@node1 mogdb]$ 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
----------------------------------------------------------------------------------------------------------------------------------------------------
1 node1 192.168.10.52 6001 /data/mogdb/data/db1 P Primary Normal | 2 node2 192.168.10.53 6002 /data/mogdb/data/db1 S Standby Normal
5、如果是超时导致启动失败,可以执行如下命令,设置启动超时时间,默认超时时间为300s。
[omm@node1 mogdb]$ gs_om -t start --time-out=300
说明: 双机启动必须以双机模式启动, 若中间过程以单机模式启动, 则必须修复才能恢复双机关系, 用gs_ctl build进行修复,gs_ctl的使用方法参见“参考指南 > 工具参考 > 系统内部使用的工具 > gs_ctl”章节
二、单机环境用 gs_ctl 工具进行启停
gs_ctl start|stop|restart -D $GAUSSHOME/data/single_node




