lightdb22.2 版本新增了集群启停脚本,脚本名为lightdb_service.py。使用python2.7开发。使用该脚本会对涉及的lightdb,ltcluster,keepalive 进行相应操作。
由于需要依赖installer安装后生成的json文件来获取集群信息,目前此脚本只能用于通过installer安装的数据库集群,且需要使用root用户执行(因为涉及keepalive的启停,需要root权限)。
用法usage: lightdb_service.py [-h] [-F OP_INSTALL_INFO]
[-c {start,stop,restart,status}] [-C] [-D] [-P] [-S]
[--dry-run] [-f] [-B ] [-v] [-q]
[-l ]
optional arguments:
-h, --help show this help message and exit
-F OP_INSTALL_INFO, --filename OP_INSTALL_INFO
specifies the path to a json file containing
installation information
-c {start,stop,restart,status}, --command {start,stop,restart,status}
start/stop/restart/status lightdb service
-C, --cn_only only start/stop coordinator node
-D, --dn_only only start/stop data node
-P, --primary_only only start/stop primary node for primary restart
-S, --standby_only only start/stop standby node for standby restart
--dry-run show what would happen for action, but don't execute
it
-f, --force force stop of cluster even if some nodes are in
incorrect state, skip incorrect nodes
-B , --parallel
number of segment hosts to run in parallel. Default is
1
-v, --verbose debug print
-q, --quiet suppress status messages for stdout logging
-l , --log_dir
Logfile directory, default is /tmp/ltAdminLogs
启动/停止/重启当前集群
lightdb_service.py -c start/stop/restart启动/停止/重启所有CN节点
lightdb_service.py -c start/stop/restart --cn_only启动/停止/重启所有DN节点
lightdb_service.py -c start/stop/restart --dn_only启动/停止/重启所有主节点
lightdb_service.py -c start/stop/restart --primary_only启动/停止/重启所有备节点
lightdb_service.py -c start/stop/restart --standby_only在启动/停止/重启对DN节点进行并发处理
lightdb_service.py -c start/stop/restart --parallel 4



