我有一个启动MongoDB实例的docker文件。我有一个docker-compose文件来调出这个容器。
这是docker-compose.yml文件的样子:
version: "2"
services:
mongo:
container_name: mongo
build: ./mongo
volumes:
- /my_data/mongo:/data/db
ports:
- "27017:27017"
- "28017:28017"
这很好用!如果我运行它,它将启动Mongo,并且该容器处于活动状态。但是,我有一个cifs共享以卷的形式安装到我的机器上,我希望Mongo将数据写入此共享中,而不是在VM上的/ my_data文件夹中。
我做了以下事情:
version: "2"
services:
mongo:
container_name: mongo
build: ./mongo
volumes:
- /my_volume/mongo:/data/db
ports:
- "27017:27017"
- "28017:28017"
似乎没有权限问题,Docker尝试使用此目录并在该卷内创建mongo.lock文件。但是,docker-compose无法启动我的容器,当我执行docker-compose日志mongo时,我得到了以下追溯信息:
2019-06-20T16:32:10.821+0000 I CONTROL [initandlisten] MongoDB starting : pid=5 port=27017 dbpath=/data/db 64-bit host=7e617ebf21ca
2019-06-20T16:32:10.822+0000 I CONTROL [initandlisten] db version v3.4.21
2019-06-20T16:32:10.822+0000 I CONTROL [initandlisten] git version: ba2e818de44c9a331ce09a624780a2bd841cf6e4
2019-06-20T16:32:10.822+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2019-06-20T16:32:10.822+0000 I CONTROL [initandlisten] allocator: tcmalloc
2019-06-20T16:32:10.822+0000 I CONTROL [initandlisten] modules: none
2019-06-20T16:32:10.822+0000 I CONTROL [initandlisten] build environment:
2019-06-20T16:32:10.822+0000 I CONTROL [initandlisten] distmod: ubuntu1604
2019-06-20T16:32:10.822+0000 I CONTROL [initandlisten] distarch: x86_64
2019-06-20T16:32:10.822+0000 I CONTROL [initandlisten] target_arch: x86_64
2019-06-20T16:32:10.822+0000 I CONTROL [initandlisten] options: { net: { bindIp: "0.0.0.0", http: { RESTInterfaceEnabled: true, enabled: true } } }
2019-06-20T16:32:10.841+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=3479M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),verbose=(recovery_progress),
2019-06-20T16:32:10.868+0000 E STORAGE [initandlisten] WiredTiger error (22) [1561048330:868110][5:0x7f8efa36bd40], connection: /data/db/: directory-sync: fdatasync: Invalid argument
2019-06-20T16:32:10.868+0000 E STORAGE [initandlisten] WiredTiger error (-31804) [1561048330:868258][5:0x7f8efa36bd40], connection: the process must exit and restart: WT_PANIC: WiredTiger library panic
2019-06-20T16:32:10.868+0000 I - [initandlisten] Fatal Assertion 28558 at src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp 365
2019-06-20T16:32:10.868+0000 I - [initandlisten]
***aborting after fassert() failure
2019-06-20T16:32:10.894+0000 F - [initandlisten] Got signal: 6 (Aborted).
0x559dd6fc2861 0x559dd6fc1a79 0x559dd6fc1f5d 0x7f8ef8f6a390 0x7f8ef8bc4428 0x7f8ef8bc602a 0x559dd6256ba5 0x559dd6cc67b6 0x559dd6261222 0x559dd6261447 0x559dd62616a9 0x559dd7976477 0x559dd7976612 0x559dd7976f9b 0x559dd79731a1 0x559dd78d19e6 0x559dd799368f 0x559dd797104b 0x559dd791fcba 0x559dd6caabdf 0x559dd6ca32d2 0x559dd6b95f00 0x559dd6242fa3 0x559dd6262a56 0x7f8ef8baf830 0x559dd62c2c09
----- BEGIN BACKTRACE -----
{"backtrace":[{"b":"559DD5A16000","o":"15AC861","s":"_ZN5mongo15printStackTraceERSo"},{"b":"559DD5A16000","o":"15ABA79"},{"b":"559DD5A16000","o":"15ABF5D"},{"b":"7F8EF8F59000","o":"11390"},{"b":"7F8EF8B8F000","o":"35428","s":"gsignal"},{"b":"7F8EF8B8F000","o":"3702A","s":"abort"},{"b":"559DD5A16000","o":"840BA5","s":"_ZN5mongo32fassertFailedNoTraceWithLocationEiPKcj"},{"b":"559DD5A16000","o":"12B07B6"},{"b":"559DD5A16000","o":"84B222","s":"__wt_eventv"},{"b":"559DD5A16000","o":"84B447","s":"__wt_err"},{"b":"559DD5A16000","o":"84B6A9","s":"__wt_panic"},{"b":"559DD5A16000","o":"1F60477"},{"b":"559DD5A16000","o":"1F60612"},{"b":"559DD5A16000","o":"1F60F9B"},{"b":"559DD5A16000","o":"1F5D1A1","s":"__wt_open"},{"b":"559DD5A16000","o":"1EBB9E6","s":"__wt_block_manager_create"},{"b":"559DD5A16000","o":"1F7D68F","s":"__wt_schema_create"},{"b":"559DD5A16000","o":"1F5B04B","s":"__wt_turtle_init"},{"b":"559DD5A16000","o":"1F09CBA","s":"wiredtiger_open"},{"b":"559DD5A16000","o":"1294BDF","s":"_ZN5mongo18WiredTigerKVEngineC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_PNS_11ClockSourceES8_mbbbb"},{"b":"559DD5A16000","o":"128D2D2"},{"b":"559DD5A16000","o":"117FF00","s":"_ZN5mongo20ServiceContextMongoD29initializeGlobalStorageEngineEv"},{"b":"559DD5A16000","o":"82CFA3"},{"b":"559DD5A16000","o":"84CA56","s":"main"},{"b":"7F8EF8B8F000","o":"20830","s":"__libc_start_main"},{"b":"559DD5A16000","o":"8ACC09","s":"_start"}],"processInfo":{ "mongodbVersion" : "3.4.21", "gitVersion" : "ba2e818de44c9a331ce09a624780a2bd841cf6e4", "compiledModules" : [], "uname" : { "sysname" : "Linux", "release" : "4.4.0-96-generic", "version" : "#119-Ubuntu SMP Tue Sep 12 14:59:54 UTC 2017", "machine" : "x86_64" }, "somap" : [ { "b" : "559DD5A16000", "elfType" : 3, "buildId" : "C0CF6DEDE77121E69C05F8DAB8835E6C51B3261E" }, { "b" : "7FFCB15AD000", "elfType" : 3, "buildId" : "0A63E8ED537104D9ABE07E9C9B77F8B49052BF37" }, { "b" : "7F8EF9EE6000", "path" : "/lib/x86_64-linux-gnu/libssl.so.1.0.0", "elfType" : 3, "buildId" : "FF69EA60EBE05F2DD689D2B26FC85A73E5FBC3A0" }, { "b" : "7F8EF9AA1000", "path" : "/lib/x86_64-linux-gnu/libcrypto.so.1.0.0", "elfType" : 3, "buildId" : "15FFEB43278726B025F020862BF51302822A40EC" }, { "b" : "7F8EF9899000", "path" : "/lib/x86_64-linux-gnu/librt.so.1", "elfType" : 3, "buildId" : "69143E8B39040C964D3958490535322675F15DD3" }, { "b" : "7F8EF9695000", "path" : "/lib/x86_64-linux-gnu/libdl.so.2", "elfType" : 3, "buildId" : "37BFC3D8F7E3B022DAC7943B1A5FACD40CEBF0AD" }, { "b" : "7F8EF938C000", "path" : "/lib/x86_64-linux-gnu/libm.so.6", "elfType" : 3, "buildId" : "BAD67A84E56E73D031AE507261DA066B35949D34" }, { "b" : "7F8EF9176000", "path" : "/lib/x86_64-linux-gnu/libgcc_s.so.1", "elfType" : 3, "buildId" : "68220AE2C65D65C1B6AAA12FA6765A6EC2F5F434" }, { "b" : "7F8EF8F59000", "path" : "/lib/x86_64-linux-gnu/libpthread.so.0", "elfType" : 3, "buildId" : "B17C21299099640A6D863E423D99265824E7BB16" }, { "b" : "7F8EF8B8F000", "path" : "/lib/x86_64-linux-gnu/libc.so.6", "elfType" : 3, "buildId" : "1CA54A6E0D76188105B12E49FE6B8019BF08803A" }, { "b" : "7F8EFA14F000", "path" : "/lib64/ld-linux-x86-64.so.2", "elfType" : 3, "buildId" : "C0ADBAD6F9A33944F2B3567C078EC472A1DAE98E" } ] }}
mongod(_ZN5mongo15printStackTraceERSo+0x41) [0x559dd6fc2861]
mongod(+0x15ABA79) [0x559dd6fc1a79]
mongod(+0x15ABF5D) [0x559dd6fc1f5d]
libpthread.so.0(+0x11390) [0x7f8ef8f6a390]
libc.so.6(gsignal+0x38) [0x7f8ef8bc4428]
libc.so.6(abort+0x16A) [0x7f8ef8bc602a]
mongod(_ZN5mongo32fassertFailedNoTraceWithLocationEiPKcj+0x0) [0x559dd6256ba5]
mongod(+0x12B07B6) [0x559dd6cc67b6]
mongod(__wt_eventv+0x3D7) [0x559dd6261222]
mongod(__wt_err+0x9D) [0x559dd6261447]
mongod(__wt_panic+0x2E) [0x559dd62616a9]
mongod(+0x1F60477) [0x559dd7976477]
mongod(+0x1F60612) [0x559dd7976612]
mongod(+0x1F60F9B) [0x559dd7976f9b]
mongod(__wt_open+0x491) [0x559dd79731a1]
mongod(__wt_block_manager_create+0x66) [0x559dd78d19e6]
mongod(__wt_schema_create+0x4EF) [0x559dd799368f]
mongod(__wt_turtle_init+0x36B) [0x559dd797104b]
mongod(wiredtiger_open+0x194A) [0x559dd791fcba]
mongod(_ZN5mongo18WiredTigerKVEngineC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_PNS_11ClockSourceES8_mbbbb+0x70F) [0x559dd6caabdf]
mongod(+0x128D2D2) [0x559dd6ca32d2]
mongod(_ZN5mongo20ServiceContextMongoD29initializeGlobalStorageEngineEv+0x6B0) [0x559dd6b95f00]
mongod(+0x82CFA3) [0x559dd6242fa3]
mongod(main+0x966) [0x559dd6262a56]
libc.so.6(__libc_start_main+0xF0) [0x7f8ef8baf830]
mongod(_start+0x29) [0x559dd62c2c09]
----- END BACKTRACE -----
有人知道如何解决此错误吗?
答案 0 :(得分:0)
此处的重要错误消息是/data/db/: directory-sync: fdatasync: Invalid argument
。这意味着文件系统在目录上不支持fsync()
。根据{{3}},MongoDB需要这样做:
MongoDB需要一个在目录上支持fsync()的文件系统。例如,HGFS和Virtual Box的共享文件夹不支持此操作。