I. Script pre-run simulation environment
dr:server1:172.25.29.1 Ipvsadm keepalived
rs:server2:172.25.29.2 ARPTABLES_JF httpd
rs:server3:172.25.29.3 ARPTABLES_JF httpd
dr:server4:172.25.29.4 Ipvsadm keepalived
Install Server1, Server2, Server3 software before using the script, and do a good job of httpd back-end access page
two. Lvs_d Introduction to R-Mode scripting
1.server1 running LVSDR mode start Stop script: (Install the Ipvsadm in advance), you can run on Server4 later
Add Ipvsadm policy automatically
Add VIP automatically
lvs_action.sh
650) this.width=650; "src=" Https://s3.51cto.com/oss/201711/17/add5551388a180ec507d7e9c2e69a30e.png "style=" float: none; "Title=" screenshot from 2017-11-17 21-35-52.png "alt=" Add5551388a180ec507d7e9c2e69a30e.png "/>
650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/17/77f877063942933006d15b02e0e97d33.png "style=" float: none; "Title=" screenshot from 2017-11-17 21-36-06.png "alt=" 77f877063942933006d15b02e0e97d33.png "/>
650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/17/35ec602a2e59dc341cf42bb67c52d276.png "style=" float: none; "Title=" screenshot from 2017-11-17 21-36-15.png "alt=" 35ec602a2e59dc341cf42bb67c52d276.png "/>
2.server2,server3 Run the Arptables policy Add script: (pre-installed IPTABLES_JF)
lvs_arp.sh
650) this.width=650; "src=" Https://s3.51cto.com/oss/201711/17/0c1fad985176eae5541fda1af626d206.png "title=" Screenshot from 2017-11-17 21-40-08.png "alt=" 0c1fad985176eae5541fda1af626d206.png "/>
Three. Analog keepalived switch Script
1. Run the simulated keepalived health check script in Server1 and Server4
lvs_check.sh
650) this.width=650; "src=" Https://s2.51cto.com/oss/201711/17/f05f61be29f16990d1a9510986601c98.png "title=" Screenshot from 2017-11-17 21-45-26.png "alt=" F05f61be29f16990d1a9510986601c98.png "/>
2. Run the analog keepalived high-availability toggle script in Server1 and Server4
keepalived_lvs.sh
650) this.width=650; "src=" Https://s2.51cto.com/oss/201711/17/5cf013b77da68242d385aab29bdd3bdc.png "title=" Screenshot from 2017-11-17 21-49-33.png "alt=" 5cf013b77da68242d385aab29bdd3bdc.png "/>
Linux shell script LVSDR mode startup script and impersonation keepalived high Availability script