CMa*_*ker 3 mongodb mongorestore azure-cosmosdb-mongoapi
我正在尝试使用 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 中都有效。
Jth*_*rpe 14
我发现各种 mongotools(mongoimport、mongorestore 等)似乎忽略了URI 中的retrywrites=false或retryWrites=false,但是添加该选项--writeConcern="{w:0}"允许命令在不支持可重试写入的实例上成功运行
| 归档时间: |
|
| 查看次数: |
1200 次 |
| 最近记录: |