mongodb is not start after restoring /var/lib/mongodb manually - mongodb

Our server's raid failed today. Right now we have a zip file of mongodbPath but after we extract it, we can not start mongo db again.
I will appreciate any help.

After a lot of searches and contacting with MongoDB's support we fond out that we rsync MongoDB directory when it was writing.
So we cannot restore data and we had data lost!
If you want to use rsync for getting backup of MongoDB you should stop it.
This may help.

Related

How to restore mongo db data from old files?

my server crashed... I don't have a recent backup but I do have access of the files. I'm wondering If I can restore data from the old mongodb folder? any suggestions?
You can get query logs mongodb.log file if your profiling level set for logging any queries. If not, you can't restore.

How to mongo restore from atlas backup files?

I tried to restore mongo backup files from atlas.
It's containing some wt files. How to restore.
Backup downloaded from Daily Snapshots from atlas.
Thanks in advance.
Solved this.
link
Atlas compresses the snapshot into a .tar.gz file. This archive includes the snapshot and the mongod logs.
Once extracted, you can access the data files by starting a mongod instance on the host and pointing it at the extract directory using the --dbpath option.

Use mongodb data/db data files for restore

Our server is down and have no backups on our dbs. But we were able to get data/db using WinSCP. It would be fortunate if we could use these data files to restore our dbs. I have tried setup mongodb in other server and copied data/db from failed server. As I started mongod instance in the new server it says a compatibility issue with authentication schema that data files from data/db was. So we cannot start mongod. I wonder if there's a work around so we can start a mongod with the old data/db from failed server? Or other way to restore dbs? Thank you very much.

should I let mongodb make use of the new hard disk in this way?

I have a mongodb v2.4.6 running on ubuntu 13.04. It is known that mongodb store all data in /var/lib/mongodb. Now the mongodb is running out of the hard disk. Fortunately, I got a new hard disk which is installed, fdisked, formated and got a name /dev/sda3. Unfortunately I don't know how to let the mongodb make use of the new hard disk because my knowledge on ubuntu and mongodb is very limited. After some research in internet, it seems that I should execute the following command
sudo mount /dev/sda3 /var/lib/mongodb
Is this what I need to do to let mongodb use the new disk? If so, will mongodb automatically and intelligently increase its data to this disk? Is there any othere things I should do? Thank you.
Unfortunately this one will not be that straightforward. Even if you succeed with the mounting it will not move the files at all. What you can do is to
mount the disk elsewhere (mkdir /var/lib/mongodb1, mount /dev/sda3 /var/lib/mongodb1)
stop mongo
copy the files from /var/lib/mongodb to /var/lib/mongodb1 (only helps if the new disk is bigger)
reconfigure mongo to use as db dir the new directory or swap the names with mv commands
start mongo
if everything went fine, mongo started and so on,(check it first!!!) you can delete the old data.
If you have a disk which is the same size so with moving the data you will run into the same problem, if you need larger space then a single disk you should play around with RAID and/or LVM and more disks.

MongoDB db files movement

I am using mongodb and I have changed the dbpath. Can I just copy all the files from the earlier dbpath to the new dbpath?
PS: I have come across the mongodump alternative which might be a bit tedious. So I am interested in knwoing whether plain copying work?
Yes, you can just do a normal copy if you shutdown your mongod first. You don't need to copy mongod.lock.