Reputation
3,119
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
7 32
Newest
 Revival
Impact
~120k people reached

Mar
24
comment Expanding HAProxy health check to monitor MongoDB primary and secondary state
I wrote the original answer and if I was going to attempt this, it would be using the isMaster command - that is what the drivers use, it doesn't require authentication, or take a lock etc. You would be looking for the boolean located here to be true for writes, false for secondary reads: docs.mongodb.org/manual/reference/command/isMaster/… Not sure how this would actually be useful though, given how the drivers work.
Feb
11
revised What causes SocketException (9001) handling request in node.js app and MongoDB ReplicaSet?
added mtools option for graphing connection churn
Feb
11
awarded  Revival
Jan
31
answered Change mongo data directory for a specific database
Jan
24
awarded  Yearling
Jan
3
comment mongo shard has high number of faults, but top shows only 8% of memory used by mongod
sync just makes sure that data is flushed to disk, and free is just reporting, so really the drop_caches piece is the only relevant piece and that effectively just drops all caches (for non-running processes only), it doesn't really have anything to do with hard/soft faulting besides the fact that if you do it while mongod is not running it will mean all data will need to be paged from disk when you restart it. I suppose with a kernel in a bad state it might help, but I think you would have other issues at that point too
Jan
3
comment mongo shard has high number of faults, but top shows only 8% of memory used by mongod
On Linux, the faults reported in mongostat are in fact hard faults to disk. Soft faults are not reported (except on Windows when both are reported), so most of the rest of the argument that follows in your answer doesn't hold.
Dec
21
awarded  Civic Duty
Dec
16
comment adding mongodb authentication breaks connecting via nodejs
two things: First, please post a code sample so that (at a minimum) others can try this out and debug. Second, can you connect with that user from the shell and run the operations you want from the shell? Finally, if this a code issue, then this may be more appropriate for StackOverflow than Serverfault
Dec
10
answered Readahead for /var/lib/mongo is set to 4096KB
Dec
4
answered mongorestore with indexing in foreground
Nov
28
awarded  Constituent
Nov
24
answered Is mongorestore ditrectly to a path with the --dbpath faster than restoring to a running mongod instance?
Nov
17
awarded  Caucus
Nov
7
answered MongoDB copyDatabase command succsefasully copies database, but gives me a different size on the ner server
Oct
7
comment Background indexing MongoDB on server
for reference, you can check to see if the index build is still running on the mongod by running db.currentOp() from the mongo shell or by looking in the logs for that instance (it will log index build progress periodically and give you a percentage completion figure).
Oct
1
comment How to start Mongo daemon with auth support
You should ask a new question and detail what versions (of OS, MongoDB) you are using, the error you are getting, and what your config looks like. There was no problem when I did the procedure above, so it's basically likely that the problem was user error or similar since the issue is not reproducible.
Sep
30
awarded  Explainer
Sep
14
comment mongodb keep looping while trying to sync data
ulimits might be the cause, if the primary is seeing a significant number of connections - the best way to find out is to increase the number and see if that solves the issue (or look at the available connections in db.serverStatus(). Without some detailed troubleshooting all we can do is guess at the root cause of the connection problems
Sep
12
answered mongodb keep looping while trying to sync data