- OS:
CentOS 7(阿里云) - 原理:
PC -> 阿里云frontend -> 阿里云backend -> 美国 VPS
安装HA
Step 1
yum install haproxy
Step 2
vim /etc/haproxy/haproxy.cfg
global
ulimit-n 51200
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
user haproxy
group haproxy
daemon
defaults
log global
mode tcp
option dontlognull
timeout connect 5000 // ms
timeout client 50000
timeout server 50000
frontend ss-in
bind *:port // 给客户端使用的端口
default_backend ss-out
backend ss-out
server server1 ip:port maxconn 20480 // vps ip port
启动HA
haproxy -f /etc/haproxy/haproxy.cfg &
设置成开机启动:
chkconfig haproxy on
网友评论