lightdb_service.py — start/stop/restart a LightDB service
lightdb_service.py
--command
| -c
start,stop,restart,status
[
--filename
| -F
install_info
] [ --cn_only
| -C
] [ --dn_only
| -D
] [ --primary_only
| -P
] [ --standby_only
| -S
] [
--node
| -n
node_info
] --dry-run
[ --force
| -f
] [ --verbose
| -v
] [ --quiet
| -q
] [
--parallel
| -B
parallel_processes
] [
--log_dir
| -l
directory
] [ --ignore-keepalived
| -i
] [ --help
| -h
]
lightdb_service.py is a utility for start/stop a LightDB service. It can full start or stop all component in a LightDB service installed by installer. It also has a simple status detection feature and can use some special mode to start or stop service.
The LightDB service must be installed by installer to use this application.
lightdb_service.py must be executed under python3.
lightdb_service.py accepts the following command-line 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 a path to a json file containing installation information(default use 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.
-D
--quiet
Do not display progress messages.
-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, 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.
--ignore-keepalived
ignore keepalived, normally use for lightdb service without keepalived.
In case of difficulty, see log file for detail error messge.
Following are error codes and normal reasons
Table 307. Error Code Table
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. |
106 |
Cannot get lightdb process status, execute command that will check lightdb port failed. Usually, ssh encryption is not configured. |
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. |
To start all test
:
$
lightdb_service.py -c start
To stop all:
$
lightdb_service.py -c stop
To restart all:
$
lightdb_service.py -c restart
To check status:
$
lightdb_service.py -c status
To start/stop/restart primary only(The active and standby states remain unchanged):
$
lightdb_service.py -c start/stop/restart --primary_only
To start/stop/restart standby only(The active and standby states remain unchanged):
$
lightdb_service.py -c start/stop/restart --standby_only
To start/stop/restart cn node only:
$
lightdb_service.py -c start/stop/restart --cn_only
To start/stop/restart dn node only:
$
lightdb_service.py -c start/stop/restart --dn_only
To start/stop/restart primary in dn node only:
$
lightdb_service.py -c start/stop/restart --dn_only --primary_only
To start/stop/restart specify node only(The active and standby states remain unchanged):
$
lightdb_service.py -c start/stop/restart -n 10.20.148.122:54333
To force stop:
$
lightdb_service.py -c stop -f
To dry run start command:
$
lightdb_service.py -c start --dry-run