Reputation: 2387
I have a mongodb replica set. Data file sizes are quite big because there is many write operations. One mongodb node crashed because of lack of disk space because one diaglog file was 38GB.
Is there any way that diaglog files didn't get so big and instead it created multiple small(2GB or 4GB) files and then i would be able to delete unused ones?
Upvotes: 1
Views: 2526
Reputation: 65303
The diaglog
parameter is not required for replica sets. It creates a very verbose log for troubleshooting purposes, and should definitely not be enabled by default.
You can safely remove this parameter from your mongod
configuration and also remove the diaglog.* files in your dbpath
.
I suspect you are confusing the diaglog
output with the replication oplog
(operations log). The oplog
is stored in the local
database in a collection called oplog.rs
, and is preallocated when you initialise your replica set. The oplog size is 5% of free disk space by default for most 64-bit operating systems; there are some exceptions for OS X and 32-bit systems as noted in the MongoDB manual.
Upvotes: 1
Reputation: 151072
The files should only be present where there server is a config server or where the command line option has been explicitly set when starting mongod.
--configsvr or --diaglog
As this is intended for diagnosing specific problems you probably don't want this turned on all the time. In which case, remove the --diaglog
option from startup unless you specifically put it there.
So the point is, the --diaglog
option exists for the purpose of very verbose logging in order for you di diagnose problems. It should not be generally used in production environments.
If you really want it, then you are looking at log rotation and archiving methods that are a bit out of scope for the type of questions asked here.
See the documentation.
Upvotes: 2