MongoDB - Couldn't connect to server..., yes, another error - mongodb

Apologise for reopen another post with the same problem but I tried all the provided solutions and it didn't work.
My logs says:
root#marcproves:/var/log/mongodb# tail -f mongodb.log
Tue Apr 1 04:25:29.272 [initandlisten] shutdown: going to close sockets...
Tue Apr 1 04:25:29.273 [initandlisten] shutdown: waiting for fs preallocator...
Tue Apr 1 04:25:29.273 [initandlisten] shutdown: lock for final commit...
Tue Apr 1 04:25:29.273 [initandlisten] shutdown: final commit...
Tue Apr 1 04:25:29.273 [initandlisten] shutdown: closing all files...
Tue Apr 1 04:25:29.273 [initandlisten] closeAllFiles() finished
Tue Apr 1 04:25:29.273 [initandlisten] journalCleanup...
Tue Apr 1 04:25:29.273 [initandlisten] removeJournalFiles
Tue Apr 1 04:25:29.275 [initandlisten] shutdown: removing fs lock...
Tue Apr 1 04:25:29.275 dbexit: really exiting now
and my console output:
root#marcproves:/var/log/mongodb# mongo
MongoDB shell version: 2.4.9
connecting to: test
Tue Apr 1 04:55:28.679 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
exception: connect failed
root#marcproves:/var/log/mongodb#
I installed mongo as it says in the mongo official webpage for ubuntu version and this happens!
FIXED: SPACE ISSUE

Related

Unable to run mongod server on CentOS

