Daniel Jamrozik
Daniel Jamrozik

Reputation: 1238

mongo shell does not connect to correct ip and port - ubuntu

This problem is occuring on Ubuntu 14.04

I was able to change my mongod.conf file to include a different bind_ip and port. When I call call mongod with the config file, the log is listing that ip and port perfectly. Like so:

(the port is 24141, and the ip is 10.132.44.332)

***** SERVER RESTARTED *****


Sat Jul 18 17:23:05.119 [initandlisten] MongoDB starting : pid=9285 port=24141 dbpath=/var/lib/mongodb 64-bit host=web
Sat Jul 18 17:23:05.119 [initandlisten] db version v2.4.14
Sat Jul 18 17:23:05.119 [initandlisten] git version: 05bebf9ab15511a71bfbded684bb226014c0a553
Sat Jul 18 17:23:05.119 [initandlisten] build info: Linux ip-10-154-253-119 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
Sat Jul 18 17:23:05.119 [initandlisten] allocator: tcmalloc
Sat Jul 18 17:23:05.120 [initandlisten] options: { bind_ip: "10.132.44.332", config: "/etc/mongod.conf", dbpath: "/var/lib/mongodb", logappend: "true", logpath: "/var/log/mongodb/mongod.log", port: 24141 }
Sat Jul 18 17:23:05.123 [initandlisten] journal dir=/var/lib/mongodb/journal
Sat Jul 18 17:23:05.123 [initandlisten] recover : no journal files present, no recovery needed
Sat Jul 18 17:23:05.204 [initandlisten] waiting for connections on port 24141
Sat Jul 18 17:23:05.205 [websvr] admin web console waiting for connections on port 25141

Although, when I go to run mongo , I get:

MongoDB shell version: 2.4.14
connecting to: test
Sat Jul 18 17:30:33.112 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
exception: connect failed

Which, yes, before you mark this question as a duplicate, I do know that many people have had this problem, but I haven't seen one where the ports are not synched up?

I have tried --repair and restart and a bunch of chmod stuff to fix it, but no dice. Does anyone have any ideas on how to get the two to be the same?

Upvotes: 0

Views: 1248

Answers (1)

ActionON
ActionON

Reputation: 106

Try running mongo with --port [X] where x is the desired port you want to connect to.

mongo --port 24141

Upvotes: 1

Related Questions