用于Windows的Docker上的MongoDB〜导出/导入数据

问题描述 投票:2回答:1

我正在尝试为公司中的人员建立一个易于使用的工作流,以便在Windows上建立MongoDB数据库,并使他们能够根据需要交换数据库。

这里的一个障碍是需要为此使用Docker Volumes,这是当前我导出和导入数据的最大问题。

我的docker-compose.yml看起来像这样:

version: "3"
services:
    mongoDB:
        image: mongo:4.0.4
        container_name: "mongo_database"
        environment:
            - MONGO_INITDB_DATABASE=test_database
            - MONGO_INITDB_ROOT_USERNAME=root_username
            - MONGO_INITDB_ROOT_PASSWORD=root_password
        volumes:
            - ./init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
            - mongo_database_volume:/data/db
        ports:
            - "27017-27019:27017-27019"
volumes:
    mongo_database_volume:

我已经能够在该处输入数据,并使用以下命令从该处成功导出我认为是数据库的内容:

docker cp mongo_database:/data/db ./_backup

这在docker-compose.yml旁边创建了一个文件夹“ db_backup”,我相信其中的内容是编码后的数据库内容。

然后我更改了一些数据,再次将其导出到另一个文件夹,并尝试再次导入旧数据库,我认为这与上述命令相反:

docker cp "./db_backup" mongo_database:/data/db

我的期望是,此后更改后的值将返回数据库中的原始值。

但是,令人遗憾的是,更改后的值仍然被更改。导入显然失败了。

因此,在将本地文件夹db_backup重命名为db后,我尝试了此操作:

Docker cp ./db mongo_database:/data/

这做了什么,就是对MongoDB进行碎片整理。容器立即崩溃,并在尝试重新运行后,出现以下令人兴奋的错误消息:

