First, the experimental structure
This experiment consists of one haproxy and two Web servers, and finally realizes the high availability and load balance of two Web servers.
Haproxy
|
172.24.3.10
|
Web1
|
172.24.3.20
|
Web2
|
172.24.3.25
|
Second, the experimental steps
Haproxy
1, install support software Pcre-devel Bzip2-devel
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M01/82/4E/wKioL1dQ8MixOY_bAAAn7niH_-4915.jpg "title=" 1.jpg " alt= "Wkiol1dq8mixoy_baaan7nih_-4915.jpg"/>
2, compile and install Haproxy
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M01/82/4E/wKioL1dQ8kXAZHPxAACQ9fS1bWk488.jpg "title=" 2.jpg " alt= "Wkiol1dq8kxazhpxaacq9fs1bwk488.jpg"/>
3, set up the Haproxy configuration file
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M01/82/4F/wKioL1dQ8u7z3bRwAABVEOTDZNA450.jpg "title=" 3.jpg " alt= "Wkiol1dq8u7z3brwaabveotdzna450.jpg"/>
4. Modify the Haproxy configuration file
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/82/50/wKioL1dQ-PzQDb9TAAKGWEpB0dU644.jpg "title=" 4.jpg " alt= "Wkiol1dq-pzqdb9taakgwepb0du644.jpg"/>
5. Create a self-starter script
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M01/82/50/wKioL1dQ-R-gZ76wAAC_nhmsI8I068.jpg "title=" 5.jpg " alt= "Wkiol1dq-r-gz76waac_nhmsi8i068.jpg"/>
6, add firewall exception
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M02/82/50/wKioL1dQ-YHTgnXgAABG76LO3Bw782.jpg "title=" 6.jpg " alt= "Wkiol1dq-yhtgnxgaabg76lo3bw782.jpg"/>
Web//Two Web server operations are the same
1. Turn on firewall exception
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M01/82/50/wKioL1dQ-bGwDB92AABG76LO3Bw044.jpg "title=" 6.jpg " alt= "Wkiol1dq-bgwdb92aabg76lo3bw044.jpg"/>
2. Start the HTTPD service and access the 172.24.3.10 authentication
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M00/82/51/wKiom1dQ-dzgSW9IAABJhmhr21E314.jpg "style=" float: none; "title=" 7.jpg "alt=" Wkiom1dq-dzgsw9iaabjhmhr21e314.jpg "/>
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M00/82/50/wKioL1dQ-t2jEZdhAABKd7QU-Bs971.jpg "style=" float: none; "title=" 8.jpg "alt=" Wkiol1dq-t2jezdhaabkd7qu-bs971.jpg "/>
This article is from the "New Start" blog, so be sure to keep this source http://yuanshuai.blog.51cto.com/10539781/1785757
Haproxy high availability and load balancing clusters for the web