-1

我使用这个安装了 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">]>

我在这里想念什么?

4

2 回答 2

0

应该创建 data/db/ 文件夹并让您的用户访问该文件夹。

于 2013-03-01T16:22:32.583 回答
0

为清楚起见:创建 data/db 文件夹与创建 /data/db 之间存在差异。一个安装在根目录下,一个没有。因此,您应该创建 /data/db/ 文件夹,然后使用 sudo chown -R /data/db/ 授予对该文件夹的访问权限

于 2014-08-27T01:39:21.517 回答