ubuntu - mongodb链接问题。
淡淡烟草味
淡淡烟草味 2017-05-02 09:19:20
0
4
742
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

利用终端链接,出现了这个问题,网上的方法也尝试过,没有成功,求解决方法。

淡淡烟草味
淡淡烟草味

reply all(4)
我想大声告诉你

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
Ty80

http://chenzhou123520.iteye.com/blog/1582179

習慣沉默

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的,安全方面有违最佳实践,特别是你当前使用的是rootuser 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

小葫芦

http://blog.csdn.net/wangli61...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!