Mongodb, running on an Ubuntu 12.04 box, decided to dump core because it opened too many files (applause). After running mongod --repair
as root as http://docs.mongodb.org/manual/tutorial/recover-data-following-unexpected-shutdown/ alluded to (but didn't specify), I now find that mongo has apparently whacked out its own file permissions somehow - every time I try to start I get
Mon Apr 1 15:10:08 [initandlisten] options: { bind_ip: "127.0.0.1", config: "/etc/mongodb.conf", dbpath: "/var/lib/mongodb", logappend: "true", logpath: "/var/log/mongodb/mongodb.log", nojournal: "true" }
Mon Apr 1 15:10:09 [initandlisten] couldn't open /var/lib/mongod/cerebro_test_import_ayp_part2.ns errno:1 Operation not permitted
Mon Apr 1 15:10:09 [initandlisten] error couldn't open file /var/lib/mongodb/cerebro_test_import_ayp_part2.ns terminating
"Operation not permitted"? Really? Even after
$ sudo chmod -R 777 /var/lib/mongodb
? I'm a couple of millimeters away from just blowing this whole database away and chalking it up as yet another reason Mongo sucks. What can I do to get mongo happy again so I don't have to do that? What haven't I tried? What gives?
Restoring MongoDB From a Backup There are basically two ways you can use a BSON format dump: Run mongod directly from the backup directory. Run mongorestore and restore the backup.
Starting in MongoDB 4.4, for the WiredTiger storage engine, mongod --repair : Rebuilds all indexes for collections with one or more inconsistent indexes. Discards corrupt data. Creates empty/stub files for missing data/metadata files.
No. From mongorestore: If you restore to an existing database, mongorestore will only insert into the existing database, and does not perform updates of any kind. If existing documents have the same value _id field in the target database and collection, mongorestore will not overwrite those documents.
You should just be able to do mongorestore --gzip <path to gzip folder). Side note you can use mongodump with --gzip option and it will compress it for you.
Did you try
sudo chown -Rh mongodb:mongodb /var/lib/mongod*
?
This has all the hallmarks of a Linux permissions problem, chmod'ding 777 is always a bad idea.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With