0

I generated a MongoDB dump file with the archivegz format. When I try to restore it with the mongorestore command, it won't restore.

The command for restore

mongorestore --gzip --archive="./mongo_device.bing.com_20220209-000000.archivegz" --db=Test --verbose

The result

2022-02-10T11:57:02.955+0330    using write concern: &{majority false 0}
2022-02-10T11:57:03.587+0330    will listen for SIGTERM, SIGINT, and SIGKILL
2022-02-10T11:57:03.588+0330    connected to node type: standalone
2022-02-10T11:57:03.588+0330    The --db and --collection flags are deprecated for this use-case; please use --nsInclude instead, i.e. with --nsInclude=${DATABASE}.${COLLECTION}
2022-02-10T11:57:03.740+0330    archive prelude Logger.logs
2022-02-10T11:57:03.740+0330    archive prelude Logger.DeviceChannelData
2022-02-10T11:57:03.740+0330    archive format version "0.1"
2022-02-10T11:57:03.740+0330    archive server version "4.4.3"
2022-02-10T11:57:03.740+0330    archive tool version "v3.15.0_alpha20210804-4411-g6ef8a4d4d7"
2022-02-10T11:57:03.741+0330    preparing collections to restore from
2022-02-10T11:57:03.741+0330    skipping restoring Logger.logs, it is not included
2022-02-10T11:57:03.741+0330    skipping restoring Logger.logs metadata, it is not included
2022-02-10T11:57:03.742+0330    skipping restoring Logger.DeviceChannelData, it is not included
2022-02-10T11:57:03.742+0330    skipping restoring Logger.DeviceChannelData metadata, it is not included
2022-02-10T11:57:04.208+0330    demux finishing (err:<nil>)
2022-02-10T11:57:04.208+0330    received  from namespaceChan
2022-02-10T11:57:04.208+0330    restoring up to 4 collections in parallel
2022-02-10T11:57:04.208+0330    building indexes up to 4 collections in parallel
2022-02-10T11:57:04.208+0330    0 document(s) restored successfully. 0 document(s) failed to restore.
2022-02-09T13:50:42.321+0330    preparing collections to restore from
2022-02-09T13:50:42.755+0330    0 document(s) restored successfully. 0 document(s) failed to restore.
5
  • Try with --verbose option. Usually extension is just .gz, not archivegz. Did you manipulate the dump? Feb 10 at 7:16
  • @WernfriedDomscheit I add verbose flag, Updated result
    – behroozbc
    Feb 10 at 8:30
  • How did you create the dump? Feb 10 at 10:32
  • @WernfriedDomscheit I use the command like this mongodump --archive="test.archivegz" --gzip
    – behroozbc
    Feb 10 at 20:57
  • Try filename with extension .gz (not .archivegz) According to linux.die.net/man/1/gunzip the unzip tool does not like other extensions: "gunzip takes a list of files on its command line and replaces each file whose name ends with .gz, -gz, .z, -z, _z or .Z" Feb 10 at 21:56

1 Answer 1

0

My mistake was in incorrectly setting the --db flag. When the flag is removed, the mongorestore restores the data. Use the command as described below.

mongorestore --gzip --archive="./mongo_device.bing.com_20220209-000000.archivegz"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.