MongoDB Atlas (4.2.5) 到 DocumentDB (3.6)
下面是我在 MongoDB shell 上用于 mongodump 的命令。我收到了警告,但它已成功完成。
C:\MongoDB\bin>mongodump --host xxxxxx.mongodb.net:27017,xxxxxxx.mongodb.net:27017,xxxxxxmongodb.net:27017 --ssl --username Mdocdb --password xxxxx --authenticationDatabase admin --db sample_airbnb
2020-04-14T03:18:49.832+0530 WARNING: ignoring unsupported URI parameter 'replicaset'
2020-04-14T03:18:53.429+0530 writing sample_airbnb.listingsAndReviews to
2020-04-14T03:18:55.832+0530 [........................] sample_airbnb.listingsAndReviews 0/5555 (0.0%)
2020-04-14T03:18:58.832+0530 [........................] sample_airbnb.listingsAndReviews 0/5555 (0.0%)
.
.
2020-04-14T03:26:34.177+0530 [########################] sample_airbnb.listingsAndReviews 5555/5555 (100.0%)
2020-04-14T03:26:34.204+0530 done dumping sample_airbnb.listingsAndReviews (5555 documents)
在 AWS Ec2 实例上,我发出以下命令来恢复数据库,但它出错了。
[ec2-user@xxxxx sample_airbnb]$ ls -lrt
total 92156
-rw-rw-r-- 1 ec2-user ec2-user 738 Apr 13 21:48 listingsAndReviews.metadata.json
-rw-rw-r-- 1 ec2-user ec2-user 94362191 Apr 13 21:56 listingsAndReviews.bson
[ec2-xxx@xxxxxx ~]$ mongorestore --db airbnb sample_airbnb/ --ssl --host first-docdbxxxxxxxxus-east-2.xxx.amazonaws.com:27017 --sslCAFile rdsxxxxbundle.pem --username systemuser --password xxxxxx
2020-04-14T07:41:42.330+0000 checking for collection data in sample_airbnb/listingsAndReviews.bson
2020-04-14T07:41:42.333+0000 reading metadata for airbnb.listingsAndReviews from sample_airbnb/listingsAndReviews.metadata.json
2020-04-14T07:41:42.333+0000 restoring airbnb.listingsAndReviews from sample_airbnb/listingsAndReviews.bson
2020-04-14T07:41:42.771+0000 error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.100+0000 error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.195+0000 error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.257+0000 error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.261+0000 error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.355+0000 error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.356+0000 error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.426+0000 error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.467+0000 error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.469+0000 error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.469+0000 restoring indexes for collection airbnb.listingsAndReviews from metadata
2020-04-14T07:41:43.470+0000 Failed: airbnb.listingsAndReviews: error creating indexes for airbnb.listingsAndReviews: createIndex error: Field '2dsphereIndexVersion' is currently not supported
由于索引失败,我避免使用--noIndexRestore
密钥恢复索引。还原已完成,尽管之前的十进制错误仍然存在。
.
.
.
2020-04-14T07:42:01.284+0000 error: Unsupported BSON : type Decimal128
2020-04-14T07:42:01.284+0000 no indexes to restore
2020-04-14T07:42:01.284+0000 finished restoring airbnb.listingsAndReviews (5555 documents)
2020-04-14T07:42:01.284+0000 done
但是,恢复的数据库的集合下没有数据。有什么问题?
PS:我能够成功导入到我的本地机器MongoDB(4.2.5)。所以这与版本兼容性有关吗?
在我的本地数据库上:-
C:\MongoDB\bin>mongorestore --db sample_airbnb dump\sample_airbnb\listingsAndReviews.bson
2020-04-14T13:08:42.003+0530 checking for collection data in dump\sample_airbnb\listingsAndReviews.bson
2020-04-14T13:08:42.006+0530 reading metadata for sample_airbnb.listingsAndReviews from dump\sample_airbnb\listingsAndReviews.metadata.json
2020-04-14T13:08:42.066+0530 restoring sample_airbnb.listingsAndReviews from dump\sample_airbnb\listingsAndReviews.bson
2020-04-14T13:08:43.057+0530 restoring indexes for collection sample_airbnb.listingsAndReviews from metadata
2020-04-14T13:08:43.451+0530 finished restoring sample_airbnb.listingsAndReviews (2874 documents, 0 failures)
2020-04-14T13:08:43.451+0530 2874 document(s) restored successfully. 0 document(s) failed to restore.