1

I am getting this error instead of my shell prompt (running Ubuntu 16.04LTS).

I'm pretty new to MongoDB. I had to downgrade from version 3.4 to 3.2: https://docs.mongodb.com/manual/release-notes/3.4-downgrade-standalone/

I followed those instructions (I thought) pretty faithfully, but now can't access the shell to confirm, etc.

scorpian555@scorpo:~$  mongo
MongoDB shell version: 3.2.15
connecting to: test
2017-07-13T14:41:31.434-0400 W NETWORK  [thread1] Failed to connect to 
127.0.0.1:27017, in(checking socket for error after poll), reason: 
errno:111 Connection refused
2017-07-13T14:41:31.434-0400 E QUERY    [thread1] Error: couldn't 
connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:229:14
@(connect):1:6

exception: connect failed

There was a socket file that the error seems to be referencing at /tmp/mongodb-27017.sock

Per these, I ended up removing that socket file, then tried to reboot the mongod daemon:

'Failed to unlink socket file" error in MongoDB 3.0 MongoDB - Permission denied for socket: /tmp/mongodb-27017.sock

service mongod restart
service mongod status


scorpian555@scorpo:~$ service mongod status
● mongod.service - High-performance, schema-free document-oriented 
database
   Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor 
preset: enabled)
   Active: active (running) since Thu 2017-07-13 14:58:08 EDT; 4s ago
     Docs: https://docs.mongodb.org/manual
 Main PID: 4763 (mongod)
   CGroup: /system.slice/mongod.service
           └─4763 /usr/bin/mongod --quiet --config /etc/mongod.conf

Jul 13 14:58:08 scorpo systemd[1]: Started High-performance, schema-
free document-oriented database.

Per those, I removed the socket file and ran:

scorpian555@scorpo:~$ ls -ld /tmp
drwxrwxrwt 17 root root 20480 Jul 13 14:58 /tmp

I think I'm a little lost here, I was under the impression that, upon restart of the daemon, it would recreate this temporary file, at which point I would check the permissions.

I can't find the link at the moment, but had found elsewhere instructions to make sure the owner of the mongod.sock file was mongod (not root) and I would have to chown it if it wasn't mongod.

I'm pretty new to MongoDB, like I said. I found this as another possible issue, but wanted to see if I should dive down this rabbit hole or whether I might be looking in the wrong place?

Connection refused to MongoDB errno 111

Thanks.

ScorpIan
  • 71
  • 10

1 Answers1

0

My issue was that, while I started the mongod service, I did not actually run the daemon with sudo as needed.

ScorpIan
  • 71
  • 10