mongo_database | 2020-01-24T15:48:33.984+0000 E STORAGE  [initandlisten] WiredTiger error (2) [1579880913:984049][1:0x7fee5b2c5a40], txn-recover: __posix_open_file, 715: /data/db/journal/WiredTigerLog.0000000007: handle-open: open: No such file or directory Raw: [1579880913:984049][1:0x7fee5b2c5a40], txn-recover: __posix_open_file, 715: /data/db/journal/WiredTigerLog.0000000007: handle-open: open: No such file or directory
mongo_database | 2020-01-24T15:48:33.984+0000 E STORAGE  [initandlisten] WiredTiger error (2) [1579880913:984105][1:0x7fee5b2c5a40], txn-recover: __wt_txn_recover, 740: Recovery failed: No such file or directory Raw: [1579880913:984105][1:0x7fee5b2c5a40], txn-recover: __wt_txn_recover, 740: Recovery failed: No such file or directory
mongo_database | 2020-01-24T15:48:33.990+0000 E STORAGE  [initandlisten] WiredTiger error (0) [1579880913:990629][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 384: cache server: exiting with 2 pages in memory and 0 pages evicted Raw: [1579880913:990629][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 384: cache server: exiting with 2 pages in memory and 0 pages evicted
mongo_database | 2020-01-24T15:48:33.990+0000 E STORAGE  [initandlisten] WiredTiger error (0) [1579880913:990699][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 389: cache server: exiting with 20549 image bytes in memory Raw: [1579880913:990699][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 389: cache server: exiting with 20549 image bytes in memory
mongo_database | 2020-01-24T15:48:33.990+0000 E STORAGE  [initandlisten] WiredTiger error (0) [1579880913:990709][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 393: cache server: exiting with 22853 bytes in memory Raw: [1579880913:990709][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 393: cache server: exiting with 22853 bytes in memory
mongo_database | 2020-01-24T15:48:33.990+0000 E STORAGE  [initandlisten] WiredTiger error (0) [1579880913:990715][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 400: cache server: exiting with 22642 bytes dirty and 1 pages dirty Raw: [1579880913:990715][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 400: cache server: exiting with 22642 bytes dirty and 1 pages dirty
mongo_database | 2020-01-24T15:48:34.046+0000 E STORAGE  [initandlisten] WiredTiger error (2) [1579880914:46221][1:0x7fee5b2c5a40], txn-recover: __posix_open_file, 715: /data/db/journal/WiredTigerLog.0000000007: handle-open: open: No such file or directory Raw: [1579880914:46221][1:0x7fee5b2c5a40], txn-recover: __posix_open_file, 715: /data/db/journal/WiredTigerLog.0000000007: handle-open: open: No such file or directory
mongo_database | 2020-01-24T15:48:34.046+0000 E STORAGE  [initandlisten] WiredTiger error (2) [1579880914:46278][1:0x7fee5b2c5a40], txn-recover: __wt_txn_recover, 740: Recovery failed: No such file or directory Raw: [1579880914:46278][1:0x7fee5b2c5a40], txn-recover: __wt_txn_recover, 740: Recovery failed: No such file or directory
mongo_database | 2020-01-24T15:48:34.070+0000 E STORAGE  [initandlisten] WiredTiger error (0) [1579880914:70413][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 384: cache server: exiting with 2 pages in memory and 0 pages evicted Raw: [1579880914:70413][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 384: cache server: exiting with 2 pages in memory and 0 pages evicted
mongo_database | 2020-01-24T15:48:34.070+0000 E STORAGE  [initandlisten] WiredTiger error (0) [1579880914:70474][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 389: cache server: exiting with 20549 image bytes in memory Raw: [1579880914:70474][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 389: cache server: exiting with 20549 image bytes in memory
mongo_database | 2020-01-24T15:48:34.070+0000 E STORAGE  [initandlisten] WiredTiger error (0) [1579880914:70484][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 393: cache server: exiting with 22853 bytes in memory Raw: [1579880914:70484][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 393: cache server: exiting with 22853 bytes in memory
mongo_database | 2020-01-24T15:48:34.070+0000 E STORAGE  [initandlisten] WiredTiger error (0) [1579880914:70490][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 400: cache server: exiting with 22642 bytes dirty and 1 pages dirty Raw: [1579880914:70490][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 400: cache server: exiting with 22642 bytes dirty and 1 pages dirty
mongo_database | 2020-01-24T15:48:34.124+0000 E STORAGE  [initandlisten] WiredTiger error (2) [1579880914:124339][1:0x7fee5b2c5a40], txn-recover: __posix_open_file, 715: /data/db/journal/WiredTigerLog.0000000007: handle-open: open: No such file or directory Raw: [1579880914:124339][1:0x7fee5b2c5a40], txn-recover: __posix_open_file, 715: /data/db/journal/WiredTigerLog.0000000007: handle-open: open: No such file or directory
mongo_database | 2020-01-24T15:48:34.124+0000 E STORAGE  [initandlisten] WiredTiger error (2) [1579880914:124399][1:0x7fee5b2c5a40], txn-recover: __wt_txn_recover, 740: Recovery failed: No such file or directory Raw: [1579880914:124399][1:0x7fee5b2c5a40], txn-recover: __wt_txn_recover, 740: Recovery failed: No such file or directory
mongo_database | 2020-01-24T15:48:34.133+0000 E STORAGE  [initandlisten] WiredTiger error (0) [1579880914:133924][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 384: cache server: exiting with 2 pages in memory and 0 pages evicted Raw: [1579880914:133924][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 384: cache server: exiting with 2 pages in memory and 0 pages evicted
mongo_database | 2020-01-24T15:48:34.133+0000 E STORAGE  [initandlisten] WiredTiger error (0) [1579880914:133975][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 389: cache server: exiting with 20549 image bytes in memory Raw: [1579880914:133975][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 389: cache server: exiting with 20549 image bytes in memory
mongo_database | 2020-01-24T15:48:34.133+0000 E STORAGE  [initandlisten] WiredTiger error (0) [1579880914:133984][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 393: cache server: exiting with 22853 bytes in memory Raw: [1579880914:133984][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 393: cache server: exiting with 22853 bytes in memory
mongo_database | 2020-01-24T15:48:34.133+0000 E STORAGE  [initandlisten] WiredTiger error (0) [1579880914:133990][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 400: cache server: exiting with 22642 bytes dirty and 1 pages dirty Raw: [1579880914:133990][1:0x7fee5b2c5a40], connection: __wt_cache_destroy, 400: cache server: exiting with 22642 bytes dirty and 1 pages dirty
mongo_database | 2020-01-24T15:48:34.135+0000 W STORAGE  [initandlisten] Failed to start up WiredTiger under any compatibility version.
mongo_database | 2020-01-24T15:48:34.135+0000 F -        [initandlisten] Fatal Assertion 28559 at src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp 65
mongo_database | 2020-01-24T15:48:34.135+0000 F -        [initandlisten]
mongo_database |
mongo_database | ***aborting after fassert() failure
mongo_database |
mongo_database |
mongo_database | 2020-01-24T15:48:34.144+0000 F -        [initandlisten] Got signal: 6 (Aborted).
mongo_database |  0x55793a34daa1 0x55793a34ccb9 0x55793a34d19d 0x7fee59a4a390 0x7fee596a4428 0x7fee596a602a 0x557938982ea7 0x557938a79eb3 0x557938a51161 0x557938a5711f 0x557938a39149 0x5579391223a2 0x557938906251 0x5579389ee94b 0x557938984a39 0x7fee5968f830 0x5579389ecab9
mongo_database | ----- BEGIN BACKTRACE -----
mongo_database | {"backtrace":[{"b":"557937F73000","o":"23DAAA1","s":"_ZN5mongo15printStackTraceERSo"},{"b":"557937F73000","o":"23D9CB9"},{"b":"557937F73000","o":"23DA19D"},{"b":"7FEE59A39000","o":"11390"},{"b":"7FEE5966F000","o":"35428","s":"gsignal"},{"b":"7FEE5966F000","o":"3702A","s":"abort"},{"b":"557937F73000","o":"A0FEA7","s":"_ZN5mongo32fassertFailedNoTraceWithLocationEiPKcj"},{"b":"557937F73000","o":"B06EB3","s":"_ZN5mongo17wtRCToStatus_slowEiPKc"},{"b":"557937F73000","o":"ADE161","s":"_ZN5mongo18WiredTigerKVEngine15_openWiredTigerERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_"},{"b":"557937F73000","o":"AE411F","s":"_ZN5mongo18WiredTigerKVEngineC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_PNS_11ClockSourceES8_mbbbb"},{"b":"557937F73000","o":"AC6149"},{"b":"557937F73000","o":"11AF3A2","s":"_ZN5mongo23initializeStorageEngineEPNS_14ServiceContextENS_22StorageEngineInitFlagsE"},{"b":"557937F73000","o":"993251"},{"b":"557937F73000","o":"A7B94B","s":"_ZN5mongo11mongoDbMainEiPPcS1_"},{"b":"557937F73000","o":"A11A39","s":"main"},{"b":"7FEE5966F000","o":"20830","s":"__libc_start_main"},{"b":"557937F73000","o":"A79AB9","s":"_start"}],"processInfo":{ "mongodbVersion" : "4.0.4", "gitVersion" : "f288a3bdf201007f3693c58e140056adf8b04839", "compiledModules" : [], "uname" : { "sysname" : "Linux", "release" : "4.19.76-linuxkit", "version" : "#1 SMP Thu Oct 17 19:31:58 UTC 2019", "machine" : "x86_64" }, "somap" : [ { "b" : "557937F73000", "elfType" : 3, "buildId" : "955496FB361B86CAB5A87FD0A0E11190E01CE1BF" }, { "b" : "7FFF8E341000", "elfType" : 3, "buildId" : "B75FC78C250AED65F3D9722A8F5CBB07C9B34728" }, { "b" : "7FEE5AE49000", "path" : "/usr/lib/x86_64-linux-gnu/libcurl.so.4", "elfType" : 3, "buildId" : "E2D1DB1857AE8F07908959381751796E89FF56BB" }, { "b" : "7FEE5AC2E000", "path" : "/lib/x86_64-linux-gnu/libresolv.so.2", "elfType" : 3, "buildId" : "6EF73266978476EF9F2FD2CF31E57F4597CB74F8" }, { "b" : "7FEE5A7EA000", "path" : "/lib/x86_64-linux-gnu/libcrypto.so.1.0.0", "elfType" : 3, "buildId" : "250E875F74377DFC74DE48BF80CCB237BB4EFF1D" }, { "b" : "7FEE5A581000", "path" : "/lib/x86_64-linux-gnu/libssl.so.1.0.0", "elfType" : 3, "buildId" : "513282AC7EB386E2C0133FD9E1B6B8A0F38B047D" }, { "b" : "7FEE5A37D000", "path" : "/lib/x86_64-linux-gnu/libdl.so.2", "elfType" : 3, "buildId" : "8CC8D0D119B142D839800BFF71FB71E73AEA7BD4" }, { "b" : "7FEE5A175000", "path" : "/lib/x86_64-linux-gnu/librt.so.1", "elfType" : 3, "buildId" : "89C34D7A182387D76D5CDA1F7718F5D58824DFB3" }, { "b" : "7FEE59E6C000", "path" : "/lib/x86_64-linux-gnu/libm.so.6", "elfType" : 3, "buildId" : "DFB85DE42DAFFD09640C8FE377D572DE3E168920" }, { "b" : "7FEE59C56000", "path" : "/lib/x86_64-linux-gnu/libgcc_s.so.1", "elfType" : 3, "buildId" : "68220AE2C65D65C1B6AAA12FA6765A6EC2F5F434" }, { "b" : "7FEE59A39000", "path" : "/lib/x86_64-linux-gnu/libpthread.so.0", "elfType" : 3, "buildId" : "CE17E023542265FC11D9BC8F534BB4F070493D30" }, { "b" : "7FEE5966F000", "path" : "/lib/x86_64-linux-gnu/libc.so.6", "elfType" : 3, "buildId" : "B5381A457906D279073822A5CEB24C4BFEF94DDB" }, { "b" : "7FEE5B0B8000", "path" : "/lib64/ld-linux-x86-64.so.2", "elfType" : 3, "buildId" : "5D7B6259552275A3C17BD4C3FD05F5A6BF40CAA5" }, { "b" : "7FEE5943C000", "path" : "/usr/lib/x86_64-linux-gnu/libidn.so.11", "elfType" : 3, "buildId" : "E09D3783AD1D0BBCD3204FA01E4EF6D756E18F57" }, { "b" : "7FEE59220000", "path" : "/usr/lib/x86_64-linux-gnu/librtmp.so.1", "elfType" : 3, "buildId" : "8D1CC1204D6B6D33BD1D2C5A2A0516A2234322CF" }, { "b" : "7FEE58FD6000", "path" : "/usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2", "elfType" : 3, "buildId" : "DB5180B568097E2A4690A5B40D36BD134C893FEE" }, { "b" : "7FEE58DC7000", "path" : "/usr/lib/x86_64-linux-gnu/liblber-2.4.so.2", "elfType" : 3, "buildId" : "D3B183C41F02C7CD18F906AAFD19C69C850F1CEB" }, { "b" : "7FEE58B76000", "path" : "/usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2", "elfType" : 3, "buildId" : "DA0EC53E16B3AC6BDC56EAEFE1BFECDDC395FB2E" }, { "b" : "7FEE5895C000", "path" : "/lib/x86_64-linux-gnu/libz.so.1", "elfType" : 3, "buildId" : "8D9BD4CE26E45EF16075C67D5F5EEAFD8B562832" }, { "b" : "7FEE5862C000", "path" : "/usr/lib/x86_64-linux-gnu/libgnutls.so.30", "elfType" : 3, "buildId" : "3CE893F6D1382C2C7648DCCB06E71B1C7E0861CC" }, { "b" : "7FEE583F9000", "path" : "/usr/lib/x86_64-linux-gnu/libhogweed.so.4", "elfType" : 3, "buildId" : "B11678F560199547DCF726384EA39153EE0DFABF" }, { "b" : "7FEE581C3000", "path" : "/usr/lib/x86_64-linux-gnu/libnettle.so.6", "elfType" : 3, "buildId" : "D6B36C5A463EE0FA84FDD6D5FD3F7726EDB90D54" }, { "b" : "7FEE57F43000", "path" : "/usr/lib/x86_64-linux-gnu/libgmp.so.10", "elfType" : 3, "buildId" : "7B3533D5998D20EE1A1BE3F87789B69041E7F620" }, { "b" : "7FEE57C71000", "path" : "/usr/lib/x86_64-linux-gnu/libkrb5.so.3", "elfType" : 3, "buildId" : "16E3DBC6D048145939BB43BBFD7954D27421B00F" }, { "b" : "7FEE57A42000", "path" : "/usr/lib/x86_64-linux-gnu/libk5crypto.so.3", "elfType" : 3, "buildId" : "AEB4C08FC47F86C475E9D3996DFE5E9B403ACEBF" }, { "b" : "7FEE5783E000", "path" : "/lib/x86_64-linux-gnu/libcom_err.so.2", "elfType" : 3, "buildId" : "1E16CB57F699E215A2A8D4EFEF90883BC749B12D" }, { "b" : "7FEE57633000", "path" : "/usr/lib/x86_64-linux-gnu/libkrb5support.so.0", "elfType" : 3, "buildId" : "DF3219B89E86920E901BAC4A80AA60F2B6134588" }, { "b" : "7FEE57418000", "path" : "/usr/lib/x86_64-linux-gnu/libsasl2.so.2", "elfType" : 3, "buildId" : "87783DF8A1058CD150F8886CB36340384093C18F" }, { "b" : "7FEE571D7000", "path" : "/usr/lib/x86_64-linux-gnu/libgssapi.so.3", "elfType" : 3, "buildId" : "1FE877BE52A424D0636AFD4D35BB330E41D6E0F3" }, { "b" : "7FEE56F73000", "path" : "/usr/lib/x86_64-linux-gnu/libp11-kit.so.0", "elfType" : 3, "buildId" : "A0E2D03FF5CF65937F4425D4EFD4D655243809EB" }, { "b" : "7FEE56D60000", "path" : "/usr/lib/x86_64-linux-gnu/libtasn1.so.6", "elfType" : 3, "buildId" : "E07E186694852D8F69459C6AB28A53F8DA3CE3B6" }, { "b" : "7FEE56B5C000", "path" : "/lib/x86_64-linux-gnu/libkeyutils.so.1", "elfType" : 3, "buildId" : "3364D4BF2113C4E8D17EF533867ECC99A53413D6" }, { "b" : "7FEE56953000", "path" : "/usr/lib/x86_64-linux-gnu/libheimntlm.so.0", "elfType" : 3, "buildId" : "73A8EADBC85860662B24850E71D4AFBE22C33359" }, { "b" : "7FEE566C9000", "path" : "/usr/lib/x86_64-linux-gnu/libkrb5.so.26", "elfType" : 3, "buildId" : "59E742306A4EA2872E061ECCE92F35FADDA75357" }, { "b" : "7FEE56427000", "path" : "/usr/lib/x86_64-linux-gnu/libasn1.so.8", "elfType" : 3, "buildId" : "E5C159E415406AE79D21056D752BA949C408B5B1" }, { "b" : "7FEE561F4000", "path" : "/usr/lib/x86_64-linux-gnu/libhcrypto.so.4", "elfType" : 3, "buildId" : "7D15576E1F096614D360784E4A01A1F5FAF908C9" }, { "b" : "7FEE55FDE000", "path" : "/usr/lib/x86_64-linux-gnu/libroken.so.18", "elfType" : 3, "buildId" : "481DB33C28D88E43DA6BED65E1A7599407D4D818" }, { "b" : "7FEE55DD6000", "path" : "/usr/lib/x86_64-linux-gnu/libffi.so.6", "elfType" : 3, "buildId" : "9D9C958F1F4894AFEF6AECD90D1C430EA29AC34F" }, { "b" : "7FEE55BAD000", "path" : "/usr/lib/x86_64-linux-gnu/libwind.so.0", "elfType" : 3, "buildId" : "57E25072866B2D30CF02EBE7AE623B84F96FA700" }, { "b" : "7FEE5599E000", "path" : "/usr/lib/x86_64-linux-gnu/libheimbase.so.1", "elfType" : 3, "buildId" : "F6F1B4E9F89B716C4A0BA5819BDFFAF4A13EFB91" }, { "b" : "7FEE55753000", "path" : "/usr/lib/x86_64-linux-gnu/libhx509.so.5", "elfType" : 3, "buildId" : "C60082E3BB78D0D42868D9B359B89BF66CE5A1A7" }, { "b" : "7FEE5547E000", "path" : "/usr/lib/x86_64-linux-gnu/libsqlite3.so.0", "elfType" : 3, "buildId" : "D9782BA023CAEC26B15D8676E3A5D07B55E121EF" }, { "b" : "7FEE55246000", "path" : "/lib/x86_64-linux-gnu/libcrypt.so.1", "elfType" : 3, "buildId" : "7BDD51353D50310FFA1587E4AA01B40ABE32D582" } ] }}
mongo_database |  mongod(_ZN5mongo15printStackTraceERSo+0x41) [0x55793a34daa1]
mongo_database |  mongod(+0x23D9CB9) [0x55793a34ccb9]
mongo_database |  mongod(+0x23DA19D) [0x55793a34d19d]
mongo_database |  libpthread.so.0(+0x11390) [0x7fee59a4a390]
mongo_database |  libc.so.6(gsignal+0x38) [0x7fee596a4428]
mongo_database |  libc.so.6(abort+0x16A) [0x7fee596a602a]
mongo_database |  mongod(_ZN5mongo32fassertFailedNoTraceWithLocationEiPKcj+0x0) [0x557938982ea7]
mongo_database |  mongod(_ZN5mongo17wtRCToStatus_slowEiPKc+0x413) [0x557938a79eb3]
mongo_database |  mongod(_ZN5mongo18WiredTigerKVEngine15_openWiredTigerERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_+0x2D1) [0x557938a51161]
mongo_database |  mongod(_ZN5mongo18WiredTigerKVEngineC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_PNS_11ClockSourceES8_mbbbb+0x63F) [0x557938a5711f]
mongo_database |  mongod(+0xAC6149) [0x557938a39149]
mongo_database |  mongod(_ZN5mongo23initializeStorageEngineEPNS_14ServiceContextENS_22StorageEngineInitFlagsE+0x552) [0x5579391223a2]
mongo_database |  mongod(+0x993251) [0x557938906251]
mongo_database |  mongod(_ZN5mongo11mongoDbMainEiPPcS1_+0x10DB) [0x5579389ee94b]
mongo_database |  mongod(main+0x9) [0x557938984a39]
mongo_database |  libc.so.6(__libc_start_main+0xF0) [0x7fee5968f830]
mongo_database |  mongod(_start+0x29) [0x5579389ecab9]
mongo_database | -----  END BACKTRACE  -----
mongo_database exited with code 14

所以,显然,我在这里做错了很多。我只是不知道出了什么问题。

[谁能告诉我从Windows上的Docker容器导出/导入MongoDB数据库的正确方法是什么?对于我们来说,典型的用例是根据情况需要选择要交换的不同测试数据库。

mongodb docker
1个回答
0
投票

这是我最终设法上班的地方。这并不是我真正希望的,更多的解决方法是,但我想这总比没有好,也许这会对某些人有所帮助。

我最终使用MongoDB Compass进行了备份。如果容器配置正确,则可以使用MongoDB Compass从外部与容器连接,然后使用MongoDB Compass将数据库导出到文件中,然后再导入它们。

© www.soinside.com 2019 - 2024. All rights reserved.