I have created a mongod replica cluster of 2 nodes , mongo1 and mongo2. to load balance I have added following rule in my haproxy
listen mongo_replica_cluster bind *:27017 mode tcp balance roundrobin server mongo1 10.2.0.12:27017 check inter 10s fall 3 rise 99999999 server mongo2 10.2.0.11:27017 check backup
but if the mongo1 goes down mongo2 becomes the primary but even if mongo1 comes up mongo2 remains primary but ha redirect all traffic to mongo1 which is slave now. I want to redirect all my traffic to only the primary node.