CLI Guidance

zsha2 has many sub-commands. This section will elaborate on what each sub-command is and how to use them.


-h

Description

Displays the help information, which allows you to view all sub-commands of zsha2.

Usage

[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 

version

Description

Displays the version information, including the version No. and commit ID.

Usage

[root@localhost ~]# zsha2 version version 3.1.0.0, commit 2b1b06788e4e1d4b514342db1f381b460f7242e6

install-ha

Description

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.

Usage

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.
Note:
  • During the installation, the database of the standby MN will be overwritten by that of the active MN. Please exercise caution.
  • If the root password contains special shell characters, escape these characters.
./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.
Note: You can specify multiple time servers at a time.
  • ./zsha2 install-ha -time-server 192.168.196.125
  • ./zsha2 install-ha -time-server 192.168.196.125,192.168.196.126
-cidr Optional. Specifies an network range, which must cover the IP address, VIP, and gateway of the active and standby MNs.
Note: If not specified, the system will calculate a minimum network range, which might fail to meet the requirements. We recommend that you specify a network range.
./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.
Note: We recommend that you back up these two databases before you perform the force installation.
./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
The following is an example of how to install an HA suite by specifying the command line:
[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
The following is an example of how to install an HA suite by writing a configuration file:
[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









Archives

Download Document Archives

Back to Top

Download

Already filled the basic info?Click here.

Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

An email with a verification code will be sent to you. Make sure the address you provided is valid and correct.

同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Download

Not filled the basic info yet? Click here.

Invalid email address or mobile number.
同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Email Us

contact@zstack.io
ZStack Training and Certification
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Email Us

contact@zstack.io
Request Trial
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Email Us

contact@zstack.io

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder. After receiving the email, click the URL to download the documentation.

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder.
Or click on the URL below. (For Internet Explorer, right-click the URL and save it.)

Thank you for using ZStack products and services.

Submit successfully.

We'll connect soon.

Thank you for using ZStack products and services.