Haproxy is a free and open code software written in C that provides high availability, load balancing, and TCP and HTTP-based application proxies that can run on most major Linux operating systems.
This experiment with three servers, one server installation haproxy implementation scheduling, another two servers to build Nginx to provide Web services, a client test access.
The server needs to change the network adapter to NAT mode and download the installation package online
Scheduling Server Installation Related packages
Web Server Installation Related packages
After installation, change the network adapter to host-only mode, modify the IP address
Haproxy Server: 192.168.100.21/24
Web Server 1:192.168.100.22/24
Web Server 2:192.168.100.23/24
Client: 192.168.100.30/24
1, Web Server installation Nginx
Mount the Nginx package to the virtual machine for decompression and go to the extracted folder for configuration
Create user Nginx does not use shell login
Create a test page
Open Nginx
Turn off firewall and security features
Self - rated
The second Web server is configured identically
2. Dispatch server
Attach the Haproxy package to the virtual machine and use it after decompression
Go to the extracted folder to compile
Create the/etc/haproxy directory and copy the configuration file to this directory
Edit the configuration file, delete all listen parts, add a new listen part of the content
Copy configuration files, add permissions, set up soft links, open services
Turn off firewall and security features
Client access test, the client input is: Dispatch server IP Address/test.html
Re-access after refresh
3. Log Management
Edit Haproxy configuration file
Restart Haproxy
The script that generated the log reads as follows
Restart Log service
Go to/var/log/directory, no Haproxy folder
Use client access before viewing the Haproxy folder
Go to the Haproxy folder to see the generated log files
View content to see access information
Deploying Haproxy+nginx on CentOS7 to implement a Web cluster