Error repairing MongoDB database - Verify failed on uri table - mongodb

Suddenly my mongodb server has stopped working on my Mac and I just try to start it again It'll throw me an error described here https://jira.mongodb.org/browse/WT-4135.
So run a database repair and I keep getting this error,
2018-06-19T13:18:38.428+0530 I STORAGE [initandlisten] repairDatabase pdg_db
2018-06-19T13:18:38.428+0530 I STORAGE [initandlisten] Repairing collection ipd_db.app_sessions
2018-06-19T13:18:38.428+0530 I STORAGE [initandlisten] Verify failed on uri table:collection-1--4208304830224804148. Running a salvage operation.
2018-06-19T13:18:38.428+0530 F - [initandlisten] Invariant failure rs.get() src/mongo/db/catalog/database_impl.cpp 226
So I can't even start the server. As my understanding if I drop pdg_db this issue will be solved. But how to drop database without running the mongodb server? Is there any other way to do this?
Thanks

Related

How to repair MongoDb when someone deleted one database directory from the db directory?

One guy deleted one Database directory from the dbpath of MongoDb as we configured --directoryperdb.
Is there any option to ignore that database and I can start the server. Currently mongod --repair giving
2020-04-22T15:19:56.118+0000 E STORAGE [initandlisten] WiredTiger error (2) [1587568796:118648][22758:0x7fd9688ad580], file:Test/collection-556-3480094503407958
80.wt, WT_SESSION.salvage: /home/dbdir/db/Test/collection-556-348009450340795880.wt: handle-open: open: No such file or directory
2020-04-22T15:19:56.121+0000 I - [initandlisten] Invariant failure rs.get() src/mongo/db/catalog/database.cpp 195
And when trying to start the server It is giving segmentation fault. Is there any way I can fix the database.
Test is the database that was deleted?
After making a backup, grep the remaining tree for other files that reference it and try to delete those as well.

Unable to start mongod with one missing collection wt file

I have a working mongod instance (v3.2.21).
But suddenly it stopped working. When i run mongo command it is throwing me following error:
2019-06-04T13:52:41.725+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
When i checked log its showing:
2019-06-04T13:36:43.388+0000 E STORAGE [initandlisten] WiredTiger (2) [1559655403:388180][8404:0x7fb74e904c80], file:collection-1-1305830686620002691.wt, WT_SESSION.open_cursor: /mnt/volume-fra1-01//collection-1-1305830686620002691.wt: handle-open: open: No such file or directory
2019-06-04T13:36:43.388+0000 E STORAGE [initandlisten] no cursor for uri: table:collection-1-1305830686620002691
2019-06-04T13:36:43.388+0000 F - [initandlisten] Invalid access at address: 0x58
2019-06-04T13:36:43.398+0000 F - [initandlisten] Got signal: 11 (Segmentation fault).
The collection which was earlier there is now missing in data directory
I tried to use --repair but the process gets stop at this collection.
I have looked at various resources but couldn't figure out how to make it working? Is there way so that wiredtiger escape this collection?
MongoD 4.0.3 and newer has better repair facilities as per SERVER-19815.
One thing you can try:
Copy your original dbpath so if the attempt is not successful, you don't clobber your original data
Download the 4.0.3 binaries (or newer, currently the latest is 4.0.10)
mongod --repair using the 4.0.3 binaries to attempt to repair the copied dbpath
If the repair is successful, try to run the 3.2.21 binaries pointing to the repaired dbpath
Please note that this repair attempt is best-effort and there's no guarantee of success. Having an up-to-date backup is still recommended. You might also want to investigate how the dbpath is missing a file to begin with.

MongoDB learning issue

