After a complete reinstall of mongo, it has still remembered the replica set configuration from before; where has it stored this?
I installed mongo on a linux server, using our project's user account, into a directory owned by that user. I set up replication and had it working fine. Then, to test out some finer install points, I removed the whole mongo directory and did a reinstall. Entering into mongo, I found that the replication was already set up as before; so it would appear that mongo is storing the information somewhere.
I have checked several areas which might have been holding the replica set config:
systemLog.path
) and the other for storage (storage.dbPath
), and the both point to the mongo directory, which was deleted.Does anyone know where mongo is storing this configuration information?
The replication data is stored in the local database in each node (as of MongoDB 3.2.9). This database contains information about the replica set, and also contains the oplog (the oplog.rs
collection). The replica set information is stored in the system.replset
collection in this local
database.
The physical files for this database (and also for other databases) are stored in the dbPath directory, which can be configured using:
--dbpath
parameter when starting mongod
storage.dbPath
setting in the configuration fileThe default dbpath
value is /data/db
Your replica set setting will not be retained if you emptied the dbpath
directory. If you find that the replication settings are being retained, it is possible that the dbpath
setting is incorrect.