Reputation: 387
I want to find out if MongoDB journaling is enabled with a bash script.
Can I do that some other way than searching the config files, because that is not very reliable, I think.
Is mongo --eval "something"
possible?
Upvotes: 2
Views: 3978
Reputation: 1288
Yes you can, as long as you can parse a JSON document that mongo --eval "db.serverStatus()"
returns. Depending on which storage engine your server is configured, you may be interested in wiredTiger.log or dur field of the returned document. If journaling is turned off then values of all fields in wiredTiger.log are "0" or dur is absent altogether. (Also see documentation)
Upvotes: 1