How to get the number of current servers which are not down from the c++ client

20 views
Skip to first unread message

gmail

unread,
Jul 27, 2012, 1:37:42 AM7/27/12
to mongodb-user
Hi:
when I use replica set , and make w=3 when use the c++ client to insert data , if one of the mongod down ,How to get the number of current servers which are not down from the c++ client ?
 

gmail

Kristina Chodorow

unread,
Jul 30, 2012, 10:55:17 AM7/30/12
to mongod...@googlegroups.com, fly542
There's no automatic way.  You would have to call isMaster on the primary and then try to connect to each of the hosts in the host list.  

That is one reason we have the w="majority" option: it has almost the same safety properties as w=(total # of members) but will still work if a node is down.
Reply all
Reply to author
Forward
0 new messages