无法连接到Mongo数据库

时间:2015-04-14 11:03:15

标签: mongodb

我正在使用AWS与EC2和EBS。系统确实工作并添加了一个已安装的EBS驱动器。然后我将驱动器映射到/ data并添加/ data / db,然后更改新数据文件夹的mongod.conf。现在mongo将无法启动。当我从ubuntu命令行输入mongo时,我得到以下内容。

2015-04-14T10:49:21.292+0000 W NETWORK  Failed to connect to
   127.0.0.1:27017, reason: errno:111 Connection refused
2015-04-14T10:49:21.294+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

如果我使用mongod尝试运行某些东西,它会挂起如下:

  2015-04-14T10:57:14.147+0000 I JOURNAL  [initandlisten] journal dir=/data/db/journal
2015-04-14T10:57:14.148+0000 I JOURNAL  [initandlisten] recover : no journal files present, no recovery needed
2015-04-14T10:57:14.153+0000 I JOURNAL  [durability] Durability thread started

2015-04-14T10:57:14.153+0000 I JOURNAL  [journal writer] Journal writer thread started

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1977 port=27017 dbpath=/data/db 64-bit host=ip-10-167-179-237

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] 

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] 

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] 

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] db version v3.0.1

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] git version: 534b5a3f9d10f00cd27737fbcd951032248b5952

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] build info: Linux ip-10-167-176-91 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] allocator: tcmalloc

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] options: {}

2015-04-14T10:57:14.198+0000 I NETWORK  [initandlisten] waiting for connections on port 27017

我尝试删除mongod.lock文件,它只是返回。日志似乎根本没有新条目。在更改conf之前系统确实工作,这是添加/ data和新EBS的唯一变化。我有最新版本的mongo和ubuntu。

1 个答案:

答案 0 :(得分:2)

好的,我用

解决了这个问题
sudo service mongod start

然后我使用了命令

mongo 

这打开了数据库的接口。

我找到了一些关于启动mongo an的引用到我的消息。