配置Nginx四层负载均衡
nginx 支持TCP转发和负载均衡的支持
实现下面的架构:
看配置:
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } tcp { upstream toov5{ server 192.168.8.159:8081 ; server 192.168.8.159:8080; } server { listen 9999; server_name 192.168.91.5; proxy_pass toov5; } }
短小精悍!
连接 server1 断开 在连接到 server2 就这样的轮训~~~