2

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?

Jakob Kenda
  • 368
  • 1
  • 3
  • 12

1 Answers1

1

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)

Andriy Simonov
  • 1,276
  • 1
  • 11
  • 19
  • Note that `dur` is for the MMAPv1 storage engine, which is deprecated as of mongoDB 4.0 – Muhd Dec 26 '18 at 05:03