Basic Maintenance Commands
Paths for Common Maintenance Scripts
Script Path
$(ha_install_path)/ha/module/hacom/script
Script Command
cd $(ha_install_path)/ha/module/hacom/script
The following information is displayed after the command is executed:
/ha/module/hacom/script # ls -rlt total 236 -r-x------ 1 root root 85553 Sep 4 01:06 config_ha_unprotected.sh -r-x------ 1 root root 11749 Sep 4 01:06 upgrade.sh -r-x------ 1 root root 966 Sep 4 01:06 update_workkey_ha.sh -r-x------ 1 root root 1021 Sep 4 01:06 update_server_key_pass.sh -r-x------ 1 root root 282 Sep 4 01:06 stop_ha_process.sh -r-x------ 1 root root 742 Sep 4 01:06 status_ha.sh -rwx------ 1 root root 1304 Sep 4 01:06 parse_haconfig.py -r-x------ 1 root root 6380 Sep 4 01:06 config_ha.sh -r-x------ 1 root root 3217 Sep 4 01:06 common.sh -r-x------ 1 root root 1736 Sep 4 01:06 vaild_cert.sh -r-x------ 1 root root 1759 Sep 4 01:06 stop_ha.sh -r-x------ 1 root root 5150 Sep 4 01:06 start_ha.sh -r-x------ 1 root root 18166 Sep 4 01:06 parse_cert.sh -r-x------ 1 root root 4368 Sep 4 01:06 ha_log_file_rotate.sh -r-x------ 1 root root 1918 Sep 4 01:06 get_harole.sh -r-x------ 1 root root 15398 Sep 4 01:06 gen-cert.sh -r-x------ 1 root root 4141 Sep 4 01:06 update_cert.sh -r-x------ 1 root root 373 Sep 4 01:06 upgrade_ha.sh -r-x------ 1 root root 634 Sep 4 01:06 query_fsw.sh -r-x------ 1 root root 8792 Sep 4 01:06 import_ha_cert.sh drwx------ 2 root root 4096 Sep 4 01:06 functions -r-x------ 1 root root 671 Sep 4 01:06 delete_user_define_cert.sh -r-x------ 1 root root 1982 Sep 4 01:06 ha_privilege_cfg.sh -r-x------ 1 root root 1417 Sep 5 10:23 log_util.sh
You can operate only the config_ha.sh, status_ha.sh, get_harole.sh, and query_fsw.sh scripts. Do not directly operate other scripts.
Descriptions of Common Script Commands
Command |
Description |
---|---|
cd $(ha_install_path)/ha/module/hacom/script ./config_ha.sh -a |
This script queries the key HA configurations. |
cd $(ha_install_path)/ha/module/hacom/script ./status_ha.sh |
|
cd $(ha_install_path)/ha/module/hacom/script ./get_harole.sh |
|
cd $(ha_install_path)/ha/module/hacom/script ./query_fsw.sh |
|
Application Examples of Common Scripts
- ./config_ha.sh -a
After running this script, the following information is displayed:
/ha/module/hacom/script # ./config_ha.sh -a HaMode: double HaLocalName: e99165d4-83e9-11ea-9734-60d75553af97(active) HaPeerName: 0d74b338-99ad-4ff7-897d-60d9b09d5ac0(standby) HaProtocol: ssl HaArbLk: 10.90.128.22:36800 -- 10.90.128.23:36800 HaSyncLk: 10.90.128.22:36802 -- 10.90.128.23:36802 HaRpcLk: 127.0.0.1:61806 HaArpLk: arpIpInfo Details: interface="eth0" netmask="255.255.255.0" activeArpIP="10.90.128.25" standbyArpIP="10.90.128.26" VLAN="" interface="eth0" netmask="255.255.255.0" VLAN="" interface="eth0" netmask="255.255.255.0" VLAN="" HaGwLk: 10.90.128.1
When you run the ./config_ha.sh -a script, the status of the HaLocalName and HaPeerName roles may be NULL, --, active, or standby. The details are as follows:
- After dual hot backup is enabled on the active and standby nodes, the initial status of both the active and standby roles is NULL.
- After the active and standby roles are determined by arbitrated, active and standby are displayed respectively, for example, for the local node and peer node.
- If the heartbeat between the active and standby nodes is lost or no heartbeat has been set up (for example, only one HA is started), only the role of the local node is displayed, and the role of the peer node is displayed as --.
- ./config_ha.sh -h
You can run this script to view the help information about a large number of configuration naming rules. However, you are not advised to run it on the background to configure the HA. Because the HA configuration and validation process is complex, it is better to deliver the HA configurations through a WebUI.
Currently, you can run this script to query configuration-related operations (for example, run the config_ha.sh -a command). Do not run the config_ha.sh script to modify background data if you are not sure about the timely delivery and validation of the entire HA configurations.
After running this script, the following information is displayed:
/ha/module/hacom/script # ./config_ha.sh -h ********************************************************************************************** Usages: [cmd] [options] [values] -m HA mode HaMode (single) or (double) default is single -d HA data protocol HaProtocol (udp), (tcp) or (ssl) default is udp -l HA local name HaLocalName must differ to peer name -p HA peer name HaPeerName must differ to local name -b HA heartbeat link information HaArbLk double mode need 1~4 items -s HA file sync link information HaSyncLk double mode need 1~4 items -r HA rpc information HaRpcLk must be valid ip address -S HA ssl mode enable or disable ssl ssl: true/false, enable or disable ssl. twoway: true/false, enable or disable two-way authentication. rootca: path to root CA, default is /home/data/ha/module/cert/root-ca.crt serverca: path to server CA, default is /home/data/ha/module/cert/server.crt serverkey: path to server key, default is /home/data/ha/module/cert/server.pem keypass: server key pWord, optional. keypassdecryptlib: path to server key pWord decrypt lib, default is /opt/middleware/ha/module/hacom/lib/server-key-decrypt.so, optional. -i HA arpIp(floatip)information HaArpLk 1~8 arpIpInfos,each arpIpInfo must has 5 items:interface,netmask,activeArpIP,standbyArpIP,VLAN where interface must be effective. All arpIpInfos be splited with semicolon -g HA gateway information HaGwLk optional, 1~4 items -u HA max resource count optional limited to [0,100] -j HA role (active),(standby) or (unknown) -c HA auto run when boot (on),(off) or (stat) -d HA runlog mode (local) or (syslog) default is local -e HA runlog level (DEBUG),(INFO),(WARN),(ERROR) or (NOTICE) default is INFO -f HA runlog path must be absolute path and limited to [./A-Za-z0-9_-], length of path should be less than 1000 default is /var/log/ha -k HA scriptlog path must be absolute path and limited to [./A-Za-z0-9_-], length of path should be less than 1000 default is /var/log/ha -o HA core path must be absolute path and limited to [./A-Za-z0-9_-], length of path should be less than 1000 default is /var/log/ha -n HA module name must be limited to [A-Za-z], length of name should be is less than 32 default is HA -t HA network down time must be limited to [0 / Min keepalive time - 3600] default is 0, do not check network state -a Show HA all config show current config information -h Show the help show all the config option help -z HA log archive interval set log's archive interval (unit is second), this value should less than 86400 and greater than 900 -w compare workspace or not set if compare ha's workspace when sync file. yes or no only -q RPC support SSL switch configuration (true) or (false) default is true -K HA keepalive interval optional limited to [3,1800] default is 7 Notes: (1) -m/l/p/b/s param is needed at first time when set double HA mode. (2) -c/d/e/f/n/a/h/z/K is exclusive with other option, it only can be set one by one. Examples: ./config_ha_unprotected.sh -m xxx -l xxx -p xxx -b xxx -s xxx ./config_ha_unprotected.sh -m single ./config_ha_unprotected.sh -l ha1 ./config_ha_unprotected.sh -p ha2 ./config_ha_unprotected.sh -b ha1:ip1:port1,ha2:ip2:port2;ha1:ip3:port3,ha2:ip4:port4 ./config_ha_unprotected.sh -s ha1:ip5:port5,ha2:ip6:port6;ha1:ip7:port7,ha2:ip8:port8 ./config_ha_unprotected.sh -i interface:eth0,netmask:255.255.255.0,activeArpIP:arpip1,standbyArpIP:arpip2,VLAN:1 ./config_ha_unprotected.sh -r ip1:port1 ./config_ha_unprotected.sh -g ip1,ip2 ./config_ha_unprotected.sh -j active ./config_ha_unprotected.sh -c stat ./config_ha_unprotected.sh -d local ./config_ha_unprotected.sh -e INFO ./config_ha_unprotected.sh -f /var/log/ha ./config_ha_unprotected.sh -k /var/log/ha ./config_ha_unprotected.sh -o /var/log/ha ./config_ha_unprotected.sh -n HA ./config_ha_unprotected.sh -a ./config_ha_unprotected.sh -u 30 ./config_ha_unprotected.sh -z 86400 ./config_ha_unprotected.sh -w no ./config_ha_unprotected.sh -d udp ./config_ha_unprotected.sh -q false ./config_ha_unprotected.sh -S ssl=true,twoway=true,rootca=root-ca.crt,serverca=server.crt,serverkey=server.pem,keypass=pass,keypassdecryptlib=lib.so **********************************************************************************************
The IP address and port number for RPC interface communication are configured in $(ha_install_path)/ha/module/hacom/conf/hacom.xml. The default ip is 127.0.0.1 and the default port number is 61806. The actual IP address and port number are subject to the actual configuration file....... <rpc> <addr ip="127.0.0.1" port="61806"/> </rpc> ......
Learn the usage conditions before running the commands. Some commands can be run only on active nodes. If an error occurs during command execution, see Table 10-1 to rectify the fault.
Table 10-1 Error code descriptionValue
Description
0
Command executed successfully.
1
Failed to execute the command.
2
Failed to set up the connection or start the thrift.
3
The parameters are incorrect.
4
The memory is insufficient.
5
An internal HA error occurred.
6
The file is waiting to be synchronized.
7
Incorrect HA role.
8
No links are available.
9
Failed to send the packet.
10
Timed out.
11
Incorrect HA mode.
12
The switchover is disabled.
13
The switchover is not allowed because some resources are unstable.
14
The switchover is not allowed because resources on the active node are better than those on the standby node.
15
Failed to synchronize the command for disabling or enabling the switchover to the standby node.
16
The single-active resource does not exist.
17
The HA arbitration status does not indicate that the active end is running properly (Actived) and the standby end is running properly (Deactived).
- ./get_harole.shAfter running this script, the following information is displayed:
/ha/module/hacom/script # ./get_harole.sh active
- ./status_ha.sh
After running this script, the following information is displayed:
/ha/module/hacom/script # ./status_ha.sh HAMode double NodeName HostName HAVersion StartTime HAActive HAAllResOK HARunPhase e99165d4-83e9-11ea-9734-60d75553af97 test050 1.3.0.2 2020-09-05 10:23:36 active normal Actived 0d74b338-99ad-4ff7-897d-60d9b09d5ac0 Euler 1.3.0.2 2020-09-05 10:23:03 standby normal Deactived NodeName ResName ResStatus ResHAStatus ResType e99165d4-83e9-11ea-9734-60d75553af97 atlas-docker-resource Normal Normal Single_active 0d74b338-99ad-4ff7-897d-60d9b09d5ac0 atlas-docker-resource Stopped Normal Single_active
- ./query_fsw.shAfter running this script, the following information is displayed:
/ha/module/hacom/script # ./query_fsw.sh swap forbid cancel