我有一个HA代理配置,在后端有三个应用服务器集群。后端服务器使用端口http-> 80,socket.io-> 3000和redis-> 6379
所以我创建了以下后端和前端。对于第一个应用程序,我添加了socket.io en redis。但不是第二个。不确定这样做是否是最佳方式。
frontend http-in
bind *:80 name port80
mode http
# Define hosts
acl host_appl3 hdr(host) -i im.test.com
acl host_appl4 hdr(host) -i appl4.test.com
acl websocket_appl3 hdr(Upgrade) -i Websocket
# figure out which one to use
use_backend appl3_cluster if host_appl3
use_backend appl4_cluster if host_appl4
use_backend appl3_websocket if appl3_websocket
frontend redis
bind *:6379 name port6379
#define hosts
acl redis_appl3 hdr(host) -i im.test.com
#figure out which one to use
use_backend appl3_redis if redis_appl3
backend appl3_cluster
mode http
balance leastconn
option httpclose
option forwardfor
cookie JSESSIONID prefix
# private address
server appl3node1_http 10.146.94.99:80 cookie A check
# private address
# server appl3node2_http x.x.x.x cookie A check
backend appl3_websocket
mode http
option forwardfor
reqadd x-forwarded-proto:\ http
server appl3node1_ws 10.146.94.99:3000 check
# server appl3node2_ws x.x.x.x:3000 check
backend appl3_redis
mode tcp
option tcplog
option tcp-check
tcp-check send PING\r\n
tcp-check expect +PONG
tcp-check send info\ replication\r\n
tcp-check expect string role:master
tcp-check send QUIT\r\n
tcp-check expect string +OK
server appl3node1_redis 10.146.94.99:6379 check inter ls
#server appl3node2_redis x.x.x.x:6379 inter ls
backend appl4_cluster
balance leastconn
option httpclose
cookie JSESSIOID prefix
# private address
server node2_http 10.42.71.166:80 cookie A check
etc.....
有人帮助我吗?
扬