The MongoDB service terminated with service-specific error Cannot create another system semaphore - mongodb

I am using MongoDB version 3.0. I have installed mongodb as windows service which was working all this while. Now suddenly, the service does not start & the event logs shows this error The MongoDB service terminated with service-specific error Cannot create another system semaphore.
I am not sure how can I handle this error message.
I am not sure if its helpful but some of other services on my windows 2008 server also stopped to start on their own.
One of the windows service gives Not enough storage is available to proceess this request error.

First find your mongod.cfg file (for me in C:\Program Files\MongoDB 2.6 Standard)
#where to log
logpath=D:\MongoDatas\log\mongod.log
Then have a look at the last lines of you log file.

As suggested by JPBlanc, I looked at the log and found following entries:
2015-10-06T11:17:48.403-0400 I CONTROL Hotfix KB2731284 or later update is not installed, will zero-out data files
2015-10-06T11:17:48.403-0400 I CONTROL Trying to start Windows service 'MongoDB'
2015-10-06T11:17:48.403-0400 I STORAGE Service running
2015-10-06T11:17:48.423-0400 I JOURNAL [initandlisten] journal dir=C:\Program Files\MongoDB\data\db\journal
2015-10-06T11:17:48.424-0400 I JOURNAL [initandlisten] recover : no journal files present, no recovery needed
2015-10-06T11:17:48.425-0400 I JOURNAL [initandlisten]
2015-10-06T11:17:48.425-0400 E JOURNAL [initandlisten] Insufficient free space for journal files
2015-10-06T11:17:48.425-0400 I JOURNAL [initandlisten] Please make at least 3379MB available in C:\Program Files\MongoDB\data\db\journal or use --smallfiles
2015-10-06T11:17:48.425-0400 I JOURNAL [initandlisten]
2015-10-06T11:17:48.428-0400 I STORAGE [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
2015-10-06T11:17:48.429-0400 I CONTROL [serviceStopWorker] now exiting
2015-10-06T11:17:48.429-0400 I NETWORK [serviceStopWorker] shutdown: going to close listening sockets...
2015-10-06T11:17:48.429-0400 I NETWORK [serviceStopWorker] shutdown: going to flush diaglog...
2015-10-06T11:17:48.429-0400 I NETWORK [serviceStopWorker] shutdown: going to close sockets...
2015-10-06T11:17:48.429-0400 I STORAGE [serviceStopWorker] shutdown: waiting for fs preallocator...
2015-10-06T11:17:48.429-0400 I STORAGE [serviceStopWorker] shutdown: final commit...
2015-10-06T11:17:48.429-0400 I STORAGE [serviceStopWorker] shutdown: closing all files...
2015-10-06T11:17:48.429-0400 I STORAGE [serviceStopWorker] closeAllFiles() finished
2015-10-06T11:17:48.429-0400 I CONTROL [serviceStopWorker] dbexit: rc: 49
It looks like space issue on the drive I was using

I have encountered a similar issue as bellow:
The Apache Tomcat 8.5 Tomcat8 service terminated with service-specific error Incorrect function.
And I found there is a error message in tomcat log:
[error] [ 3304] Failed creating java C:\Program Files\Java\jre1.8.0_101\bin\server\jvm.dll
After fixing this error, we can start tomcat normally.
Just FYI.

Make sure data directories and log directories are created as specified in mongodb.cfg file or mongo DB configuration file. In my case, I was missing one of the files. For more information please visit : https://www.mongodb.com/docs/manual/reference/configuration-options/

Related

mongo db not starting up on ubuntu

I have a mongodb on a remote machine. I restarted the machine the other day without closing the mongodb service first, when I try to restart it today using command sudo service mogod start, nothing happened. I checked the log file /var/log/mongodb/mongod.log there was no error message but a message that seems to be a succesfful restart atempt today. Further restart, stop, start commands are not logged to the log file. And there are no error message on either the log file or terminal window.
2018-06-11T22:47:50.191+0800 I FTDC [signalProcessingThread] Shutting down full-time diagnostic data capture
2018-06-11T22:47:50.697+0800 I STORAGE [signalProcessingThread] WiredTigerKVEngine shutting down
2018-06-11T22:47:56.309+0800 I STORAGE [signalProcessingThread] shutdown: removing fs lock...
2018-06-11T22:47:57.269+0800 I CONTROL [signalProcessingThread] now exiting
2018-06-11T22:47:57.269+0800 I CONTROL [signalProcessingThread] shutting down with code:0
2018-06-19T11:48:33.985+0800 I CONTROL [main] ***** SERVER RESTARTED *****
2018-06-19T11:48:34.115+0800 I CONTROL [initandlisten] MongoDB starting : pid=6614 port=27017 dbpath=/var/lib/mongodb 64-bit host=ubuntu
2018-06-19T11:48:34.115+0800 I CONTROL [initandlisten] db version v3.6.4
2018-06-19T11:48:34.115+0800 I CONTROL [initandlisten] git version: d0181a711f7e7f39e60b5aeb1dc7097bf6ae5856
When I tried sudo mongod it comes up with exception in initAndListen: NonExistentPath: Data directory /data/db not found. error. When I tried sudo mongod --dbpath=/var/lib/mongodb the database start successfully.
What should I check or do to start the process using sudo service mogod start again?
You will have to create map "data/db" in at your disk.
Usually on Windows there should be path C://data/db. I am guessing that you should create same map on disk even though it is Ubuntu. You can try with that

Connect failed to mongodb shell

I have installed mongo, run the shell success in couple of time, then I try to add:
security:
authorization: disabled
because I want to add user Admin to admin db. After that, I can not access the mongo shell, this error show up when run command mongo
MongoDB shell version v3.6.2
connecting to: mongodb://127.0.0.1:27017
2018-02-09T09:34:48.769+0700 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2018-02-09T09:34:48.769+0700 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:251:13
#(connect):1:6
exception: connect failed
And here is few last lines of the log file after disable authorization, even when enable it again, thing doesn't work /var/log/mongodb/mongod.log
2018-02-09T09:33:00.843+0700 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-02-09T09:33:00.843+0700 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2018-02-09T09:33:00.843+0700 I CONTROL [initandlisten]
2018-02-09T09:33:00.847+0700 F CONTROL [initandlisten] ** IMPORTANT: UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.4 before attempting an upgrade to 3.6; see http://dochub.mongodb.org/core/3.6-upgrade-fcv for more details.
2018-02-09T09:33:00.847+0700 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2018-02-09T09:33:00.847+0700 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2018-02-09T09:33:00.847+0700 I REPL [initandlisten] shutdown: removing all drop-pending collections...
2018-02-09T09:33:00.847+0700 I REPL [initandlisten] shutdown: removing checkpointTimestamp collection...
2018-02-09T09:33:00.848+0700 I STORAGE [initandlisten] shutdown: waiting for fs preallocator...
2018-02-09T09:33:00.848+0700 I STORAGE [initandlisten] shutdown: final commit...
2018-02-09T09:33:00.849+0700 I JOURNAL [initandlisten] journalCleanup...
2018-02-09T09:33:00.849+0700 I JOURNAL [initandlisten] removeJournalFiles
2018-02-09T09:33:00.876+0700 I JOURNAL [initandlisten] old journal file /var/lib/mongodb/journal/j._0 will be reused as /var/lib/mongodb/journal/prealloc.0
2018-02-09T09:33:00.899+0700 I JOURNAL [initandlisten] Terminating durability thread ...
2018-02-09T09:33:00.950+0700 I JOURNAL [journal writer] Journal writer thread stopped
2018-02-09T09:33:00.950+0700 I JOURNAL [durability] Durability thread stopped
2018-02-09T09:33:00.950+0700 I STORAGE [initandlisten] shutdown: closing all files...
2018-02-09T09:33:00.953+0700 I STORAGE [initandlisten] closeAllFiles() finished
2018-02-09T09:33:00.953+0700 I STORAGE [initandlisten] shutdown: removing fs lock...
2018-02-09T09:33:00.953+0700 I CONTROL [initandlisten] now exiting
2018-02-09T09:33:00.953+0700 I CONTROL [initandlisten] shutting down with code:62
I tried to run sudo service mongod restart but doesn't work.
So can you give me some advices for this problem, thanks
Is seems that mongod can't start because your system has updated mongodb from version < 3.4 to 3.6 as it stated in the log: The data files need to be fully upgraded to version 3.4 before attempting an upgrade to 3.6
You need to downgrade mongodb to 3.4, then sudo service mongod start to trigger the db migration to 3.4.
I just try to run this command and it works for me brew services start mongodb
Cheers.

Having trouble installing and using mongodb. on my macosx and a readonly /data/db

I want to install Mongodb for my next online web course but the thing is I'm having so much issues. I have been installing and uninstall mongodb so many times I think it's conflicting with temp ... Can someone guide me to the process please, really would appreciate it.
The error when running mongodb:
017-07-02T10:31:41.547-0400 I STORAGE [initandlisten] exception in
initAndListen: 20 Attempted to create a lock file on a read-only
directory: /data/db, terminating 2017-07-02T10:31:41.547-0400 I
NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-07-02T10:31:41.547-0400 I NETWORK [initandlisten] shutdown: going
to flush diaglog... 2017-07-02T10:31:41.547-0400 I CONTROL
[initandlisten] now exiting 2017-07-02T10:31:41.547-0400 I CONTROL
[initandlisten] shutting down with code:100 –
I tried installing it on homebrew , nothing happen, I tried installing it manually still having troubles.. I know my basic like cd,ls,rm,pwd,touch, when using the terminal, If theres process that i can wipe everything associate with mangodb in my Macbook and install it again i have no problem.
found out that /data/db is readonly
MongoDB is already installed but you have some issue launching it.
017-07-02T10:31:41.547-0400 I STORAGE [initandlisten] exception in
initAndListen: 20 Attempted to create a lock file on a read-only
directory: /data/db, terminating 2017-07-02T10:31:41.547-0400 I
NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-07-02T10:31:41.547-0400 I NETWORK [initandlisten] shutdown: going
to flush diaglog... 2017-07-02T10:31:41.547-0400 I CONTROL
[initandlisten] now exiting 2017-07-02T10:31:41.547-0400 I CONTROL
[initandlisten] shutting down with code:100 –
Change the permission of /data/db
sudo chown -R `id -un` /data/db
Now you should start the daemon without problem:mongod
then connect with your mongo client by typing. mongo
ok.. then got this. 2017-07-02T10:50:39.069-0400 I CONTROL
[initandlisten] options: { repair: true, storage: { dbPath: "/data/db"
} } 2017-07-02T10:50:39.069-0400 W - [initandlisten] Detected unclean
shutdown - /data/db/mongod.lock is not empty.
2017-07-02T10:50:39.069-0400 E NETWORK [initandlisten] Failed to
unlink socket file /tmp/mongodb-27017.sock Permission denied
2017-07-02T10:50:39.069-0400 I - [initandlisten] Fatal Assertion 28578
at src/mongo/util/net/listen.cpp 195 2017-07-02T10:50:39.070-0400 I -
[initandlisten] ***aborting after fassert() failure
your /tmp is maybe not readable, try:
chmod 1777 /tmp

MongoDB returning exit code 49

I installed mongodb and then I created a service to run it.
Starting the service works without problem but while trying to shutdown it, I get an error code by windows. I checked the log file and this is what I get:
2017-02-23T08:36:51.518+0100 I CONTROL [serviceStopWorker] shutting down with code:49
(Translation)
Error 1067: the process terminated unexpectedly
Service path:
"C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe" --config "C:\Program Files\MongoDB\Server\3.4\bin\mongod.cfg" --service
mongodb.cfg
systemLog:
destination: file
path: "C:\\data\\log\\mongod.log"
storage:
dbPath: "C:\\data\\db"
I tried to find the error codes but it doesn't appear.
https://docs.mongodb.com/manual/reference/exit-codes/
The only reference I could find is this. A test with questions/answers about exit codes. (Question #7)
http://www.sanfoundry.com/mongodb-questions-answers-exit-codes-statutes/
7. 49 code is returned by mongod from _________ Service control Manager.
a) Linux
b) Windows
c) Ubuntu
d) All of the mentioned
View Answer
Answer:a
Explanation:Custom read preferences and write concerns evaluate tags sets in different ways.
But I am on a Windows 7 machine. So that's quite odd.
Windows 7 x64 SP1
MongoDB 3.4.2
Any idea?
LOG
2017-02-23T08:36:48.484+0100 I CONTROL [main] Trying to start Windows service 'MongoDB'
2017-02-23T08:36:48.485+0100 I CONTROL [initandlisten] MongoDB starting : pid=17856 port=27017 dbpath=C:\data\db 64-bit host=FRAmdsWS430
2017-02-23T08:36:48.485+0100 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2017-02-23T08:36:48.485+0100 I CONTROL [initandlisten] db version v3.4.2
2017-02-23T08:36:48.485+0100 I CONTROL [initandlisten] git version: 3f76e40c105fc223b3e5aac3e20dcd026b83b38b
2017-02-23T08:36:48.485+0100 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1u-fips 22 Sep 2016
2017-02-23T08:36:48.485+0100 I CONTROL [initandlisten] allocator: tcmalloc
2017-02-23T08:36:48.485+0100 I CONTROL [initandlisten] modules: none
2017-02-23T08:36:48.486+0100 I CONTROL [initandlisten] build environment:
2017-02-23T08:36:48.486+0100 I CONTROL [initandlisten] distmod: 2008plus-ssl
2017-02-23T08:36:48.486+0100 I CONTROL [initandlisten] distarch: x86_64
2017-02-23T08:36:48.486+0100 I CONTROL [initandlisten] target_arch: x86_64
2017-02-23T08:36:48.486+0100 I CONTROL [initandlisten] options: { config: "C:\Program Files\MongoDB\Server\3.4\bin\mongod.cfg", service: true, storage: { dbPath: "C:\data\db" }, systemLog: { destination: "file", path: "C:\data\log\mongod.log" } }
2017-02-23T08:36:48.488+0100 I - [initandlisten] Detected data files in C:\data\db created by the 'mmapv1' storage engine, so setting the active storage engine to 'mmapv1'.
2017-02-23T08:36:48.497+0100 I JOURNAL [initandlisten] journal dir=C:\data\db\journal
2017-02-23T08:36:48.497+0100 I JOURNAL [initandlisten] recover : no journal files present, no recovery needed
2017-02-23T08:36:48.636+0100 I JOURNAL [durability] Durability thread started
2017-02-23T08:36:48.636+0100 I JOURNAL [journal writer] Journal writer thread started
2017-02-23T08:36:48.693+0100 I CONTROL [initandlisten]
2017-02-23T08:36:48.693+0100 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-02-23T08:36:48.693+0100 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2017-02-23T08:36:48.693+0100 I CONTROL [initandlisten]
2017-02-23T08:36:48.938+0100 W FTDC [initandlisten] Failed to initialize Performance Counters for FTDC: WindowsPdhError: PdhExpandCounterPathW failed with 'Das angegebene Objekt wurde nicht auf dem Computer gefunden.' for counter '\Memory\Available Bytes'
2017-02-23T08:36:48.938+0100 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory 'C:/data/db/diagnostic.data'
2017-02-23T08:36:48.940+0100 I NETWORK [thread1] waiting for connections on port 27017
2017-02-23T08:36:48.940+0100 I STORAGE [initandlisten] Service running
2017-02-23T08:36:51.412+0100 I CONTROL [serviceShutdown] got SERVICE_CONTROL_STOP request from Windows Service Control Manager, will terminate after current cmd ends
2017-02-23T08:36:51.412+0100 I NETWORK [serviceShutdown] shutdown: going to close listening sockets...
2017-02-23T08:36:51.412+0100 I NETWORK [serviceShutdown] closing listening socket: 456
2017-02-23T08:36:51.413+0100 I NETWORK [serviceShutdown] shutdown: going to flush diaglog...
2017-02-23T08:36:51.413+0100 I FTDC [serviceShutdown] Shutting down full-time diagnostic data capture
2017-02-23T08:36:51.413+0100 I STORAGE [serviceShutdown] shutdown: waiting for fs preallocator...
2017-02-23T08:36:51.413+0100 I STORAGE [serviceShutdown] shutdown: final commit...
2017-02-23T08:36:51.438+0100 I JOURNAL [serviceShutdown] journalCleanup...
2017-02-23T08:36:51.439+0100 I JOURNAL [serviceShutdown] removeJournalFiles
2017-02-23T08:36:51.439+0100 I JOURNAL [serviceShutdown] old journal file will be removed: C:\data\db\journal\j._0
2017-02-23T08:36:51.439+0100 I JOURNAL [serviceShutdown] Terminating durability thread ...
2017-02-23T08:36:51.516+0100 I JOURNAL [journal writer] Journal writer thread stopped
2017-02-23T08:36:51.516+0100 I JOURNAL [durability] Durability thread stopped
2017-02-23T08:36:51.516+0100 I STORAGE [serviceShutdown] shutdown: closing all files...
2017-02-23T08:36:51.518+0100 I STORAGE [serviceShutdown] closeAllFiles() finished
2017-02-23T08:36:51.518+0100 I STORAGE [serviceShutdown] shutdown: removing fs lock...
2017-02-23T08:36:51.518+0100 I CONTROL [serviceShutdown] now exiting
2017-02-23T08:36:51.518+0100 I CONTROL [serviceStopWorker] shutting down with code:49
This seems to be a bug introduced in MongoDB version 3.4.2. Check out https://jira.mongodb.org/browse/SERVER-6065

