I'm working on setting up auto failover on the whole stack of my website, which includes mongodb. For the time being, I utilize heartbeat to detect failure of the primary mongos and then change the host name on client side to point to the secondary mongos, which means secondary takes over and become primary. The client always talks to the primary.By the way, I do not use virtual ip because the two mongos locate in different sites.
But as heartbeat only moniters the system's availability, not the application's, I believe this may not be quite reliable. mongos may die with the system still being up. I wonder if there is some kind of mechanism that enables "heartbeat" between mongos processes.