GaussDB (DWS) 集群管理系列:CM启停功能的原理、流程和关键日志

网友投稿 1099 2022-05-28

CM启停集群功能介绍

一 CM_CTL模块

cm_ctl是GaussDB(DWS)提供的用来控制集群服务的工具。启动集群和停止集群是cm_ctl的重要功能,其功能的实现主要通过启停文件实现:

集群启停文件 cluster_manual_start

实例启停文件 instance_manual_start_X(X是实例编号,例如instance_manual_start_6001)

当启动集群、节点、实例时,会删除启停文件,当停止集群、节点、实例时,会生成启停文件。通过cm_ctl生成的启停文件中有三行信息,每行为一个数字,第一个字段保留,第二、三个字段分别记录了停止模式和停止等级。启停文件位于$GAUSSHOME/bin下。其中,GAUSSHOME为环境变量。

行数

字段

取值范围

说明

1

保留字段

0

-

2

停止模式

0:smart

发送SIGTERM信号

1: fast

发送SIGINT信号

2: immediate

发送SIGKILL信号

GaussDB (DWS) 集群管理系列:CM启停功能的原理、流程和关键日志

3

停止等级

0

单实例停止,对应实例级启停文件

1

单节点停止,对应集群级启停文件

2

集群级停止,对应集群级启停文件

cm_agent组件不区分停止单节点和停止集群,因此启停文件均为集群级;

停止等级仅用于内部识别,不影响实际的停止流程;

停止cm_server进程与具体停止模式无关,均发送SIGKILL信号;

如果启停文件内容为空,则根据名称判断启停文件级别,并执行默认的停止流程,默认的停止模式为smart;

目前不支持通过cm_ctl停止单个cm_server进程,可通过手动生成实例级启停文件的方式控制;

以smart方式停止节点或集群时,DN环的停止顺序为先停止备DN,再停止主DN;

cm_ctl启停命令:

启动集群

cm_ctl start

启动节点

cm_ctl start –n nodeid

启动实例

cm_ctl start –n nodeid –D datapath

停止集群

cm_ctl stop

停止节点

cm_ctl stop –n nodeid

停止实例

cm_ctl stop –n nodeid –D datapath

以下图中实例6001为例,其启动命令为cm_ctl start –n 1 –D /home/mpp/data/dnP1

具体的启动停止操作将交由cm_agent执行。

二、CM_AGENT模块

cm_agent是GaussDB(DWS)提供的部署在集群各主机上用来启停和监控各数据库实例进程的集群管理组件,拉起和停止本主机上部署的实例进程是cm_agent的一个重要功能。该功能由常驻的启停线程来完成,根据检测到的启动、停止条件去相应地启动、停止集群,下面对cm_agent的启停流程进行介绍:

1. CM Agent启停流程

cm_agent的停止实例进程流程如图1所示:

图1

cm_agent启动实例进程的流程如图2所示:

图2

CM Agent整体的启停流程大致如图1和图2所示,对于不同类型的实例,其启停流程上会有一些差别,下面对不同实例启停的差别进行描述:

(1)CM Server: 只有在检查到启停文件存在时才会杀死cm_server进程,而在磁盘、网卡有故障时并不会杀死cm_server进程。

(2)CN:对于已经被剔除的CN,不会再对其启动。

(3)DN:拉起DN时进行build进程的检查

a. build进程pid>0并且running(正在进行build)

b. build进程pid>0并且not running(即build失败),重新进行build

c. build进程pid<0,重新进行build

d.build进程pid=0, 且DN进程不存在,(build已经完成)拉起DN

2. 关键日志举例

日志类型

关键字段

举例

启动日志

GTM磁盘或网卡故障

disk damged/ nic down

stop the gtm instance 1001 due to disk damged or nic down

GTM进程不存在但满足启动条件

GTM START system

gtm(/home/mpp/data/gtm) is not running,now start, try 0 ! !GTM START system(command:…)

CN磁盘故障、网卡故障或CN被剔除

disk fault/ nic fault/ dropped

kill CN because disk fault or nic fault or be dropped

CN无法重启

Do not start cn

Do not start cn because cn on current node has been manually stopped.

CN进程不存在但满足启动条件

CN START system

coordinate(/home/mpp/data/cn) is not running, now start, try 0 times!

CN START system(command:…)

DN启停文件存在

manually stopped

Datanode 6001 is manually stopped. Do not perform start check.

cm_server因端口或磁盘原因无法重启

would not be started

CM Server 1 would not be started due to port conflict.

cm_server启停文件存在无法重启

Do not start cm server

Do not start cm server because cm server on current instance has been manually stopped.

拉起cm_server

CM_SERVER START system

CM_SERVER START system(command:…).

停止日志

检测到集群启停文件

cluster manual start file

Found the cluster manual start file, set the shutdown flag.

所有实例正常停止

all the instances

all the instances have stopped!

仍存在实例进程

Stopping check

all the instances

EI企业智能 Gauss AP 数据仓库服务 GaussDB(DWS)

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:微云实施时网络配置
下一篇:技术综述十三:弯曲文本检测算法(一)
相关文章