我在Docker中运行MongoDB,这是一个linux容器。基于此Dockerfile。
我正在使用最新的mongo版本,2.6.4安装在Ubuntu 14.04 64位上。我能够启动mongod
,我在容器和主机中有一个/data/db
文件夹(甚至用作挂载文件夹,它在主机中。)。有足够的记忆,但我得到了错误。
从下面的日志中,您可以清楚地告诉我我正在尝试连接db
两次,由于某些原因,连接无法打开。有人可以帮帮我吗?
注意:机器只安装了git
和mongo
。 mongo还需要其他东西作为依赖吗?
2014-09-04T05:14:50.645+0000 [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=f00d8205ca65
2014-09-04T05:14:50.645+0000 [initandlisten] db version v2.6.4
2014-09-04T05:14:50.645+0000 [initandlisten] git version: 3a830be0eb92d772aa855ebb711ac91d658ee910
2014-09-04T05:14:50.645+0000 [initandlisten] build info: Linux build7.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2014-09-04T05:14:50.645+0000 [initandlisten] allocator: tcmalloc
2014-09-04T05:14:50.646+0000 [initandlisten] options: {}
2014-09-04T05:14:50.648+0000 [initandlisten] journal dir=/data/db/journal
2014-09-04T05:14:50.648+0000 [initandlisten] recover : no journal files present, no recovery needed
2014-09-04T05:14:50.703+0000 [FileAllocator] allocating new datafile /data/db/local.ns, filling with zeroes...
2014-09-04T05:14:50.703+0000 [FileAllocator] creating directory /data/db/_tmp
2014-09-04T05:14:50.705+0000 [FileAllocator] done allocating datafile /data/db/local.ns, size: 16MB, took 0 secs
2014-09-04T05:14:50.708+0000 [FileAllocator] allocating new datafile /data/db/local.0, filling with zeroes...
2014-09-04T05:14:50.709+0000 [FileAllocator] done allocating datafile /data/db/local.0, size: 64MB, took 0.001 secs
2014-09-04T05:14:50.711+0000 [initandlisten] build index on: local.startup_log properties: { v: 1, key: { _id: 1 }, name: "_id_", ns: "local.startup_log" }
2014-09-04T05:14:50.711+0000 [initandlisten] added index to empty collection
2014-09-04T05:14:50.712+0000 [initandlisten] waiting for connections on port 27017
2014-09-04T05:15:50.721+0000 [clientcursormon] mem (MB) res:36 virt:341
2014-09-04T05:15:50.721+0000 [clientcursormon] mapped (incl journal view):160
2014-09-04T05:15:50.721+0000 [clientcursormon] connections:0
2014-09-04T05:15:57.976+0000 [initandlisten] connection accepted from 172.17.42.1:56593 #1 (1 connection now open)
2014-09-04T05:15:57.976+0000 [conn1] end connection 172.17.42.1:56593 (0 connections now open)
有人说运行mongo可能会减少内存。运行momery检查后,我仍然有足够的内存来运行Mongo。
[ root@512ea0e1096b:/data ]$ free -m
total used free shared buffers cached
Mem: 2001 436 1564 0 24 276
-/+ buffers/cache: 136 1865
Swap: 2991 0 2991