我使用以下方法安装了mongodb:http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
当我运行mongod时,我明白了:
mongod --help for help and startup options
Fri Mar 1 18:11:06
Fri Mar 1 18:11:06 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
Fri Mar 1 18:11:06
Fri Mar 1 18:11:06 [initandlisten] MongoDB starting : pid=6265 port=27017 dbpath=/data/db/ 32-bit host=aboelseoud
Fri Mar 1 18:11:06 [initandlisten]
Fri Mar 1 18:11:06 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
Fri Mar 1 18:11:06 [initandlisten] ** see http://blog.mongodb.org/post/137788967/32-bit-limitations
Fri Mar 1 18:11:06 [initandlisten] ** with --journal, the limit is lower
Fri Mar 1 18:11:06 [initandlisten]
Fri Mar 1 18:11:06 [initandlisten] db version v2.2.3, pdfile version 4.5
Fri Mar 1 18:11:06 [initandlisten] git version: f570771a5d8a3846eb7586eaffcf4c2f4a96bf08
Fri Mar 1 18:11:06 [initandlisten] build info: Linux bs-linux32.10gen.cc 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_49
Fri Mar 1 18:11:06 [initandlisten] options: {}
Fri Mar 1 18:11:06 [initandlisten] exception in initAndListen: 10296
*********************************************************************
ERROR: dbpath (/data/db/) does not exist.
Create this directory or give existing directory in --dbpath.
See http://dochub.mongodb.org/core/startingandstoppingmongo
*********************************************************************
, terminating
Fri Mar 1 18:11:06 dbexit:
Fri Mar 1 18:11:06 [initandlisten] shutdown: going to close listening sockets...
Fri Mar 1 18:11:06 [initandlisten] shutdown: going to flush diaglog...
Fri Mar 1 18:11:06 [initandlisten] shutdown: going to close sockets...
Fri Mar 1 18:11:06 [initandlisten] shutdown: waiting for fs preallocator...
Fri Mar 1 18:11:06 [initandlisten] shutdown: closing all files...
Fri Mar 1 18:11:06 [initandlisten] closeAllFiles() finished
Fri Mar 1 18:11:06 dbexit: really exiting now
当我输入mongo时,我明白了:
MongoDB shell version: 2.2.3
connecting to: test
Fri Mar 1 18:13:00 Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91
exception: connect failed
当我浏览localhost:3000时,我明白了:
Moped::Errors::ConnectionFailure in MembersController#lawlab
Could not connect to any secondary or primary nodes for replica set <Moped::Cluster nodes=[<Moped::Node resolved_address="127.0.0.1:27017">]>
我在这里缺少什么?
答案 0 :(得分:0)
应该创建data / db /文件夹并授予用户访问该文件夹的权限。
答案 1 :(得分:0)
为清楚起见:创建data / db文件夹与/ data / db之间存在差异。一个安装在根目录中,一个不是。因此,您应该创建/ data / db /文件夹,然后使用sudo chown -R / data / db /
来访问该文件夹