以下是我用来进行mongo转储的命令。
[centos@k8smaster1 backup]$ mongodump --gzip -o /home/centos/backup
我有3个与每个数据库相关的文件夹
[centos@k8smaster1 backup]$ ls
admin do-backup report-mgmt-db
我正在尝试使用以下命令还原mongo,
[centos@k8smaster1 backup]$ mongorestore --gzip --db report-mgmt-db report-mgmt-db/
以下是错误report-mgmt-db数据库,所有其他数据库都面临相同的问题。
[centos@k8smaster1 backup]$ mongorestore --gzip --db report-mgmt-db report-mgmt-db/
2019-07-11T10:12:45.314-0500 building a list of collections to restore from report-mgmt-db dir
2019-07-11T10:12:45.315-0500 don't know what to do with file "report-mgmt-db/report-scheduler.bson.gz", skipping...
2019-07-11T10:12:45.315-0500 don't know what to do with file "report-mgmt-db/report-scheduler.metadata.json.gz", skipping...
2019-07-11T10:12:45.315-0500 reading metadata for report-mgmt-db.report-scheduler from report-mgmt-db/report-scheduler.metadata.json
2019-07-11T10:12:45.315-0500 restoring report-mgmt-db.report-scheduler from report-mgmt-db/report-scheduler.bson
2019-07-11T10:12:45.318-0500 error: multiple errors in bulk operation:
- E11000 duplicate key error collection: report-mgmt-db.report-scheduler index: _id_ dup key: { : ObjectId('5d19b1d214ce610001a05d24') }
- E11000 duplicate key error collection: report-mgmt-db.report-scheduler index: _id_ dup key: { : ObjectId('5d19b1d214ce610001a05d25') }
2019-07-11T10:12:45.318-0500 restoring indexes for collection report-mgmt-db.report-scheduler from metadata
2019-07-11T10:12:45.318-0500 finished restoring report-mgmt-db.report-scheduler (2 documents)
2019-07-11T10:12:45.318-0500 done
注意: 我要还原的数据库是一个已经使用过的数据库,在其中删除了现有数据库。
我找不到导致此问题的任何原因,并且我使用了mongodb文档中定义的命令。
请帮助我解决此问题。