【发布时间】:2020-09-15 11:30:01
【问题描述】:
我正在尝试使用 mongodump 和 mongorestore 使用 MongoDB API 将数据从旧 MongoDB 数据库服务器导出和导入到 Azure CosmosDB。但我在连接到 CosmosDB 时遇到问题。我正在使用带有 URI 标志的连接字符串。
我的 mongorestore 命令包括连接字符串如下:
mongorestore --uri="mongodb://$COSMOS_USERNAME:$COSMOS_PASSWORD@$COSMOS_HOST:$COSMOS_PORT/?maxIdleTimeMS=120000&retrywrites=false&appName=@$DB_NAME@&replicaSet=globaldb&ssl=true" --archive="$ARCHIVE_NAME"
命令的错误信息是:
error restoring from archive 'testProdExport.archive': (BadValue) Retryable writes are not supported. Please disable retryable writes by specifying "retrywrites=false" in the connection string or an equivalent driver specific config.
正如您在连接字符串中看到的,我包含 retrywrites=false URI 参数,但看起来 CosmosDB 无法识别该参数。
有人有类似的经验吗?
//编辑:我已经尝试并验证了连接字符串在 mongoose 连接以及 MongoDB Compass 中工作。
【问题讨论】:
-
是什么产生了这条消息 - mongorestore 或 cosmosdb?驱动程序不会向服务器发送“retryWrites”,这是一个仅限客户端的参数。服务器将其作为交易号接收。
-
这也是我的问题。其实我不知道。
-
什么是mongorestore版本?
-
您要恢复到的服务器的 ismaster 输出是什么。
-
mongorestore version: 100.1.1 { ismaster: true, maxBsonObjectSize: 16777216, maxMessageSizeBytes: 48000000, maxWriteBatchSize: 1000, localTime: 1600175975194, logicalSessionTimeoutMinutes: 30, minWireVersion: 0, maxWireVersion:6 , 标签:{ region: 'West Europe' }, hosts: ['
-westeurope.mongo.cosmos.azure.com:10255'], setName: 'globaldb', setVersion: 1, primary: ' -westeurope.mongo.cosmos.azure.com:10255',我:'-westeurope.mongo.cosmos.azure.com:10255',connectionId:620417038,ok:1}
标签: mongodb azure-cosmosdb-mongoapi mongorestore