The content of this blog entry is taken from Load balancing Windows Terminal Server – HAProxy and RDP Cookies or Microsoft Connection Broker
In this blog entry, we will put in a sample working haproxy configuration to load balance between terminal services
Step 1: Install haproxy
# yum install haproxy
Step 2: Modify /etc/haproxy/haproxy.cfg
#--------------------------------------------------------------------- # Global settings #--------------------------------------------------------------------- global # to have these messages end up in /var/log/haproxy.log you will # need to: # # 1) configure syslog to accept network log events. This is done # by adding the '-r' option to the SYSLOGD_OPTIONS in # /etc/sysconfig/syslog # # 2) configure local2 events to go to the /var/log/haproxy.log # file. A line like the following can be added to # /etc/sysconfig/syslog # # local2.* /var/log/haproxy.log # log 127.0.0.1 local2 chroot /var/lib/haproxy pidfile /var/run/haproxy.pid maxconn 4500 user haproxy group haproxy daemon stats socket /var/lib/haproxy/stats #--------------------------------------------------------------------- # common defaults that all the 'listen' and 'backend' sections will # use if not designated in their block #--------------------------------------------------------------------- defaults timeout queue 1m timeout connect 60m timeout client 60m timeout server 60m # ------------------------------------------------------------------- # [RDP Site Configuration] # ------------------------------------------------------------------- listen cattail 155.69.57.11:3389 mode tcp tcp-request inspect-delay 5s tcp-request content accept if RDP_COOKIE persist rdp-cookie balance leastconn option tcpka option tcplog server win2k8-1 192.168.6.48:3389 weight 1 check inter 2000 rise 2 fall 3 server win2k8-2 192.168.6.47:3389 weight 1 check inter 2000 rise 2 fall 3 option redispatch listen stats :1936 mode http stats enable stats hide-version stats realm Haproxy\ Statistics stats uri /
Information:
- timeout client and timeout server is put at 6 hours (360m) to keep idle RDP session established
- persist rdp-cookie and balance rdp-cookie. These instruct HAProxy to inspect the incoming RDP connection for a cookie; if one is found, it is used to persistently direct the connection to the correct real server
- The 2 tcp-request lines help to ensure that HAProxy sees the cookie on the initial request.
No comments:
Post a Comment