On Wednesday, May 23, 2012 11:57:14 PM Willy Tarreau wrote: > There is an option at the server level which is "on-marked-down > shutdown-session". It achieves exactly what you want, it will kill all > connections to a server which is detected as down.
Perfect! > > 2) If the master eventually comes back, all connections that ended up > > routing to the slave will stay on the slave indefinitely. The only > > solution I have for this is to restart mysql on the slave, which kicks > > everyone off causing them to reconnect and get routed back to the > > master. This is acceptable if restoring master required some kind of > > manual maintenance, since I'd already be getting my hands dirty anyway. > > However, if master disappears and comes back due to brief network outage > > that resolves itself automatically, it's unfortunate that I'd still have > > to manually react to this by kicking everyone off the slave. > > There is no universal solution for this. As haproxy doesn't inspect the > mysql traffic, it cannot know when a connection remains idle and unused. > Making it arbitrarily kill connections to a working server would be the > worst thing to do, as it would kill connections on which a transaction is > waiting for being completed. Well, the network could fail at anytime and have a similar effect. I'm not sure if killing all connections to the backup is really any worse than killing all connections to the non-backup (via on-marked-down). Either way a bunch of client errors may occur, but for a scenario that is hopefully rare. Maybe an "on-marked-up shutdown-backup-sessions" option would be good. Justin

