MongoDB can not start after restart the system on Ubuntu 14.04 LTS - mongodb

I've installed mongoDB on ubuntu 14.04 according to the official installation guide: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
I enter the terminal using "mongod" and everything is OK.
But when I shut down my ubuntu and restart it, command 'mongod' just cannot start, one error happens below:
2015-01-30T15:47:51.582-0800 [initandlisten] allocator: tcmalloc
2015-01-30T15:47:51.582-0800 [initandlisten] options: {}
2015-01-30T15:47:51.583-0800 [initandlisten] exception in initAndListen: 10296
*********************************************************************
ERROR: dbpath (/data/db) does not exist.
Create this directory or give existing directory in --dbpath.
See http://dochub.mongodb.org/core/startingandstoppingmongo
*********************************************************************
, terminating
After that, I tried to create the folder and chmod it using:
sudo mkdir -p /data/db/
sudo chown `id -u` /data/db
but another error happened:
2015-01-30T16:01:43.855-0800 [initandlisten] allocator: tcmalloc
2015-01-30T16:01:43.855-0800 [initandlisten] options: {}
2015-01-30T16:01:43.859-0800 [initandlisten] journal dir=/data/db/journal
2015-01-30T16:01:43.859-0800 [initandlisten] recover : no journal files present, no recovery needed
2015-01-30T16:01:43.994-0800 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
2015-01-30T16:01:43.994-0800 [initandlisten] ERROR: addr already in use
2015-01-30T16:01:43.994-0800 [initandlisten] allocating new ns file /data/db/local.ns, filling with zeroes...
2015-01-30T16:01:44.197-0800 [FileAllocator] allocating new datafile /data/db/local.0, filling with zeroes...
I also looked for /etc/mongod.conf,
# Where to store the data.
# Note: if you run mongodb as a non-root user (recommended) you may
# need to create and set permissions for this directory manually,
# e.g., if the parent directory isn't mutable by the mongodb user.
dbpath=/var/lib/mongodb
#where to log
logpath=/var/log/mongodb/mongod.log
logappend=true
#port = 27017
where I found the default data storage folder is not /data/db
I've tried other ways like
sudo service mongod stop
sudo service mongod restart
But they simply do not work.
May be there's another instance already run when the system starts, but how can I stop it?

ERROR: addr already in use indeed means that you have another instance already running.
Did you try to:
type mongo in the terminal and see if it connects to the server?
check the logs in /var/log/mongodb/mongod.log? Do they tell you an instance is up?
type ps -edf | grep mongod and see if any process is running? I suppose it's not a good practice but did you try to kill it if one shows up, and type mongod again?
Aynway, you may want to try two things:
When you type sudo service mongod stop and before the sudo service mongod restart, try to type mongod in the terminal. As you normally stopped the running instance, you should be able to start your own
You could try to start another instance. For that, you will have to specify at least the port (and chose a different one than the default one), and preferably the dbpath (make sure to chose a path to a directory that already exists). You can do that on the command line, for example:
$ mongod --port 28000 --dbpath /path/to/your/db
Or you can create your own mongodb.conf, based on the default one, change the values for port and dbpath, and start mongod specifying the path to this config file:
$ mongod -f /path/to/your/mongod.conf

Related

why mongod is shows that attepted to create a lock file on a read-only directory

Attempted to create a lock file on a read-only directory: /data/db, terminating
2020-05-02T00:18:14.201+0530 I CONTROL [initandlisten] now exiting
2020-05-02T00:18:14.201+0530 I CONTROL [initandlisten] shutting down with code:100
/data/db is the default data directory path. This can be overridden with the --dbpath command-line argument, for example.
If you wish MongoDB to use this default directory to store its files, make it writable by the user that is running the mongod process. Otherwise use --dbpath to specify a different directory.

exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating

2019-05-21T14:25:54.799+0300 I CONTROL [initandlisten] options: {}
2019-05-21T14:25:54.800+0300 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating
2019-05-21T14:25:54.800+0300 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2019-05-21T14:25:54.800+0300 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2019-05-21T14:25:54.800+0300 I CONTROL [initandlisten] now exiting
2019-05-21T14:25:54.800+0300 I CONTROL [initandlisten] shutting down with code:100
How do I figure out about Data directory /data/db not found., terminating
The problem is that by default, Mongo points to that /data/db folder, and it either forgets to create or set ownership of it on installation.
sudo mkdir -p /data/db/
And then, we’ll set the ownership of the folder to the user that’s going to start the mongod service. Since I only use if for local development in my computer, I set myself as the owner:
sudo chown `id -u` /data/db
Now, just running mongod should do the job. Hope that helps you!
I ran into this same issue a few days ago. I am using Mac OS. Apparently, there was a permission problem with having my data directory in the root of my home folder. So what i did was i just created a directory in a folder in a location where i definitely have permissions and then ran mongo db with the the --dbpath option set to that location. for example:
mongod --dbpath ~/documents/data/db
Hope this helps :D
Just create a new folder in the data directory (the disk which was given in the error - for me, suggested to create these folders on the E disk).
First create data the create db folser in data. Then start mongod again.

Error with mongodb on mac permission denied

Hi I have problem when I run
mongod
This is what I got
2016-02-09T21:54:40.631-0700 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-02-09T21:54:40.633-0700 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
2016-02-09T21:54:40.633-0700 I CONTROL [initandlisten] dbexit: rc: 100
I try everything uninstall mongo. Install with brew. Uninstall with brew etc. Change the permission of my data folder and get always the same problem.
So this is what I did. I delete the /data/db folder after a recreate it with
sudo mkdir -p /data/db
Change the permission of data and db folder
mongod
everything working. My error was I didn't change the permission before I run mongod for the first time now everything is working fine.
I was having the same issues until I ran
sudo chown -R 'youruserid' /data/db
it seems some file(s) in the directory still had the wrong permissions.
I think I had a similar problem with my mongo install in my Mac. Have you tried changing the owner of /db/data?
You can check who owns this directory (where the databases are stored) by writing the following command in the terminal.
ls -al /data/db
If the owner (the name in the third column) is not your user, change it with a chown command or try running mongod with sudo.
I would first check to see if you have another instance of mongo running as it suggests. If you do not - remove the lock file in question and try to launch mongo again. It is possible the lock file is a remnant of a previous install.
systemctl enable mongod.service
Start mongod service at system startup
service mongod start

MongoDB won't start after server crash

My Ubuntu computer had crashed, and when I restarted it MongoDB wasn't working. I tried the following commands, and got the following output:
$ mongo
Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91
exception: connect failed
$ service mongodb status
mongodb stop/waiting
$ service mongodb restart
stop: Unknown instance:
start: Rejected send message, 1 matched rules; type="method_call",
sender=":1.57" (uid=1000 pid=2227 comm="start mongodb ")
interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)"
requested_reply="0"
destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")
$ tail /var/log/mongodb/mongodb.log
[initandlisten] exception in initAndListen: 12596 old lock file, terminating
dbexit:
[initandlisten] shutdown: going to close listening sockets...
[initandlisten] shutdown: going to flush diaglog...
[initandlisten] shutdown: going to close sockets...
[initandlisten] shutdown: waiting for fs preallocator...
[initandlisten] shutdown: closing all files...
[initandlisten] closeAllFiles() finished
dbexit: really exiting now
(Output reformatted to match website layout.)
What happened? How can I fix it?
The log file is telling you that you have an "old lock file". MongoDB keeps a lock file while it's running. It creates this file when it is started, and deletes it when it's stopped. When the computer crashes (or MongoDB crashes, e.g. via kill), this file is not deleted, and thus the database does not start. The existence of this file indicates unclean shutdown of MongoDB.
Two things can be done:
If this is a development machine and you haven't been using your database (and neither have your programs), you can remove the file manually. For MongoDB 2.2.2 running on Ubuntu 12.10, it's in /var/lib/mongodb/mongod.lock. For other versions, the file could be in a different path or it could be named mongo.lock.
The safer route is to follow MongoDB's Durability and Repair guide. In summary, for a machine with the above configuration, you should execute the following commands:
sudo -u mongodb mongod --repair --dbpath /var/lib/mongodb/
sudo service mongod start
all I had to do was run:
sudo mongod --repair
then:
sudo mongod
Based on my experience, I usually delete the "mongod.lock" file that is inside the database folder - In my case:
*I browse to where the database is installed on my ubuntu i.e. "data" folder.(cd data); list the files (ls)
*Then, I will remove the "mongod.lock" file that was automatically created when the database crashed, by issuing "rm mongod.lock" file.
After which I will either issue "./mongod" to start the mongo deamon or mongo to start the mongo shell. And everything will be fine.
Check to see if you have enough free space on your server. If there is no room left mongodb won't start.
If you did not use monitoring tools like Bluepill or Monit etc you will have to face this issue because after server crash due to some reason mongo didnot start its daemon automatically then you have to make it work manually, like sudo service mongod restart
I figured this issue but it needs some more tasks to be done, please make sure your dbpath at /etc/mongod.conf before starting your mongo daemon.
For me it was
storage:
dbPath: /var/lib/mongodb
When i enter mongod command it shows me MongoDB starting : pid=10795 port=27017 dbpath=/data/db 64-bit host=xyz.com make sure your dbpath is as same as mentioned in /etc/mongod.conf
To do this you can type sudo mongod --dbpath /var/lib/mongodb and then use mongod command to start your mongo process at your desired dbpath.
FYI: start your mongo process with mongod command
This is probably not the best solution, but if you're desperate you can try this. It seemed that only the journal was a problem for me, so I took these steps:
Create a new data directory. Possibly /var/lib/mongodb2
Update your mongod.conf to point to the new data dir.
Start mongoDB.
If it starts successfully, then you can shut down mongo again and proceed, otherwise you can stop reading here.
Locate your previous data dir and copy the files for your database(s) to your new data directory (example, admin.0 admin.1 admin.ns, etc)
Start mongoDB again (still using the new data directory)
After completing these steps (took less than 5 min), I was up and running and all data appeared to be ok.
Thank's guys. We also faced an issue where MongoDB was restarting over and over again an it was complaining about old lock file. I stopped MongoDB from Windows service list and then I deleted the mongod.lock file. After that I was able to start MongoDB service correctly and it worked fine.
Removing .lock file from mongo data directory dbpath works for me.
e.g sudo sudo rm {data-directory}/mongod.lock

