Scenario
The application architecture of modern enterprises usually considers HA design, and the virtual IP in eSurfing Cloud products can be used with VRRP software to achieve high availability. In this section, we will make detailed configuration and related test for this scenario.
The overall architecture can be summarized as associating the virtual IP with two cloud servers and receiving an ARP protocol announcement to bind the NIC of a particular cloud server.
The resource levels are as follows:
Cloud Resources | Architecture Level |
VPC | Region level |
Cloud Server | AZ level |
Virtual IP | Region level |
Elastic IP (EIP) | Region level |
Procedure
1. Create a VPC, go to Control Center, select Network > VPC, click to create VPC, set the VPC CIDR block to 192.168.0.0/16 and the subnet CIDR block to 192.168.0.0/24.
2. Create a ECS, go to Control Center, select Computing > ECS, click to create cloud servers ECS1 and ECS2, set the operating system to CentOS 7.5, and select the VPC and subnet created in step 1.
3. Create a Virtual IP, in the VPC console, click the VPC name to enter the VPC details, click the subnet name to enter the subnet details, and click Apply for Virtual IP Address.
According to the actual needs, choose to assign VIP automatically or manually.
4. According to the business you are deploying, configure the security group rules where the cloud server is located, and allow the TCP protocol to correspond to the port's inbound authorization policy.
5. Create an Elastic IP. Go to Control Center, select Network > Elastic IP, and click to create Elastic IP.
6. Log in to ECS1 and ECS2 and execute the following command to deploy the apache service and keepalived service:
7. yum install -y httpd keepalived
8. Configure /etc/keepalived/keepalived.conf
9. vim /etc/keepalived/keepalived.conf
10. See picture for configuration
11. Configure /etc/httpd/conf/httpd.conf
12. echo “ServerName localhost:80”>>/etc/httpd/conf/httpd.conf
13. Restart the service after the configuration is complete
14. systemctl restart httpd
15. systemctl restart keepalived
16. Create the test page
17. <html>
18. <body>
19. <title>This is a test</title>
20. <p>this is a test</p>
21. </body>
22. </html>
Set ECS1 as the active node
Set ECS2 as the standby node
23. Bind the virtual IP to the elastic IP, as well as to ECS1 and ECS2.
24. Verify VIP.
1) Use the ping command to long ping the corresponding elastic IP.
2) On ECS1 (active node), enter systemctl stop keepalived.
3) If the interrupted elastic IP can be pinged after a period of time, the back-end of the virtual IP s switched to ECS2 (standby node).