Run mongodb from a read-only storage device?

I have a use case that requires all of the mongodb data directory to be on read-only media.
Is it possible to run mongo server from such a configuration? (Any chance just disabling journalling and logging would be enough?)

Hi @Nick_L1 & welcome!

To answer the question, as I understand, it should be possible to run MongoDB on a read-only media. You will need to set the correct directories for read and separately for write. Expectedly, features that require write access such as journaling would return errors in a read-only media.

In checking with Google Gemini and MongoDB AI Chatbot, there’s a warning on data integrity & read performance degradation.

I’m wondering what’s the use case, if you can share.

This use case will have no write requests–the client will only ever read from the data.
Can you be more specific about what configuration changes may be required to make sure the server doesn’t error and stop working?

Hi @Nick_L1

While the WiredTiger engine can be configured for read only mongod relies on functionality that is not provided in when running in this configuration.

An alternative may be using an union/overlay filesystem(overlay or aufs) in combination with the read only media. A quick test in my environment results in a working database.

1 Like

The device will be read-only–union/overlay fs is not an option. What other side effects does mongod attempt that needs a place to be writeable? I need to be able to disable this.

This is not a matter of configuration changes, this would be a very large rewrite of MongoDB code base.