Nov 262009
 

It seems ipvsadm does not do health check, etc., so I turned to keepalived. While keepalived is doing great job on adding live node back and removing dead node out, it does not have a good way to dump current rules and stats, also it has problem during startup time.

I think latest keepalived may have solved the problem though I haven’t tried yet. If it works fine I will leave ipvsadm installed to be the utility tool only (i.e. disable service coming from ipvsadm).

I will look around to see if there is anything else similar to keepalived or not, it should be, I think.

Nov 252009
 

Playing with LVS – so that I don’t have to connect to individual Cassandra server.

What I planned for LVS:

  • 192.168.1.99 will be VIP
  • f5 (192.168.1.205) will be LVS director … you are right, its name is f5 ๐Ÿ˜‰
  • f1 (192.168.1.101) to f4 (192.168.1.104) will be real server
  • will do DR mode (I think it is called single-B on most L4 switches …)

The configuration is actually pretty simple, as long as you get it right, on LVS director (f5):

  • Configure VIP to eth0:0 as an alias, netmask should be 255.255.255.255, broadcast is VIP itself
  • Add following rules with ipvsadm (yea … you need to install this package)
    -A -t 192.168.1.99:9160 -s wlc
    -a -t 192.168.1.99:9160 -r 192.168.1.101:9160 -g -w 1
    -a -t 192.168.1.99:9160 -r 192.168.1.102:9160 -g -w 1
    -a -t 192.168.1.99:9160 -r 192.168.1.103:9160 -g -w 1
    -a -t 192.168.1.99:9160 -r 192.168.1.104:9160 -g -w 1
  • Start LVS (after restart network to make sure VIP is effective) by “ipvsadm –start-daemon master”
  • If you want to stop LVS you can do “ipvsadm –stop-daemon master”

Now let’s turn to real servers – all real servers (f1~f4) are doing the same:

  • Add these lines to /etc/sysctl.conf and then do a “sysctl -p”
    net.ipv4.conf.dummy0.arp_ignore = 1
    net.ipv4.conf.dummy0.arp_announce = 2
    net.ipv4.conf.all.arp_ignore = 1
    net.ipv4.conf.all.arp_announce = 2
  • Configure VIP to dummy0 as an alias, netmask should be 255.255.255.255, broadcast is VIP itself
  • Change ThriftAddress in storage-conf.xml for Cassandra, to 0.0.0.0 so that Thrift serves on all interfaces
  • Remember to restart Cassandra so to make new configuration takes effect

Now, launch your favorite client, connecting to 192.168.1.99:9160, you should get everything as if connect to individual server.