Cannot start MongoDB as a service

I have been developing for MongoDB for some months now and would like to install it as a service on my Windows 7 Enterprise machine. The following is the command that I have executed to create the service:
"D:\Milvia Systems\Development\MongoDB\mongod.exe" --logpath "D:\Milvia Systems\Development\MongoDB\logs\DBLog.log" --logappend --dbpath "D:\Milvia Systems\Development\MongoDB\db" -vvv --reinstall
However, whenever I use net start "MongoDB" or the Service Control Panel I receive the following error:
Error 1053: The service did not respond to the start or control
request in a timely fashion.
Environment: Windows 7 Enterprise 64bit
MongoDB: 1.6.3 pdfile version 4.5
Have your checked you logging to see the real problem?
I suggest extracting the Mongo installation to c:\mongodb.
Create the c:\mongodb\logs and the c:\mongodb\data\db directories.
Then browse the the c:\mongodb\bin directory and run the following to remove the service (if you've installed it!):
mongod --remove
Then install the service, specifying the log and data directories:
mongod --logpath c:\mongodb\logs\mongo.log --dbpath c:\mongodb\data\db --directoryperdb --install
Then if there is a problem starting the service you should see the reason in the specified log file.
More info here.
If you did not specify absolute file paths for the data directory, or the log directory, you will get the same Windows error, but no log file.
I used the information from "Install MongoDB Service on Windows 7", pushed on Webiyo to correct the registered service arguments:
Download MongoDB and extract it to the C:\ drive.
Add "data" and "logs" subdirectories under the "C:\mongodb165" directory.
Add a log file name "mongolog.txt" at "C:\mongodb165\logs\mongolog.txt".
Change the directory to "C:\mongodb165\bin".
Execute the following command:
mongod --install --rest –master –logpath=C:\mongodb165\logs\mongolog.txt
Open the registry editor (regedit.exe), go to HKEY_LOCAL_MACHINE → SYSTEM → CurrentControlSet → Services.
Find the MongoDB key and set the "ImagePath" value to:
C:\mongodb165\bin\mongod --service --rest --master --logpath=C:\mongodb165\logs\mongolog.txt --dbpath=C:\mongodb165\data
Save the changes to the registry and exit the registry editor.
Open ComponentServices, click on "Services (Local)", and find the MongoDB service. Start it.
Check at the URL http://localhost:28017/ to verify that MongoDB returns stats.
I just encountered the same issue on my windows 7 machine. I followed the directions in MongoDBs Docs for the install, but it wouldn't let me execute "net start MongoDB" unless I was in "C:\". I didn't want to go back and reinstall MongoDB to follow the instructions included in the Webiyo link referenced above though. If you already installed MongoDB according to their docs and want to be able to execute "net start MongoDB" from where ever your project directory is:
Go to HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > services > MongoDB
Double click ImagePath under the Name column
Paste in the following ImagePath ( edit the folder directory and names to match your needs ):
C:\mongodb\bin\mongod.exe --service --rest --master --logpath=C:\mongodb\log\mongolog.txt --dbpath=C:\mongodb\data\db --config C:\mongodb\mongod.cfg
Note that if you direct copy this ImagePath value and your "data" folder is in the mongodb directory instead of C:\ add the following line to your "mongod.cfg" file: dbpath=C:\mongodb\data\db
After I did this, when I run "net stop MongoDB" I get the message "System error 109 has occurred. The pipe has been ended." You may see it as well. This message has been discussed thoroughly at jira.mongodb.org.
To save you the time of reading the whole back and forth discussion, Tad Marshalls post sums up this issue:
"... it was working fine in 2.1.0; later changes broke it again. But yes, you get this error message in the current code.
The explanation is that mongod.exe is exiting from a callback thread created by the Windows Service Control Manager when it calls us due to "net stop mongodb" and this breaks the RPC pipe it used to create the callback thread. We need to reorganize our exit logic to avoid doing this.
The error message is the only real effect of this issue; we exit on command, cleanly, and inform the Windows Service Control Manager that we are stopped, but then the "net" command displays an error message because we didn't return from the RPC call the way it expected us to."
My mongod.cfg file had the following last two lines:
#snmp:
mp:
I have no idea why there's an mp: in there. But when I manually executed the image path
C:\mongodb\bin\mongod.exe --config "C:\mongodb\bin\mongod.cfg" --service
at
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MongoDB
I got
c:\mongodb\bin>mongod /?C:\mongodb\bin\mongod.exe --config "C:\mongodb\bin\mongod.cfg" --service
Unrecognized option: mp
try 'mongod --help' for more information
So I commented it out and then the service started without any problem.
These are the steps I followed to install mongoDB on windows 7
download the .msi file from the mongodb site--> https://www.mongodb.com/download-center?jmp=nav#community and run it
Wherever your mondoDb is downloaded (generally in the c drive Program Files folder), go to that folder and wherever is the bin folder in that same folder create your data folder and your log folder
3.Inside your data folder create your db folder
The structure would look something like this
Now open command prompt as administrator.
change your file path and enter the bin folder.( in this case it would be c>program files>MongoDB>bin> )
Type in the following command : mongod --directoryperdb --dbpath "C:/Program Files\MongoDB\data" --logpath "C:\Program Files\MongoDB\log\mongo.log" --logappend --rest --install
This would set the logpath and database path. Lastly run net start MongoDB . Hope this helps.
I ran this command:
C:\MongoDB\Server\3.4\bin>net start MongoDB
And got this message:
The service is not responding to the control function. More help is
available by typing NET HELPMSG 2186.
After some trials and errors, I noticed when following the tutorial it asked me to name my file mongod.conf but the command was trying to refer to mongod.cfg.
As soon as I corrected that name and re-run the commands,
C:\MongoDB\Server\3.4\bin>sc.exe delete MongoDB
[SC] DeleteService SUCCESS
C:\MongoDB\Server\3.4\bin>sc.exe create MongoDB binPath= "\"C:\MongoDB\Server\3.4\bin\mongod.exe\" --service --config=\"C:\MongoDB\Server\3.4\mongod.cfg\"" DisplayName= "MongoDB" start= "auto"
[SC] CreateService SUCCESS
C:\MongoDB\Server\3.4\bin>net start MongoDB
The MongoDB service is starting....
The MongoDB service was started successfully.
The service started running fine.
To others who may have the same problem on Windows Server 2012:
I have just got the same problem with Mongo 3.0.3 on Windows Server 2012. I am not a system admin so I don't know what they have changed for sc.exe. I have to use
sc.exe create MongoDB binPath= "C:\mongodb\bin\mongod.exe --service --config=C:\mongodb\mongod.cfg" DisplayName= "MongoDB" start= "auto"
This is without the \"\" for both binary and config file paths comparing to the one on their website.
For mongoDB 3.0, You will have to set the following in the config file.
logpath=E:\mongoDBdata\log\mongoDB.log
dbpath=E:\mongoDBdata\db
the logpath should end with a file and not a folder.
Check if your mongod.cfg file has tabs in it. Removing tabs solved it for me!
Following works with MongoDB 3.6.0
Make sure you have these folders:
C:\mongodb\data
C:\mongodb\data\db
Then all you need are these commands:
mongod --directoryperdb -dbpath C:\mongodb\data\db --logpath C:\mongodb\log\mongo.log --logappend --service --install
net start MongoDB
mongo
Another way this might fail is if the account running the service doesn't have write permission into the data directory.
In that case the service will be unable to create a lock file.
The mongod service behaves badly in this situation and goes into a loop starting a process, which immediately throws an unhandled exception, crashes, etc. the log file gets recreated every time the process starts up, so you have to grab it quick if you want to see the error.
the default user for windows services would be localhost\system. so the fix is to ensure this user can write into your db directory, or start the service as another user who can.
For version 2.6 at least, you must create the /data/db/ and /log/ folders that the mongo.cfg points to. MongoDB won't do so itself, and will throw that error in response when ran as a service.
make sure to open the command line with "run as administrator" rights in the right click before typing the entire mongod things
Just try to run mongod.exe locally in command line, you can get here exception, that mongod calls and try to solve it. In my case it was small free space on local disc, so I just change location of directories and change Mongocofig file and now it run ok.
After spend half an hour on debug ... I finally found that there is single dash before the "rest" attribute.
If you look in the service details, you can see that the command to start the service is something like:
"C:\Program Files\MongoDB\bin\mongod" --config C:\Program Files\MongoDB\mongod.cfg --service
The MongoDB team forgot to add the " around the --config option. So just edit the registry to correct it and it will work.
I had same issue on windows 8.1
The solution which worked for me is to specify config file path correctly
Going to HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > services > MongoDB > imagePath the value was like the following:
"C:\Program Files\MongoDB 2.6 Standard\bin\mongod.exe" --config mongod.cfg --service
Then just I corrected config file path to match my actual path:
"C:\Program Files\MongoDB 2.6 Standard\bin\mongod.exe" --config "d:\mongodb\mongod.cfg" --service
Remember to create the database before starting the service
C:\>"C:\Program Files\MongoDB\Server\3.2\bin\mongod.exe" --dbpath d:\MONGODB\DB
2016-10-13T18:18:23.135+0200 I CONTROL [main] Hotfix KB2731284 or later update is installed, no need to zero-out data files
2016-10-13T18:18:23.147+0200 I CONTROL [initandlisten] MongoDB starting : pid=4024 port=27017 dbpath=d:\MONGODB\DB 64-bit host=mongosvr
2016-10-13T18:18:23.148+0200 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2016-10-13T18:18:23.149+0200 I CONTROL [initandlisten] db version v3.2.8
2016-10-13T18:18:23.149+0200 I CONTROL [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0
2016-10-13T18:18:23.150+0200 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1p-fips 9 Jul 2015
2016-10-13T18:18:23.151+0200 I CONTROL [initandlisten] allocator: tcmalloc
2016-10-13T18:18:23.151+0200 I CONTROL [initandlisten] modules: none
2016-10-13T18:18:23.152+0200 I CONTROL [initandlisten] build environment:
2016-10-13T18:18:23.152+0200 I CONTROL [initandlisten] distmod: 2008plus-ssl
2016-10-13T18:18:23.153+0200 I CONTROL [initandlisten] distarch: x86_64
2016-10-13T18:18:23.153+0200 I CONTROL [initandlisten] target_arch: x86_64
2016-10-13T18:18:23.154+0200 I CONTROL [initandlisten] options: { storage: { dbPath: "d:\MONGODB\DB" } }
2016-10-13T18:18:23.166+0200 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=8G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2016-10-13T18:18:23.722+0200 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2016-10-13T18:18:23.723+0200 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory 'd:/MONGODB/DB/diagnostic.data'
2016-10-13T18:18:23.895+0200 I NETWORK [initandlisten] waiting for connections on port 27017
Then you can stop the process Control-C
2016-10-13T18:18:44.787+0200 I CONTROL [thread1] Ctrl-C signal
2016-10-13T18:18:44.788+0200 I CONTROL [consoleTerminate] got CTRL_C_EVENT, will terminate after current cmd ends
2016-10-13T18:18:44.789+0200 I FTDC [consoleTerminate] Shutting down full-time diagnostic data capture
2016-10-13T18:18:44.792+0200 I CONTROL [consoleTerminate] now exiting
2016-10-13T18:18:44.792+0200 I NETWORK [consoleTerminate] shutdown: going to close listening sockets...
2016-10-13T18:18:44.793+0200 I NETWORK [consoleTerminate] closing listening socket: 380
2016-10-13T18:18:44.793+0200 I NETWORK [consoleTerminate] shutdown: going to flush diaglog...
2016-10-13T18:18:44.793+0200 I NETWORK [consoleTerminate] shutdown: going to close sockets...
2016-10-13T18:18:44.795+0200 I STORAGE [consoleTerminate] WiredTigerKVEngine shutting down
2016-10-13T18:18:45.116+0200 I STORAGE [consoleTerminate] shutdown: removing fs lock...
2016-10-13T18:18:45.117+0200 I CONTROL [consoleTerminate] dbexit: rc: 12
Now your database is prepared and you can start the service using
C:\>net start MongoDB
The MongoDB service is starting.
The MongoDB service was started successfully.
Check if a process instance of mongod is already running. If yes, this service will not start because C:\data\db\mongod.lock will be used by it.
And to start MongoDB as a service, this file shall be not used by any process.
For me, the issue was the wrong directory. Make sure you copy paste the directory from your file explorer and not assume the directory specified on the docs page correct.
If you receive the error:
the service name is invalid
when running net start mongodb, you will need to run the following command from Step 4 of Manually Create a Windows Service for MongoDB Community Editition:
sc.exe create MongoDB binPath= "\"C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe\" --service --config=\"C:\Program Files\MongoDB\Server\3.4\mongod.cfg\"" DisplayName= "MongoDB" start= "auto"
I had made few changes in the Config start-up file, which caused this issue. When I looked in the "mongo.log" file, it said
"Cannot start server. Detected data files in E:\Mongo\data\db created by storage engine 'wiredTiger'. The configured storage engine is 'mmapv1'., terminating"
Resetting the storage engine back to 'wiredTiger' resolved the issue for me. Hope this helps others.
When I update the mongodb from 3.4 to 3.6 the described problem occurred, and I found that the problem can also be raised by regedit settings from old versions as residual.
So open regedit through command line then check the value under ImagePath in \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MongoDB, make sure that both the absolute paths and suffices are correct.
In my case, the reinstallation didn't update the settings of suffices for me, so the suffices --httpinterface and --rest remained in the regedit, while those were removed in mongodb 3.6.
I started following a tutorial on a blog that required MongoDB. It had instructions on downloading and configuring the service. But for some reason the command for starting the Windows service in that tutorial wasn’t working. So I went to the MongoDB docs and tried running this command as listed in the mongodb.org-
The command for strting mongodb service-
sc.exe create MongoDB binPath= "\"C:\MongoDB\bin\mongod.exe\" --service --config=\"C:\MongoDB\bin\mongodb\mongod.cfg\"" DisplayName= "MongoDB" start= "auto"
I got this message: [SC] CreateService SUCCESS
Then I ran this one:
net start MongoDB
And got this message:
The service is not responding to the control function.
More help is available by typing NET HELPMSG 2186.
I create a file named 'mongod.cfg' in the 'C:\MongoDB\bin\mongodb\'
As soon as I added that file and re-ran the command- 'net start MongoDB', the service started running fine.
Hope this helps.
Well, in my case, I was running low disk space on my drive where I have my MongoDB data files. I checked MongoDB logs file which stated the following
2015-11-11T21:53:54.717+0500 E JOURNAL [initandlisten] Insufficient free space for journal files 2015-11-11T21:53:54.717+0500 I JOURNAL
[initandlisten] Please make at least 3379MB available in
C:\wamp\bin\mongodb\data\db\journal or use --smallfiles
All I had to do is clean up some space and fire up the service again.. Worked for me. So All you have to is check your logs file and deal with the problem accordingly.