我在Ubuntu上安裝MongoDB的,並得到以下錯誤消息:如何在Ubuntu中安裝mongodb?
[email protected]:/var/lib/mongodb$ mongo
MongoDB shell version: 3.0.0
connecting to: test
2015-10-26T11:45:14.257+0000 W NETWORK Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2015-10-26T11:45:14.267+0000 E QUERY Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
at connect (src/mongo/shell/mongo.js:179:14)
at (connect):1:6 at src/mongo/shell/mongo.js:179
exception: connect failed
我試圖解決這個問題:
sudo rm /var/lib/mongodb/mongod.lock
sudo service mongod restart
但上述解決方案並不爲我工作。
我還對服務器檢查空間:
[email protected]:/var/lib/mongodb$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.8G 4.3G 3.1G 59%/
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 1.9G 12K 1.9G 1% /dev
tmpfs 377M 356K 377M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 1.9G 0 1.9G 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/xvdb 3.9G 8.1M 3.7G 1% /mnt
閱讀本教程http://w3code.in/2015/10/how-to-install- up-mongodb-and-php-on-ubuntu/ – Ricky