lightdb_service.py - lightdb一键启停脚本

lightdb_service.py-lightdb一键启停脚本

在这里对最新版的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状态
  • 出错后需人工介入
  • 脚本使用ssh, 需要配置ssh免密(对本机也需配置免密)
  • 对高可用集群默认会操作keepalived, 需要配置sudo 免密,若不需要操作keepalived, 使用上述–ignore-keepalived 选项

错误码

Error CodeReason
100Start lightdb failed(please refer to lightdb log for details), not primary
101Stop lightdb failed(please refer to lightdb log for details), not primary
102Start primary lightdb failed(please refer to lightdb log for details)
103Stop primary lightdb failed(please refer to lightdb log for details)
104The node to operate is not in current lightdb service. used with ‘-n’
105Get lightdb role failed. 获取lightdb 主备状态失败
106Cannot get lightdb process status, execute command that will check lightdb port failed. Usually, ssh encryption is not configured. 执行检测lightdb端口的命令失败
107LightDB process is running, but can’t connect to execute sql.
108LightDB is stopped, but it should be running.
109LightDB is running, but it should be stopped.
110Cannot get ltcluster process status, because execute get command failed. Usually, ssh encryption is not configured or lightdb is stopped
111ltclusterd is stopped, but it should be running.
112ltclusterd is running, but it should be stopped.
113All ltclusterd in cluster are unpaused. but should be paused
114All ltclusterd in cluster are paused. but should be unpaused
115All ltclusterd pause status in cluster are unknown.
116ltclusterd pause status in cluster are inconsistent.
117ltclusterd start failed. please refer to log for details.
118ltclusterd stop failed. please refer to log for details.
119Pause ltclusterd in cluster.
120Unpause ltclusterd in cluster failed.
121Cannot get keepalived process status, because execute get command failed.
122keepalived is stopped, but should be running.
123keepalived is running, but should be stopped.
124keepalived start failed.
125keepalived stop failed.
126Use for execute command failed in Common scene, now only used for get standby.signal file num error.
127standby.signal file’s num is wrong when judge lightdb role.
128Cannot get high available status, because execute command failed.
129High available status is not right(right meaning all is running correctly).
130install file about lightdb service’s formart is error.
131install file about lightdb service’s content is error.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

紫无之紫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值