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
利用终端链接,出现了这个问题,网上的方法也尝试过,没有成功,求解决方法。
我想大声告诉你2017-05-02 09:21:20
Your mongo has not started. I don’t know how you installed it. The following startup method is for reference only
/usr/local/mongodb/bin/mongod --dbpath=/usr/local/mongodb/data/db --fork --logpath=/usr/local/mongodb/mg.log
習慣沉默2017-05-02 09:21:20
First of all, during the installation process, it is recommended to install from the software source. Please refer to the installation documentation for specific steps. It also talks about how to start after the installation is completed.
Second, check the listening address in the configuration file:
sudo vim /etc/mongod.conf
If necessary, change bindIp to the address you need to monitor (and then restart).
The method mentioned by @prolifes can be used in a test environment, but it is not recommended in a production environment. A few reasons:
This is when you start the mongod
的,安全方面有违最佳实践,特别是你当前使用的是root
user as your current user.
The init.d startup script contains some server optimization parameters, such as disabling numa. Direct startup will cause some performance problems in the future.
All the reasons to use a daemon