Deploying HA on an Edge Device
Prerequisites
The umask 0077 command is run to set the default permission before you run any other command.
Procedure
- Upload the Ascend-mindxedge-keepalived_{version}_linux-{arch}.zip software package obtained in Obtaining the Software Package and deploy it to the /opt/middleware/ directory on the edge device. Ensure that no file or folder with the same name as the decompressed files exists in the directory. Run the unzip Ascend-mindxedge-keepalived_{version}_linux-{arch}.zip command as the root user to decompress the package. The following information is displayed:
Table 1 Content of decompressed files File
File Information
Ascend-mindxedge-keepalived_{version}_linux-{arch}.tar.gz
HA compressed package, including keepalived.patch.
Ascend-mindxedge-keepalived_{version}_linux-{arch}.tar.gz.cms
CMS signature file
Ascend-mindxedge-keepalived_{version}_linux-{arch}.tar.gz.crl
CRL
- Decompress the Ascend-mindxedge-keepalived_{version}_linux-{arch}.tar.gz software package.Run the tar -mxvf Ascend-mindxedge-keepalived_{version}_linux-{arch}.tar.gz --no-same-owner command in the current directory as the root user to decompress the package. Before the decompression, ensure that no folder or file with the same name as the decompressed folders or files exists in the directory. The following information is displayed:
Table 2 Decompressed files File or Folder Name
Information
keepalived.patch
Patch file, which is used to install a patch for the Keepalived source code and create the Keepalived binary file.
Keepalived
Folder, which contains the scripts for implementing HA.
version
Version file.
- Upload the Keepalived binary file obtained in Compiling the Keepalived Binary File to the /opt/middleware/keepalived/bin directory. You can run the following command to upload the Keepalived binary file:
scp root@{compilation_device}:{compile_path}/keepalived-2.2.4/bin/keepalived /opt/middleware/keepalived/bin
Example:scp root@192.168.XX.XX:/home/keepalived-2.2.4/bin/keepalived /opt/middleware/keepalived/bin
Table 3 Option description Option
Description
compilation_device
IP address of the Keepalived binary compilation environment.
compile_path
Path for uploading the Keepalived source code in the compilation environment.
- Run the vi /opt/middleware/keepalived/conf/env.json command to open the env.json file. Set parameters by referring to the parameter examples of the two networking modes and Table 4, and save the file.
- Independent heartbeat networking
{ "VRRP_INSTANCE_PRIORITY":"100", "VRRP_INSTANCE_INTERFACE":"eth5", "VRRP_INSTANCE_VIRTUAL_IP":"192.168.XX.XX dev eth4", "PEER_VIP_INTERFACE_MAC":"XX:XX:XX:XX:XX:XX", "PEER_IP01":"192.168.XX.XX", "ARBITRATION_IP":"192.168.XX.XX", "ROUTE_ID":"102", "SRC_IP":"192.168.XX.XX" }
- Non-independent heartbeat networking
{ "VRRP_INSTANCE_PRIORITY":"100", "VRRP_INSTANCE_INTERFACE":"eth4", "VRRP_INSTANCE_VIRTUAL_IP":"192.168.XX.XX", "PEER_VIP_INTERFACE_MAC":"XX:XX:XX:XX:XX:XX", "PEER_IP01":"192.168.XX.XX", "ARBITRATION_IP":"192.168.XX.XX", "ROUTE_ID":"102", "SRC_IP":"192.168.XX.XX" }

Table 4 Environment variables Environment Variable
Description
Remark
VRRP_INSTANCE_PRIORITY
Node priority. The value ranges from 1 to 255.
The priority of the active node must be higher than that of the standby node.
VRRP_INSTANCE_INTERFACE
Name of the Keepalived VRRP heartbeat communication interface.
Ensure that the heartbeat NICs on the active and standby nodes can communicate with each other.
VRRP_INSTANCE_VIRTUAL_IP
Floating IP address, also called virtual IP or VIP. The floating IP address is used as the unified external access entry for the same HA cluster and is dynamically bound to the service NIC of the active node. It is in the same network segment as the NICs of the active and standby nodes and can be pinged.
Format:
- IP address dev <NIC name>
Example: 192.168.XX.XX dev eth4
- IP address
Example: 192.168.XX.XX
In this case, the VIP is bound to VRRP_INSTANCE_INTERFACE.
Ensure that the floating IP address is not used and the floating IP addresses of the active and standby nodes are the same. Select dev (heartbeat NIC) based on the actual networking mode. Ensure that the heartbeat NICs of the active and standby nodes are connected.
PEER_IP01
IP address of the peer heartbeat NIC.
When configuring HA software on the active node, enter the IP address of the heartbeat NIC of the standby node.
When configuring HA software on the standby node, enter the IP address of the heartbeat NIC of the active node.
ROUTE_ID
HA cluster ID. If multiple HA clusters are required in a subnet, their IDs must be different.
The value ranges from 1 to 255. The default value is the fourth segment of the floating IP address.
The HA cluster IDs of the active and standby nodes must be the same while different from other HA cluster IDs.
ARBITRATION_IP
Arbitration IP address, which is used to determine the active/standby switchover. Generally, it is set to the gateway address and can be connected to the active and standby nodes.
The active and standby nodes must be configured with the same arbitration IP address.
PEER_VIP_INTERFACE_MAC
MAC address of the peer service NIC.
When configuring the HA software on the active node, enter the MAC address of the service NIC of the standby node.
When configuring the HA software on the standby node, enter the MAC address of the service NIC of the active node.
SRC_IP
IP address of the heartbeat NIC
When configuring HA software on the active node, enter the IP address of the heartbeat NIC of the active node.
When configuring HA software on the standby node, enter the IP address of the heartbeat NIC of the standby node.
Only IPv4 is supported for the floating IP address, IP address of the peer heartbeat NIC, arbitration IP address, and heartbeat NIC IP address. The addresses cannot be all-zero addresses (0.0.0.0), broadcast addresses (255.255.255.255), or system loopback addresses (127.0.0.0 to 127.255.255.255).
The application scenarios are as follows (the non-independent heartbeat networking is recommended):- Independent heartbeat networking: The heartbeat interface uses an independent NIC. Heavy traffic on the service network port may affect the heartbeats. In this case, the independent heartbeat networking is recommended. However, split brain (or dual-active) may occur in this networking scenario.
- Non-independent heartbeat networking: The heartbeat network port and service network port share the same NIC. When service network traffic does not affect heartbeats, the non-independent heartbeat networking is recommended. This network is easy to configure and does not have split-brain risks.
- Independent heartbeat networking