Why would you want to do that. If one of the directors die round robin (dns?) will still send requests to the dead server, so half of your incoming mail connections would die. Why would you create a single point of failover in a ha environment?
I am doing smtp load balancing with active passive directors. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Anthony Roberts Sent: Sunday, February 22, 2009 7:31 AM To: [email protected] Subject: [lvs-users] Round Robin and SMTP server. Hi everyone. I'd like to use ldirectord to load balance TCP services, including SMTP. I've set up two SLES10 VMs to test. sles10vm3 (192.168.40.134) is running ldirectord and is also a real server. sles10vm4 (192.168.40.135) is a real server. All services will be available from the virtual IP address of 192.168.40.222. I've been able to create an active/passive setup using heartbeat but I'd like to use round robin to have an active/active configuration. Once I'm happy ldirectord is working I'd like to use heartbeat to do failover of ldirectord. sles10vm3 has /etc/ha.d/ldirectord.conf ... sles10vm3:/etc # cat /etc/ha.d/ldirectord.cf checktimeout=3 checkinterval=5 autoreload=yes logfile="/var/log/ldirectord.log" quiescent=no virtual=192.168.40.222:25 emailalert="root" fallback=127.0.0.1:25 real=192.168.40.134:25 gate real=192.168.40.135:25 gate service=smtp scheduler=rr protocol=tcp When I start up ldirectord I see .. sles10vm3:/etc # clear;ldirectord -d /etc/ha.d/ldirectord.cf start DEBUG2: Running exec(/usr/sbin/ldirectord -d /etc/ha.d/ldirectord.cf start) Running exec(/usr/sbin/ldirectord -d /etc/ha.d/ldirectord.cf start) DEBUG2: Invoking ldirectord invoked as: /usr/sbin/ldirectord /etc/ha.d/ldirectord.cf start Invoking ldirectord invoked as: /usr/sbin/ldirectord /etc/ha.d/ldirectord.cf start DEBUG2: Starting Linux Director v1.143 with pid: 12602 Starting Linux Director v1.143 with pid: 12602 DEBUG2: Running system(/sbin/ipvsadm -A -t 192.168.40.222:25 -s rr ) Running system(/sbin/ipvsadm -A -t 192.168.40.222:25 -s rr ) DEBUG2: Added virtual server: 192.168.40.222:25 Added virtual server: 192.168.40.222:25 DEBUG2: Running system(/sbin/ipvsadm -a -t 192.168.40.222:25 -r 127.0.0.1:25 -g -w 1) Running system(/sbin/ipvsadm -a -t 192.168.40.222:25 -r 127.0.0.1:25 -g -w 1) DEBUG2: Added fallback server: 127.0.0.1:25 ( x 192.168.40.222:25) (Weight set to 1) Added fallback server: 127.0.0.1:25 ( x 192.168.40.222:25) (Weight set to 1) DEBUG2: Disabled server=192.168.40.135 DEBUG2: Disabled server=192.168.40.134 DEBUG2: Checking negotiate: real server=negotiate:smtp:tcp:192.168.40.134:25::::\/: (virtual=tcp:192.168.40.222:25) DEBUG2: Checking http: server=192.168.40.134 port=25 DEBUG2: Running system(/sbin/ipvsadm -a -t 192.168.40.222:25 -r 192.168.40.134:25 -g -w 1) Running system(/sbin/ipvsadm -a -t 192.168.40.222:25 -r 192.168.40.134:25 -g -w 1) DEBUG2: Added real server: 192.168.40.134:25 ( x 192.168.40.222:25) (Weight set to 1) Added real server: 192.168.40.134:25 ( x 192.168.40.222:25) (Weight set to 1) DEBUG2: Running system(/sbin/ipvsadm -d -t 192.168.40.222:25 -r 127.0.0.1:25) Running system(/sbin/ipvsadm -d -t 192.168.40.222:25 -r 127.0.0.1:25) DEBUG2: Deleted fallback server: 127.0.0.1:25 ( x 192.168.40.222:25) Deleted fallback server: 127.0.0.1:25 ( x 192.168.40.222:25) DEBUG2: Enabled server=192.168.40.134 DEBUG2: Checking negotiate: real server=negotiate:smtp:tcp:192.168.40.135:25::::\/: (virtual=tcp:192.168.40.222:25) DEBUG2: Checking http: server=192.168.40.135 port=25 DEBUG2: Running system(/sbin/ipvsadm -a -t 192.168.40.222:25 -r 192.168.40.135:25 -g -w 1) Running system(/sbin/ipvsadm -a -t 192.168.40.222:25 -r 192.168.40.135:25 -g -w 1) DEBUG2: Added real server: 192.168.40.135:25 ( x 192.168.40.222:25) (Weight set to 1) Added real server: 192.168.40.135:25 ( x 192.168.40.222:25) (Weight set to 1) DEBUG2: Enabled server=192.168.40.135 DEBUG2: Checking negotiate: real server=negotiate:smtp:tcp:192.168.40.134:25::::\/: (virtual=tcp:192.168.40.222:25) DEBUG2: Checking http: server=192.168.40.134 port=25 DEBUG2: Enabled server=192.168.40.134 DEBUG2: Checking negotiate: real server=negotiate:smtp:tcp:192.168.40.135:25::::\/: (virtual=tcp:192.168.40.222:25) DEBUG2: Checking http: server=192.168.40.135 port=25 DEBUG2: Enabled server=192.168.40.135 DEBUG2: Checking negotiate: real server=negotiate:smtp:tcp:192.168.40.134:25::::\/: (virtual=tcp:192.168.40.222:25) DEBUG2: Checking http: server=192.168.40.134 port=25 DEBUG2: Enabled server=192.168.40.134 DEBUG2: Checking negotiate: real server=negotiate:smtp:tcp:192.168.40.135:25::::\/: (virtual=tcp:192.168.40.222:25) DEBUG2: Checking http: server=192.168.40.135 port=25 DEBUG2: Enabled server=192.168.40.135 DEBUG2: Checking negotiate: real server=negotiate:smtp:tcp:192.168.40.134:25::::\/: (virtual=tcp:192.168.40.222:25) DEBUG2: Checking http: server=192.168.40.134 port=25 DEBUG2: Enabled server=192.168.40.134 DEBUG2: Checking negotiate: real server=negotiate:smtp:tcp:192.168.40.135:25::::\/: (virtual=tcp:192.168.40.222:25) DEBUG2: Checking http: server=192.168.40.135 port=25 DEBUG2: Enabled server=192.168.40.135 DEBUG2: Checking negotiate: real server=negotiate:smtp:tcp:192.168.40.134:25::::\/: (virtual=tcp:192.168.40.222:25) DEBUG2: Checking http: server=192.168.40.134 port=25 DEBUG2: Enabled server=192.168.40.134 ipvsadm shows ... sles10vm3:~ # ipvsadm -L -n IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn TCP 192.168.40.222:25 rr -> 192.168.40.135:25 Route 1 0 0 -> 192.168.40.134:25 Local 1 0 0 At this point I can telnet to port 25 of the virtual IP address and get connected ... sles10vm3:~ # telnet 192.168.40.222 25 Trying 192.168.40.222... Connected to 192.168.40.222. Escape character is '^]'. 220 sles10vm3.anix.com ESMTP Postfix helo sles10vm3 250 sles10vm3.anix.com quit 221 Bye Connection closed by foreign host. So ldirectord has redirected me to sles10vm3. As I've configured round robin I'd expect ldirectord to re-direct me to sles10vm4 for the next test ... sles10vm3:~ # telnet 192.168.40.222 25 Trying 192.168.40.222... Connected to 192.168.40.222. Escape character is '^]'. 220 sles10vm3.anix.com ESMTP Postfix helo sles10vm3 250 sles10vm3.anix.com quit 221 Bye Connection closed by foreign host. ... which it doesn't. I know that the SMTP server is working ... sles10vm3:~ # telnet sles10vm4 25 Trying 192.168.40.135... Connected to sles10vm4. Escape character is '^]'. 220 sles10vm4.anix.com ESMTP Postfix helo sles10vm4 250 sles10vm4.anix.com quit 221 Bye Connection closed by foreign host. My next test was to stop postfix on sles10vm3 to see if ldirectord would pick this up and begin re-directing to sles10vm4. sles10vm3:~ # /etc/init.d/postfix stop Shutting down mail service (Postfix) done It looks like ldirectord picked up that change ... \/: (virtual=tcp:192.168.40.222:25) DEBUG2: Checking http: server=192.168.40.135 port=25 DEBUG2: Enabled server=192.168.40.135 DEBUG2: Checking negotiate: real server=negotiate:smtp:tcp:192.168.40.134:25::::\/: (virtual=tcp:192.168.40.222:25) DEBUG2: Checking http: server=192.168.40.134 port=25 DEBUG2: Running system(/sbin/ipvsadm -d -t 192.168.40.222:25 -r 192.168.40.134:25) Running system(/sbin/ipvsadm -d -t 192.168.40.222:25 -r 192.168.40.134:25) DEBUG2: Deleted real server: 192.168.40.134:25 ( x 192.168.40.222:25) Deleted real server: 192.168.40.134:25 ( x 192.168.40.222:25) DEBUG2: Disabled server=192.168.40.134 DEBUG2: Checking negotiate: real server=negotiate:smtp:tcp:192.168.40.135:25::::\/: (virtual=tcp:192.168.40.222:25) DEBUG2: Checking http: server=192.168.40.135 port=25 DEBUG2: Enabled server=192.168.40.135 DEBUG2: Checking negotiate: real server=negotiate:smtp:tcp:192.168.40.134:25::::\/: (virtual=tcp:192.168.40.222:25) DEBUG2: Checking http: server=192.168.40.134 port=25 DEBUG2: Disabled server=192.168.40.134 sles10vm3:~ # ipvsadm -L -n IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn TCP 192.168.40.222:25 rr -> 192.168.40.135:25 Route 1 0 0 sles10vm2:~ # telnet 192.168.40.222 25 Trying 192.168.40.222... telnet: connect to address 192.168.40.222: Connection refused I've checked the mail logs on the remaining active SMTP server and can't see any connection being from another VM I've running to the virtual IP. (This VM works when I telnet to the real address) If I restart postfix it works ... sles10vm3:~ # /etc/init.d/postfix status Checking for service Postfix: running sles10vm2:~ # telnet 192.168.40.222 25 Trying 192.168.40.222... Connected to 192.168.40.222. Escape character is '^]'. 220 sles10vm3.anix.com ESMTP Postfix quit 221 Bye Connection closed by foreign host. sles10vm3:/etc/ha.d # ipvsadm -L -n IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn TCP 192.168.40.222:25 rr -> 192.168.40.134:25 Local 1 0 0 -> 192.168.40.135:25 Route 1 0 0 I've the following RPM installed .. sles10vm3:~ # rpm -qa | grep ldir heartbeat-ldirectord-2.0.7-1.3 So my questions ... 1) Why didn't round robin work? 2) Why did ldirectord not redirect when I shut down the SMTP server? I've already searched the mail archives but having only just started using ldirectord I'm a still a little unsure of some of the configuration options so thought it best to ask early on. Many thanks. Anthony. Anix Group Ltd (Registered in England and Wales; company no. 2367983; VAT no. 674406133). Registered Office: 100 Fetter Lane, London, EC4A 1BN This email has been scanned for viruses and message content by Anix Group Ltd. _______________________________________________ Please read the documentation before posting - it's available at: http://www.linuxvirtualserver.org/ LinuxVirtualServer.org mailing list - [email protected] Send requests to [email protected] or go to http://lists.graemef.net/mailman/listinfo/lvs-users _______________________________________________ Please read the documentation before posting - it's available at: http://www.linuxvirtualserver.org/ LinuxVirtualServer.org mailing list - [email protected] Send requests to [email protected] or go to http://lists.graemef.net/mailman/listinfo/lvs-users
