Skip to content

Instantly share code, notes, and snippets.

@xixitalk
Last active March 26, 2016 00:24
Show Gist options
  • Save xixitalk/fa15eb1cb46b2cf27c76 to your computer and use it in GitHub Desktop.
Save xixitalk/fa15eb1cb46b2cf27c76 to your computer and use it in GitHub Desktop.
8877为haproxy对外的端口,8443是多个SS服务器的端口,weight是权重,值越大分配的负载越多,backup是标志后备的服务器。手机上影梭使用haproxy所在的IP和端口8877访问,加密方式和密码使用SS服务器的设置。
global
ulimit-n 51200
defaults
log global
mode tcp
option dontlognull
balance roundrobin
option persist
timeout connect 10000
timeout client 150000
timeout server 150000
listen stats
bind *:12222
mode http
stats enable
stats uri /
stats refresh 10s
retries 1
option redispatch
frontend ss-in
bind *:8877
default_backend ss-out
backend ss-out
server jp0 jp0.example.com:8443 maxconn 20480 weight 1 backup
server jp1 jp1.example.com:8443 maxconn 20480 weight 1 backup
server jp2 jp2.example.com:8443 maxconn 20480 weight 1 backup
server jp3 jp3.example.com:8443 maxconn 20480 weight 1 backup
server jp4 jp4.example.com:8443 maxconn 20480 weight 1 backup
server jp5 jp5.example.com:8443 maxconn 20480 weight 1 backup
server uk uk.example.com:8443 maxconn 20480 weight 1 backup
server sg sg.example.com:8443 maxconn 20480 weight 1 backup
server us0 us0.example.com:8443 maxconn 20480 weight 1 backup
server us1 us1.example.com:8443 maxconn 20480 weight 1 backup
server us2 us2.example.com:8443 maxconn 20480 weight 1
server us3 us3.example.com:8443 maxconn 20480 weight 1 backup
server us4 us4.example.com:8443 maxconn 20480 weight 1 backup
server us5 us5.example.com:8443 maxconn 20480 weight 1 backup
server us6 us6.example.com:8443 maxconn 20480 weight 1 backup
server us7 us7.example.com:8443 maxconn 20480 weight 1 backup
server us8 us8.example.com:8443 maxconn 20480 weight 1 backup
server hk hk.example.com:8443 maxconn 20480 weight 250
@xixitalk
Copy link
Author

修改了配置,增加了查看stats。因为本haproxy目的不是负载平衡,而是保障SS既快速又稳定,所以将hk的服务器权重标志为250,第二是us2,其他做稳定性后备。这样的另一个考虑是连接99%从hk走,twitter账号不会因为频繁更换IP而被锁。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment