lightdb_service.py - lightdb一键启停脚本
Posted 紫无之紫
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了lightdb_service.py - lightdb一键启停脚本相关的知识,希望对你有一定的参考价值。
lightdb_service.py-lightdb一键启停脚本
在这里对l最新版的lightdb_service.py的功能及使用进行介绍
一. 概述
lightdb_service.py 用于对lightdb 服务进行简易的一键启停操作,包括高可用模式,分布式模式和单机模式。
lightdb_service.py 基于python3开发。
二. 用法
usage: lightdb_service.py -c start,stop,restart,status [-C | -D] [-P | -S] [-n <node_info>]
[-F <install_info>] [-B <parallel_processes>] [-v] [-q] [-l <directory>]
[-i] [--dry-run] [-f] [-h]
Example:
start: lightdb_service.py -c start
stop: lightdb_service.py -c stop
restart: lightdb_service.py -c restart
primary only: lightdb_service.py -c start/stop/restart -P
standby only: lightdb_service.py -c start/stop/restart -S
cn only: lightdb_service.py -c start/stop/restart -C
dn only: lightdb_service.py -c start/stop/restart -D
dn and primary only: lightdb_service.py -c start/stop/restart -D -P
specify node: lightdb_service.py -c start/stop/restart -n ip:port
Use for start/stop/restart LightDB service
optional arguments:
-h, --help show this help message and exit
-c start,stop,restart,status, --command start,stop,restart,status
start/stop/restart/status lightdb service
-F <install_info>, --filename <install_info>
specifies the path to a json file containing
installation information(uninstall/uninstallFile.json)
-C, --cn_only only start/stop/restart coordinator node
-D, --dn_only only start/stop/restart data node
-P, --primary_only only start/stop/restart primary node for primary
restart
-S, --standby_only only start/stop/restart standby node for standby
restart
-n <node_info>, --node <node_info>
only start/stop/restart specified node, node_info
formart: ip:port
--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_processes>, --parallel <parallel_processes>
number of segment hosts to run in parallel. Default is
1
-v, --verbose debug print
-q, --quiet suppress status messages for stdout logging
-l <directory>, --log_dir <directory>
Logfile directory, default is /tmp/ltAdminLogs
-i, --ignore-keepalived
ignore keepalived, normally use for lightdb service
without keepalived
1. 启动/停止/重启当前集群
lightdb_service.py -c start/stop/restart
2. 启动/停止/重启所有CN节点
lightdb_service.py -c start/stop/restart --cn_only
3. 启动/停止/重启所有DN节点
lightdb_service.py -c start/stop/restart --dn_only
4. 启动/停止/重启所有主节点
lightdb_service.py -c start/stop/restart --primary_only
5. 启动/停止/重启所有备节点
lightdb_service.py -c start/stop/restart --standby_only
6. 启动/停止/重启所有DN的主节点, 类似的可以自由组合主备选项和分布式cn,dn 选项
lightdb_service.py -c start/stop/restart --cn_only --primary_only
7. 在启停分布式集群时,可以通过指定--parallel
对DN节点进行并发启停
lightdb_service.py -c start/stop/restart --parallel 4
8. 忽略keepalived
lightdb_service.py -c start/stop/restart --ignore-keepalived
9. 指定节点启停
lightdb_service.py -c start/stop/restart -n 10.20.148.122:54333
三. 异常及主要事项
- 指定主备停止,需要所有节点都是running状态
- 出错后需人工介入
错误码
Error Code | Reason |
---|---|
100 | Start lightdb failed(please refer to lightdb log for details), not primary |
101 | Stop lightdb failed(please refer to lightdb log for details), not primary |
102 | Start primary lightdb failed(please refer to lightdb log for details) |
103 | Stop primary lightdb failed(please refer to lightdb log for details) |
104 | The node to operate is not in current lightdb service. used with ‘-n’ |
105 | Get lightdb role failed. 获取lightdb 主备状态失败 |
106 | Cannot get lightdb process status, execute command that will check lightdb port failed. Usually, ssh encryption is not configured. 执行检测lightdb端口的命令失败 |
107 | LightDB process is running, but can’t connect to execute sql. |
108 | LightDB is stopped, but it should be running. |
109 | LightDB is running, but it should be stopped. |
110 | Cannot get ltcluster process status, because execute get command failed. Usually, ssh encryption is not configured or lightdb is stopped |
111 | ltclusterd is stopped, but it should be running. |
112 | ltclusterd is running, but it should be stopped. |
113 | All ltclusterd in cluster are unpaused. but should be paused |
114 | All ltclusterd in cluster are paused. but should be unpaused |
115 | All ltclusterd pause status in cluster are unknown. |
116 | ltclusterd pause status in cluster are inconsistent. |
117 | ltclusterd start failed. please refer to log for details. |
118 | ltclusterd stop failed. please refer to log for details. |
119 | Pause ltclusterd in cluster. |
120 | Unpause ltclusterd in cluster failed. |
121 | Cannot get keepalived process status, because execute get command failed. |
122 | keepalived is stopped, but should be running. |
123 | keepalived is running, but should be stopped. |
124 | keepalived start failed. |
125 | keepalived stop failed. |
126 | Use for execute command failed in Common scene, now only used for get standby.signal file num error. |
127 | standby.signal file’s num is wrong when judge lightdb role. |
128 | Cannot get high available status, because execute command failed. |
129 | High available status is not right(right meaning all is running correctly). |
130 | install file about lightdb service’s formart is error. |
131 | install file about lightdb service’s content is error. |
以上是关于lightdb_service.py - lightdb一键启停脚本的主要内容,如果未能解决你的问题,请参考以下文章