Mongodb link problem.

  mongodb, question
flytutu@flytutu-X550JK:~$ mongo
 MongoDB shell version: 3.2.6
 connecting to: test
 2016-06-02T12:30:02.242+0800 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
 2016-06-02T12:30:02.242+0800 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

Using terminal link, this problem has arisen, and online methods have also been tried, without success, to find a solution.

First of all, the installation process is recommended to be installed from the software source. Refer to the specific steps.Installation documentation. It also tells how to start after the installation is completed.
Secondly, check the listening address in the configuration file:

sudo vim /etc/mongod.conf

If necessary, modify bindIp to the address you need to listen to (and restart).
@prolifesThe said method can be used in a test environment, but it is not recommended to use it in a production environment. Several reasons:

  • This starts with your current usermongodYes, safety is against best practices, especially what you are currently usingrootWhen users.

  • The init.d startup script contains some server optimization parameters, such as disablenuma, direct startup will cause some performance problems in the future.

  • All Reasons for Using Daemons