简体   繁体   中英

how to check which replica set is read in mongodb

I setup a mongodb replica set, and i have tested the insert operation, the secondary server can sync with the primary. Now, I want to check where i do the read operation, which server is handling the request. How can I check it? in mongodb log? or somewhere else.

Btw: My driver is Mongoid. many thanks

Use mongostat --discover . This will show you the statistics for all members in the replica set. When a read is performed you can see which member is servicing the request.

Note that reads will only go to the non-primary member if your queries use slaveOk

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM