Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mongodb error. how can I solve the erro in mongoDB?

MongoDB shell version: 3.2.6 connecting to: test

2016-05-08T10:46:12.023+0530 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2016-05-08T10:46:12.023+0530 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

https://docs.mongodb.com/v3.0/tutorial/install-mongodb-on-ubuntu/

like image 556
mohamedzajith Avatar asked May 08 '16 05:05

mohamedzajith


People also ask

Why is MongoDB not connecting?

However, the improper installation of client and problems with URI string may lead to MongoDB not connecting error. At Bobcares, we often get requests to fix MongoDB not connecting error as part of our Server Management Services. Today, we’ll see how our Support Engineers connect MongoDB via different methods and fix related errors.

How secure is MongoDB?

MongoDB, as shipped, is insecure by default, and the company's admonishment that you should "follow our security checklist" is insane. Remember, MongoDB once shipped in a configuration that didn't require authentication and allowed wide open access to the database from the internet.

Is MongoDB unsuitable for data analysis?

It's unsuitable where the data matters. You're clearly using it in a situation where the data really matters. If you need statistical approximations of analytic data, MongoDB is perfect. if you need a firehose of logging data and you don't really care about logging entries going away, then it's perfect.

Is MongoDB a good choice to replace MySQL?

Even MySQL supports JSON rows now, which means 95% of what you'd want to do with MongoDB is now done better by a relational database. MongoDB has an atrocious security record, having been implicated in multiple major leaks of data.


Video Answer


1 Answers

Do you have the mongodb service running? Run sudo service mongod status and see what it returns. If it is stopped, run sudo service mongod start to start the mongodb and try connecting to it.

You can also, check whether the mongodb is listening on 27017 or not by running: sudo netstat -lnp | grep 27017.

If sudo service mongod start is giving a error, you may need to check the configuration. We can help you better if you can post the output of the above commands.

Update:

Create the file /etc/systemd/system/mongod.service with the following content:

[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target

[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

[Install]
WantedBy=multi-user.target
like image 60
RaviTezu Avatar answered Sep 21 '22 14:09

RaviTezu