Haproxy installation and port forwarding configuration
haproxy is a powerful, flexible and useful reverse proxy software, provides high availability, load balancing, back-end server proxy features, it is very powerful in layer 7 load balancing (support for cookie track, header rewrite, etc.), support for dual machine hot standby, support for virtual hosts, has a very good server health check function. It also provides an intuitive monitoring page that allows you to clearly monitor the service cluster in real time.
I'll just talk about how to configure port forwarding, first install haproxy
yum -y install haproxy
and then empty the haproxy.cfg file of its contents.
Then write the following to the haproxy.cfg file
global ulimit-n 51200 defaults log global mode tcp option dontlognull timeout connect 1000ms timeout client 150000ms timeout server 150000ms listen status bind 0.0.0.0:1080 mode http log global stats refresh 30s stats uri /admin?stats stats realm Private lands stats auth admin:password stats hide-version frontend ssin bind *:1000-2000 default_backend ssout backend ssout server server1 18.104.22.168 maxconn 204800
Explanation: bind *:1000-2000 Here means port 1000-2000, 22.214.171.124 is the IP of the server to be forwarded.
Then start the haproxy service.
service haproxy start
Finally don't forget to open up the forwarding ports in your server firewall policy.