When i try to run my mongod server on CentOS the result of npm start is this error:
root#server[Taxi]# npm start
> vframework#0.0.1 start /home/user/public_html/Taxi
> node server
/home/user/public_html/Taxi/node_modules/mongodb/node_modules/mongodb-core/lib/error.js:72
const MongoParseError = function(message) {
^^^^^
the version of mongod is 2.4.14 and when i run the #mongod -v command i got this error
root#server [Taxi]# mongod -v
Fri Mar 30 19:07:42.038 BackgroundJob starting: DataFileSync
Fri Mar 30 19:07:42.038 versionArrayTest passed
Fri Mar 30 19:07:42.069 shardKeyTest passed
Fri Mar 30 19:07:42.069 isInRangeTest passed
Fri Mar 30 19:07:42.069 shardObjTest passed
Fri Mar 30 19:07:42.096 [initandlisten] MongoDB starting : pid=24586 port=27017 dbpath=/data/db/ 64-bit host=server
Fri Mar 30 19:07:42.096 [initandlisten] db version v2.4.14
Fri Mar 30 19:07:42.096 [initandlisten] git version: nogitversion
Fri Mar 30 19:07:42.096 [initandlisten] build info: Linux buildvm-11.phx2.fedoraproject.org 4.7.2-201.fc24.x86_64 #1 SMP Fri Aug 26 15:58:40 UTC 2016 x86_64 BOOST_LIB_VERSION=1_41
Fri Mar 30 19:07:42.096 [initandlisten] allocator: tcmalloc
Fri Mar 30 19:07:42.096 [initandlisten] options: { verbose: true }
Fri Mar 30 19:07:42.138 [initandlisten] User Assertion: 10310:Unable to lock file: /data/db/mongod.lock. Is a mongod instance already running?
Fri Mar 30 19:07:42.176 [initandlisten] exception in initAndListen: 10310 Unable to lock file: /data/db/mongod.lock. Is a mongod instance already running?, terminating
Fri Mar 30 19:07:42.177 dbexit:
Fri Mar 30 19:07:42.177 [initandlisten] shutdown: going to close listening sockets...
Fri Mar 30 19:07:42.177 [initandlisten] shutdown: going to flush diaglog...
Fri Mar 30 19:07:42.177 [initandlisten] shutdown: going to close sockets...
Fri Mar 30 19:07:42.177 [initandlisten] shutdown: waiting for fs preallocator...
Fri Mar 30 19:07:42.177 [initandlisten] shutdown: lock for final commit...
Fri Mar 30 19:07:42.177 [initandlisten] shutdown: final commit...
Fri Mar 30 19:07:42.177 [initandlisten] shutdown: closing all files...
Fri Mar 30 19:07:42.179 [initandlisten] closeAllFiles() finished
Fri Mar 30 19:07:42.179 dbexit: really exiting now
i added a mongod.config file to path /etc/ fo specify the server adress and this is it's content
root#server [etc]# cat mongod.conf
logpath=/var/log/mongo/mongod.log
port=27027
bind_ip=0.0.0.0
dbpath=/var/lib/mongo
replSetName: rs0

mongod doesn't start even on start of the system

when I run sudo mongod on my ubuntu 14.04 it gives below error
mongod --help for help and startup options
Tue Mar 7 09:42:15.992 [initandlisten] MongoDB starting : pid=2870 port=27017 dbpath=/data/db/ 64-bit host=keshav-mohta
Tue Mar 7 09:42:15.992 [initandlisten] db version v2.4.9
Tue Mar 7 09:42:15.992 [initandlisten] git version: nogitversion
Tue Mar 7 09:42:15.992 [initandlisten] build info: Linux orlo 3.2.0-58-generic #88-Ubuntu SMP Tue Dec 3 17:37:58 UTC 2013 x86_64 BOOST_LIB_VERSION=1_54
Tue Mar 7 09:42:15.992 [initandlisten] allocator: tcmalloc
Tue Mar 7 09:42:15.992 [initandlisten] options: {}
Tue Mar 7 09:42:16.431 [initandlisten] journal dir=/data/db/journal
Tue Mar 7 09:42:16.435 [initandlisten] recover : no journal files present, no recovery needed
Tue Mar 7 09:42:17.587 [websvr] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:28017
Tue Mar 7 09:42:17.587 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
Tue Mar 7 09:42:17.587 [websvr] ERROR: addr already in use
Tue Mar 7 09:42:17.587 [initandlisten] ERROR: addr already in use
Tue Mar 7 09:42:17.587 [initandlisten] now exiting
Tue Mar 7 09:42:17.587 dbexit:
Tue Mar 7 09:42:17.587 [initandlisten] shutdown: going to close listening sockets...
Tue Mar 7 09:42:17.587 [initandlisten] shutdown: going to flush diaglog...
Tue Mar 7 09:42:17.587 [initandlisten] shutdown: going to close sockets...
Tue Mar 7 09:42:17.587 [initandlisten] shutdown: waiting for fs preallocator...
Tue Mar 7 09:42:17.587 [initandlisten] shutdown: lock for final commit...
Tue Mar 7 09:42:17.587 [initandlisten] shutdown: final commit...
Tue Mar 7 09:42:17.760 [initandlisten] shutdown: closing all files...
Tue Mar 7 09:42:17.760 [initandlisten] closeAllFiles() finished
Tue Mar 7 09:42:17.760 [initandlisten] journalCleanup...
Tue Mar 7 09:42:17.760 [initandlisten] removeJournalFiles
Tue Mar 7 09:42:17.969 [initandlisten] shutdown: removing fs lock...
Tue Mar 7 09:42:17.969 dbexit: really exiting now
I know the solution to kill the process (sudo killall mongod) and then run the command again but my question is :
WHY it say addr already in use when I just start the system?
Is there any way so that I do not require to run 2 command on every morning to start mongod service.
UPDATE
my guess is that mongo service start on startup as I checked with
sudo initctl list | grep mongo
which output
mongodb start/running, process 1190
now I execute below command to stop mongodb on startup
sudo update-rc.d -f mongodb remove
which output
Removing any system startup links for /etc/init.d/mongodb ...
BUt it still display the mongodb in the list when check with sudo initctl list. even I start the system again to verify?
Step 1: Sometimes starting the services in completely new terminal ctrl + alt + T works.
Step 2: Use netstat to detect the port is running or not
netstat -anp | grep mongodPortHere
If it is running then use ps aux | grep "mongod" | less for processId and use kill -9 processId

Unable to start MongoDB. ERROR: addr already in use

I tried running MongoDB in local server with mongod command and it failed to run. The error:
mongod --help for help and startup options
Sat Jan 31 13:07:16.392 [initandlisten] MongoDB starting : pid=5127 port=27017 dbpath=/data/db/ 64-bit host=leandrotk
Sat Jan 31 13:07:16.392 [initandlisten] db version v2.4.9
Sat Jan 31 13:07:16.392 [initandlisten] git version: nogitversion
Sat Jan 31 13:07:16.392 [initandlisten] build info: Linux orlo 3.2.0-58-generic #88-Ubuntu SMP Tue Dec 3 17:37:58 UTC 2013 x86_64 BOOST_LIB_VERSION=1_54
Sat Jan 31 13:07:16.392 [initandlisten] allocator: tcmalloc
Sat Jan 31 13:07:16.392 [initandlisten] options: {}
Sat Jan 31 13:07:16.435 [initandlisten] journal dir=/data/db/journal
Sat Jan 31 13:07:16.435 [initandlisten] recover : no journal files present, no recovery needed
Sat Jan 31 13:07:16.513 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
Sat Jan 31 13:07:16.514 [initandlisten] ERROR: addr already in use
Sat Jan 31 13:07:16.514 [websvr] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:28017
Sat Jan 31 13:07:16.514 [initandlisten] now exiting
Sat Jan 31 13:07:16.514 [websvr] ERROR: addr already in use
Sat Jan 31 13:07:16.514 dbexit:
Sat Jan 31 13:07:16.514 [initandlisten] shutdown: going to close listening sockets...
Sat Jan 31 13:07:16.514 [initandlisten] shutdown: going to flush diaglog...
Sat Jan 31 13:07:16.514 [initandlisten] shutdown: going to close sockets...
Sat Jan 31 13:07:16.514 [initandlisten] shutdown: waiting for fs preallocator...
Sat Jan 31 13:07:16.514 [initandlisten] shutdown: lock for final commit...
Sat Jan 31 13:07:16.514 [initandlisten] shutdown: final commit...
Sat Jan 31 13:07:16.599 [initandlisten] shutdown: closing all files...
Sat Jan 31 13:07:16.599 [initandlisten] closeAllFiles() finished
Sat Jan 31 13:07:16.599 [initandlisten] journalCleanup...
Sat Jan 31 13:07:16.599 [initandlisten] removeJournalFiles
Sat Jan 31 13:07:16.668 [initandlisten] shutdown: removing fs lock...
Sat Jan 31 13:07:16.668 dbexit: really exiting now
you already have a process running
killall mongod
should kill the other process, if you have another kind of process bound to that port you could find it with netstat | grep 27017
Try this:
sudo service mongodb stop
sudo mongod
some version is:
sudo service mongod stop
mongod: mongo damon

MongoDb Bind_ip error: bind() failed errno:10049

My MongoDb Config file Content Is as below:
port=22000
bind_ip=127.0.0.1,192.168.1.121
auth=true
dbpath=D:\Data_For_Mongo
I am running my mongod instance using following command:
mongod -f "D:\mongoConfig.conf"
It Gives Me following Error:
ERROR: listen(): bind() failed errno:10049 The requested address is not valid in its context. for socket: 192.168.1.121:22000
The Whole Stack trace is As Below:
Fri Apr 11 09:24:18.600 [initandlisten] MongoDB starting : pid=3780 port=22000 dbpath=D:\Data_For_Mongo 64-bit host=SLK055
Fri Apr 11 09:24:18.600 [initandlisten] db version v2.4.6
Fri Apr 11 09:24:18.600 [initandlisten] git version: b9925db5eac369d77a3a5f5d98a145eaaacd9673
Fri Apr 11 09:24:18.600 [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_49
Fri Apr 11 09:24:18.615 [initandlisten] allocator: system
Fri Apr 11 09:24:18.615 [initandlisten] options: { auth: "true", bind_ip: "192.168.1.80,192.168.1.121", config: "D:\mongoConfig.conf", dbpath: "D:\Data_For_Mongo", port: 22000 }
Fri Apr 11 09:24:18.647 [initandlisten] journal dir=D:\Data_For_Mongo\journal
Fri Apr 11 09:24:18.647 [initandlisten] recover : no journal files present, no recovery needed
Fri Apr 11 09:24:18.709 [initandlisten] ERROR: listen(): bind() failed errno:10049 The requested address is not valid in its context. for socket: 192.168.1.121:22000
Fri Apr 11 09:24:18.709 [websvr] ERROR: listen(): bind() failed errno:10049 The requested address is not valid in its context. for socket: 192.168.1.121:23000
Fri Apr 11 09:24:18.709 [initandlisten] now exiting
Fri Apr 11 09:24:18.725 dbexit:
Fri Apr 11 09:24:18.725 [initandlisten] shutdown: going to close listening sockets...
Fri Apr 11 09:24:18.740 [initandlisten] closing listening socket: 528
Fri Apr 11 09:24:18.740 [initandlisten] closing listening socket: 552
Fri Apr 11 09:24:18.740 [initandlisten] shutdown: going to flush diaglog...
Fri Apr 11 09:24:18.756 [initandlisten] shutdown: going to close sockets...
Fri Apr 11 09:24:18.756 [initandlisten] shutdown: waiting for fs preallocator...
Fri Apr 11 09:24:18.772 [initandlisten] shutdown: lock for final commit...
Fri Apr 11 09:24:18.772 [initandlisten] shutdown: final commit...
Fri Apr 11 09:24:18.834 [initandlisten] shutdown: closing all files...
Fri Apr 11 09:24:18.834 [initandlisten] closeAllFiles() finished
Fri Apr 11 09:24:18.834 [initandlisten] journalCleanup...
Fri Apr 11 09:24:18.834 [initandlisten] removeJournalFiles
Fri Apr 11 09:24:18.850 [initandlisten] shutdown: removing fs lock...
Fri Apr 11 09:24:18.850 dbexit: really exiting now
Bind Multiple ips is important for me.
Can AnyOne Help Me To Solve This Error?
I Have searched about error but can't find any way to bind multiple ips in mongo.
Thats a Windows Socket error. This is normally due to the IP address you are trying to bind to not being the IP of your local machine. You should double check that your system actually has the IP of 192.168.1.121

meteor is not starting

I am having problems with launching Meteor examples.
That is what i get when I type meteor in application folder
[[[[[ ~/parties ]]]]]
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Can't start mongod
MongoDB had an unspecified uncaught exception.
Check to make sure that MongoDB is able to write to its database directory.
I have already tried meteor reset and removing .meteor/local/db/mongo.lock - nothing changes
I tried typing mongod
mongod --help for help and startup options
Sun Jun 2 00:00:39.080 [initandlisten] MongoDB starting : pid=1962 port=27017 dbpath=/data/db/ 64-bit host=orion
Sun Jun 2 00:00:39.081 [initandlisten] db version v2.4.3
Sun Jun 2 00:00:39.081 [initandlisten] git version: fe1743177a5ea03e91e0052fb5e2cb2945f6d95f
Sun Jun 2 00:00:39.081 [initandlisten] build info: Linux ip-10-2-29-40 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49
Sun Jun 2 00:00:39.081 [initandlisten] allocator: tcmalloc
Sun Jun 2 00:00:39.081 [initandlisten] options: {}
Sun Jun 2 00:00:39.083 [initandlisten] exception in initAndListen std::exception: locale::facet::_S_create_c_locale name not valid, terminating
Sun Jun 2 00:00:39.083 dbexit:
Sun Jun 2 00:00:39.083 [initandlisten] shutdown: going to close listening sockets...
Sun Jun 2 00:00:39.083 [initandlisten] shutdown: going to flush diaglog...
Sun Jun 2 00:00:39.083 [initandlisten] shutdown: going to close sockets...
Sun Jun 2 00:00:39.083 [initandlisten] shutdown: waiting for fs preallocator...
Sun Jun 2 00:00:39.083 [initandlisten] shutdown: lock for final commit...
Sun Jun 2 00:00:39.083 [initandlisten] shutdown: final commit...
Sun Jun 2 00:00:39.083 [initandlisten] shutdown: closing all files...
Sun Jun 2 00:00:39.083 [initandlisten] closeAllFiles() finished
Sun Jun 2 00:00:39.083 [initandlisten] shutdown: removing fs lock...
Sun Jun 2 00:00:39.084 dbexit: really exiting now
However, when I use sudo service mongodb stop or start everything works fine and I can query database
MongoDB shell version: 2.4.3
connecting to: test
> db.test.save( { a: 1 } )
> db.test.find()
{ "_id" : ObjectId("51aa70cc07bf3387b90934ce"), "a" : 1 }
I am using Ubuntu 12.04 (VPS) if it matters
According to your logs the reason of mongod couldn't start is in wrong LC_ALL locale value. Try to execute "export LC_ALL=C" before you start mongod. Related issue in bugtracker