ZStack Cloud Platform
Single Server, Free Trial for One Year
zsha2 has many sub-commands. This section will elaborate on what each sub-command is and how to use them.
Displays the help information, which allows you to view all sub-commands of zsha2.
[root@localhost ~]# zsha2 -h usage: zsha2 [ global options ] command [ command options ] Global options: -h,--help Display this message Commands: install-ha install two-node HA environment stop-node stop zstack service in HA environment start-node start zstack service in HA environment upgrade-mn upgrade the MN in HA environment upgrade-ha upgrade the HA suites demote demote current node as backup status show HA status show-config show HA configuration sample-config generate sample configuration to setup HA environment collect-log collect HA related log files help show this help message
Displays the version information, including the version No. and commit ID.
[root@localhost ~]# zsha2 version version 3.1.0.0, commit 2b1b06788e4e1d4b514342db1f381b460f7242e6
An installation command. If you installed two MNs, you could run the zsha2 installation command in a MN to switch to the dual-MN HA mode.
Parameter | Description | Example |
---|---|---|
-nic | The physical device name, which is used to configure a VIP. In production environments, this parameter is usually a network management bridge. | ./zsha2 install-ha -nic br_bond0 |
-gateway | The arbitration gateway of the active and standby MNs. | ./zsha2 install-ha -gateway 192.168.0.1 |
-slave | Specifies the standby MN.![]()
| ./zsha2 install-ha -slave "root:password@192.168.196.125" |
-vip | Specifies the VIP for Keepalived communication. | ./zsha2 install-ha -vip 192.168.199.151 |
-myip | Optional. Specifies the local IP address. | ./zsha2 install-ha -myip 192.168.195.200 |
-db-root-pw | The database root password of the active and standby MNs. Make sure that these two MNs share the same database root password. | ./zsha2 install-ha -db-root-pw zstack.mysql.password |
-time-server | Specifies a time synchronization server for unified time synchronization.![]() |
|
-cidr | Optional. Specifies an network range, which must cover the IP address, VIP, and gateway of the active and standby MNs.![]() | ./zsha2 install-ha -cidr 192.168.0.0/16 |
-force | Optional. Force runs the zsha2 installation command in the active MN if the database of the active and standby MNs cannot automatically synchronized for a long time.![]() | ./zsha2 install-ha -force |
-repo | Optional. Specifies the YUM repository, which defaults to the local repository. | ./zsha2 install-ha -repo zstack-local |
-timeout | Optional. The timeout for copying the databases of the active and standby MNs. Default: 600. Unit: second. | ./zsha2 install-ha -timeout 600 |
-yes | Optional. Indicates that all settings are allowed. | ./zsha2 install-ha -yes |
-config | Optional. Initializes and installs an HA suite by using a configuration file. | ./zsha2 install-ha -config zs-install.config |
[root@localhost ~]# ./zsha2 install-ha -nic br_bond0 -gateway 192.168.0.1 -slave "root:password@192.168.196.125" \ -vip 192.168.199.151 -myip 192.168.195.200 -db-root-pw zstack.mysql.password -time-server 192.168.196.125 -cidr 192.168.0.0/16 -yes Master IPv4 address: 192.168.195.200 ZStack version @ 192.168.195.200: 2.6.0 ZStack version @ 192.168.196.125: 2.6.0 Calculated CIDR: 192.168.0.0/16 Backuping databases on 192.168.196.125 (/var/lib/zstack/mysql-backup/zstack-backup-db-2018-10-09T164934-0800.gz) ... Start installation ... x checking network interface and gateway ... ✓ Task 1: checking network interface and gateway ... completed. x prepare HA-services ... ✓ Task 2: prepare HA-services ... completed. + setting up DB config before replication ... ✓ Task 3: setting up DB config before replication ... completed. x creating DB user for replication ... ✓ Task 4: creating DB user for replication ... completed. + update iptables rules ... ✓ Task 5: update iptables rules ... completed. + starting the initial replication ... *************************** 1. row *************************** File: mysql-bin.000002 Position: 1844 Binlog_Do_DB: Binlog_Ignore_DB: + starting the initial replication ... Local database backuped to /var/lib/zstack/mysql-backup/zstack-backup-db-2018-10-09T164934-0800.gz ✓ Task 6: starting the initial replication ... completed. x wait peer slave sync status ... Slave_IO_Running: Yes Slave_SQL_Running: Yes Last_IO_Error: Last_SQL_Error: Last_Error: Last_Errno: 0 ✓ Task 7: wait peer slave sync status ... completed. + wait local DB sync status ... *************************** 1. row *************************** File: mysql-bin.000002 Position: 245 Binlog_Do_DB: Binlog_Ignore_DB: x wait local DB sync status ... Slave_IO_Running: Yes Slave_SQL_Running: Yes Last_IO_Error: Last_SQL_Error: Last_Error: Last_Errno: 0 ✓ Task 8: wait local DB sync status ... completed. + setting up keepalived ... ✓ Task 9: setting up keepalived ... completed. x check slave virtual IP settings ... ✓ Task 10: check slave virtual IP settings ... completed. x configuring ZStack servers ... ✓ Task 11: configuring ZStack servers ... completed. x installing HA scripts ... ✓ Task 12: installing HA scripts ... completed. x starting ZStack HA service ... ✓ Task 13: starting ZStack HA service ... completed. x waiting management node up and running ... ✓ Task 14: waiting management node up and running ... completed. OK, installation completed. Hints: - Stop server with: zsha2 stop-node, - Start server with: zsha2 start-node, - Get HA status with: zsha2 status -peer 192.168.196.125 Please also setup SSH pubkey-login between 192.168.195.200 and 192.168.196.125
[root@localhost ~]# ./zsha2 install-ha -config zs-install.config Master IPv4 address: 192.168.195.200 ZStack version @ 192.168.195.200: 2.6.0 ZStack version @ 192.168.196.125: 2.6.0 Calculated CIDR: 192.168.0.0/16 Backuping databases on 192.168.196.125 (/var/lib/zstack/mysql-backup/zstack-backup-db-2018-10-09T164934-0800.gz) ... Start installation ... x checking network interface and gateway ... ✓ Task 1: checking network interface and gateway ... completed. x prepare HA-services ... ✓ Task 2: prepare HA-services ... completed. + setting up DB config before replication ... ✓ Task 3: setting up DB config before replication ... completed. x creating DB user for replication ... ✓ Task 4: creating DB user for replication ... completed. + update iptables rules ... ✓ Task 5: update iptables rules ... completed. + starting the initial replication ... *************************** 1. row *************************** File: mysql-bin.000002 Position: 1844 Binlog_Do_DB: Binlog_Ignore_DB: + starting the initial replication ... Local database backuped to /var/lib/zstack/mysql-backup/zstack-backup-db-2018-10-09T164934-0800.gz ✓ Task 6: starting the initial replication ... completed. x wait peer slave sync status ... Slave_IO_Running: Yes Slave_SQL_Running: Yes Last_IO_Error: Last_SQL_Error: Last_Error: Last_Errno: 0 ✓ Task 7: wait peer slave sync status ... completed. + wait local DB sync status ... *************************** 1. row *************************** File: mysql-bin.000002 Position: 245 Binlog_Do_DB: Binlog_Ignore_DB: x wait local DB sync status ... Slave_IO_Running: Yes Slave_SQL_Running: Yes Last_IO_Error: Last_SQL_Error: Last_Error: Last_Errno: 0 ✓ Task 8: wait local DB sync status ... completed. + setting up keepalived ... ✓ Task 9: setting up keepalived ... completed. x check slave virtual IP settings ... ✓ Task 10: check slave virtual IP settings ... completed. x configuring ZStack servers ... ✓ Task 11: configuring ZStack servers ... completed. x installing HA scripts ... ✓ Task 12: installing HA scripts ... completed. x starting ZStack HA service ... ✓ Task 13: starting ZStack HA service ... completed. x waiting management node up and running ... ✓ Task 14: waiting management node up and running ... completed. OK, installation completed. Hints: - Stop server with: zsha2 stop-node, - Start server with: zsha2 start-node, - Get HA status with: zsha2 status -peer 192.168.196.125 Please also setup SSH pubkey-login between 192.168.195.200 and 192.168.196.125