Failed to run mongod, windows 10, "T�r: errno:11001 No such host is known."

I am very new, I have looked and looked but haven't found anything that helps. I hope this isn't a super obscure problem.
I am running windows 10 and have installed MongoDB. I am attempting to get mongod to run but right after it starts listening on port 27017 it kicks back:
[HostnameCanonicalizationWorker] Failed to obtain address information for hostname T�r: errno:11001 No such host is known.
And that is where it stops. I have tried many things. I run the console in administrator, I reinstalled MongoDB, I have made sure the port is not being blocked by the firewall. I even gave trying other ports a go.
Everything that I have looked up says that where I am at mongod should now run and be listening on port 27017.
Here it is in full:
C:\>mongod
2016-01-17T02:29:30.059-0700 I CONTROL [initandlisten] MongoDB starting : pid=1668 port=27017 dbpath=C:\data\db\ 64-bit host=T�r
2016-01-17T02:29:30.063-0700 I CONTROL [initandlisten] targetMinOS: Windows Vista/Windows Server 2008
2016-01-17T02:29:30.065-0700 I CONTROL [initandlisten] db version v3.2.1
2016-01-17T02:29:30.067-0700 I CONTROL [initandlisten] git version: a14d55980c2cdc565d4704a7e3ad37e4e535c1b2
2016-01-17T02:29:30.070-0700 I CONTROL [initandlisten] allocator: tcmalloc
2016-01-17T02:29:30.071-0700 I CONTROL [initandlisten] modules: none
2016-01-17T02:29:30.073-0700 I CONTROL [initandlisten] build environment:
2016-01-17T02:29:30.074-0700 I CONTROL [initandlisten] distarch: x86_64
2016-01-17T02:29:30.076-0700 I CONTROL [initandlisten] target_arch: x86_64
2016-01-17T02:29:30.078-0700 I CONTROL [initandlisten] options: {}
2016-01-17T02:29:30.080-0700 I - [initandlisten] Detected data files in C:\data\db\ created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-01-17T02:29:30.086-0700 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=4G,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-01-17T02:29:31.063-0700 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2016-01-17T02:29:31.063-0700 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory 'C:/data/db/diagnostic.data'
2016-01-17T02:29:31.084-0700 I NETWORK [initandlisten] waiting for connections on port 27017
2016-01-17T02:29:31.897-0700 W NETWORK [HostnameCanonicalizationWorker] Failed to obtain address information for hostname T�r: errno:11001 No such host is known.
2016-01-17T02:29:36.111-0700 I CONTROL [thread1] Ctrl-C signal
2016-01-17T02:29:36.115-0700 I CONTROL [consoleTerminate] got CTRL_C_EVENT, will terminate after current cmd ends
2016-01-17T02:29:36.121-0700 I FTDC [consoleTerminate] Shutting down full-time diagnostic data capture
2016-01-17T02:29:36.137-0700 I CONTROL [consoleTerminate] now exiting
2016-01-17T02:29:36.141-0700 I NETWORK [consoleTerminate] shutdown: going to close listening sockets...
2016-01-17T02:29:36.148-0700 I NETWORK [consoleTerminate] closing listening socket: 544
2016-01-17T02:29:36.152-0700 I NETWORK [consoleTerminate] shutdown: going to flush diaglog...
2016-01-17T02:29:36.159-0700 I NETWORK [consoleTerminate] shutdown: going to close sockets...
2016-01-17T02:29:36.168-0700 I STORAGE [consoleTerminate] WiredTigerKVEngine shutting down
2016-01-17T02:29:36.864-0700 I STORAGE [consoleTerminate] shutdown: removing fs lock...
2016-01-17T02:29:36.868-0700 I CONTROL [consoleTerminate] dbexit: rc: 12
As pointed out by Maximiliano Rios I used a non-latin character in my computers network name and mongod couldn’t handle it. So by changing the name from Týr to Tyr allowed mongod to run.
Under Control Panel\All Control Panel Items\System I changed the Computer Name.
Absolutely weird but we found it out talking together. Seems that mongod tries to reverse lookup always the machine name and it has issues with non-standard characters (in this case is a non-latin character ö but I'm not sure what's the set mongo uses)
Changing the name of the machine works.
I would also try to set an alias in the hosts file.