Greetings I am learning mongodb and have encountered with following issue. I am pretty newbie in all of that and dived to into meanstack development after spending some hours messing with setups, I decided to spend some time learning first before doing something and found great corse of mongodb on their official website, following their lessons I cant start mongo server as it says I have already started it somewhere... :)
Error message:
2015-10-13T21:55:01.900+0200 E NETWORK [initandlisten] listen(): bind() failed errno:48 Address already in use for socket: 0.0.0.0:27017
2015-10-13T21:55:01.900+0200 E NETWORK [initandlisten] addr already in use
2015-10-13T21:55:01.912+0200 W - [initandlisten] Detected unclean shutdown - /data/db/mongod.lock is not empty.
2015-10-13T21:55:01.935+0200 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
2015-10-13T21:55:01.935+0200 I CONTROL [initandlisten] dbexit: rc: 100
Can you please explain how can I find and remove that one or at least shut it down?
There may be already a mongodb instance running. Check it with below command.
ps -ef | grep 'mongo'
You can shutdown existing mongod instance using: http://docs.mongodb.org/master/tutorial/manage-mongodb-processes/#use-shutdown
mongod --shutdown
If no instance is running then go to the data location and remove the lock file.
cd /data/db/
sudo rm mongod.lock
Note: This is only for learning / local machine. This process might not be suitable for production.

MongoDB does not start after installing first time

I am trying to install MongoDB first time on my Windows 7 machine. I am installing it to default location (c:/).
When I execute the mongod.exe first time, I get the message 'the waiting for connections message in the console'. The documentation of MongoDB asks to connect on another cmd prompt and execute mongod.exe again.
When I do this I get the following message:
C:\Program Files\MongoDB\Server\3.0\bin>mongod.exe
2015-09-04T11:31:23.880+0530 I CONTROL Hotfix KB2731284 or later update is not installed, will zero-out data files
2015-09-04T11:31:23.905+0530 W - [initandlisten] Detected unclean shutdown - C:\data\db\mongod.lock is not empty.
2015-09-04T11:31:23.907+0530 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file:
C:\data\db\mongod.lock errno:32 The process cannot access the file because it is being used by another process.. Is a mo
ngod instance already running?, terminating
2015-09-04T11:31:23.907+0530 I CONTROL [initandlisten] dbexit: rc: 100
C:\Program Files\MongoDB\Server\3.0\bin>mongod.exe
2015-09-04T11:33:52.437+0530 I CONTROL Hotfix KB2731284 or later update is not installed, will zero-out data files
2015-09-04T11:33:52.442+0530 W - [initandlisten] Detected unclean shutdown - C:\data\db\mongod.lock is not empty.
2015-09-04T11:33:52.445+0530 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file:
C:\data\db\mongod.lock errno:32 The process cannot access the file because it is being used by another process.. Is a mo
ngod instance already running?, terminating
2015-09-04T11:33:52.445+0530 I CONTROL [initandlisten] dbexit: rc: 100
P.S.: I have created /data/db in C:/.
Well, I just faced the same issue. I installed the fix, but saw nothing but same error. So that's how I got over it: just create a folder structure in your C catalog like this one: C:\data\db. So it worked for me perfectly. I use Windows 7 x64.

Mongodb not working properly : Socket already in use?

I am taking the mongodb university class and having problems getting mongod to work properly. I have been trying for hours to try to get it to work properly, but I keep getting the same error.
When I try to run mongod I am getting this error:
erics-mbp:~ emlandst$ mongod --dbpath data
2015-08-16T18:55:24.186-0400 E NETWORK [initandlisten] listen(): bind() failed errno:48 Address already in use for socket: 0.0.0.0:27017
2015-08-16T18:55:24.186-0400 E NETWORK [initandlisten] addr already in use
2015-08-16T18:55:24.186-0400 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory data not found., terminating
2015-08-16T18:55:24.186-0400 I CONTROL [initandlisten] dbexit: rc: 100
If I am correct the server is set to run on port 27017 by default and for some reason it is being blocked. I tried the ps waux | grep mongo and then I killed the instance, but still i get the same error.
I am trying to just delete everything so I can start all over, but I have no idea how to do that. I'm sure it is simple I just don't have a lot of experience. Thank you