Why not just setup a resource in rgmanager (I'd say use pacemaker, but RedHat doesn't support that yet), and move the MySQL IP between the hosts, rather than messing around with IPVS?
David On 1/20/12 8:13 PM, Peter Scott wrote: > Hello. We are using the Redhat load balancing add-on that comes on RHEL > 6. We want to have highly available MySQL; we have two co-master MySQL > servers that replicate to each other. MySQL says that that updates > should only come in to one of these at a time because of the possibility > that conflicting updates arrive at each server simultaneously. So we > want to use LVS to direct all traffic to one of the co-masters (call it > mysql01) except when it is down, in which case to direct all traffic to > the other one (call it mysql02). > > We thought this requirement would be common enough to be addressable via > stock LVS capability. Our initial thought was to set the weight of > mysql01 to 1 and mysql02 to 0. However, new connections still went to > mysql02. We discovered > http://archive.linuxvirtualserver.org/html/lvs-users/2008-10/msg00101.html > and set the /etc/sysctl.conf parameters, also tried setting them via the > equivalent files in /proc/sys/net/ipv4/vs/, still connections went to > both servers even when we waited beyond the persistence timeout of 600s. > > Because of this behavior, we are not able to test whether our approach > is sound to begin with; i.e., if mysql01 goes down will traffic be > redirected to mysql02 even though its weight is 0? We thought that if > it was the only machine up in its group the weight would not matter. > But would like to know if that assumption was accurate also. > > Here's that section of our lvs.cf: > > virtual MySQL { > active = 1 > address = 192.168.185.115 eth0:6 > vip_nmask = 255.255.255.0 > fwmark = 3306 > port = 3306 > persistent = 600 > use_regex = 0 > load_monitor = none > scheduler = wlc > protocol = tcp > timeout = 6 > reentry = 15 > quiesce_server = 0 > server MySQL01 { > address = 192.168.185.51 > active = 1 > port = 3306 > weight = 1 > } > server MySQL02 { > address = 192.168.185.52 > active = 1 > port = 3306 > weight = 0 > } > } > > Would appreciate any advice. Thanks. > > _______________________________________________ > 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
