yum install -y haproxy
先備份之後編輯 haproxy.cfg
vi /etc/haproxy/haproxy.cfg
當user訪問 47.90.90.112:5000 時,導向 47.90.33.129:8080
當user訪問 47.90.90.112:5001 時,導向 123.51.165.168:18080
並且設置 47.90.90.112:8088 監控儀表板觀察
...
frontend http
bind 47.90.90.112:5000
bind 47.90.90.112:5001
acl rule1 dst_port 5000
acl rule2 dst_port 5001
use_backend tpe if rule1
use_backend hk if rule2
# HAProxy 監控儀表板
listen stats :8088
mode http
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /
# 帳號密碼
stats auth your_username:your_password
stats refresh 10s
backend hk
balance roundrobin
cookie SERVERID insert indirect nocache
server hk1 47.90.33.129:8080
backend tpe
balance roundrobin
cookie SERVERID insert indirect nocache
server tpe1 123.51.165.168:18080
沒有留言:
張貼留言