You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

从MongoDB Atlas恢复至AWS DocumentDB时遇atlasVersion命令错误

解决MongoDB Atlas备份恢复到AWS DocumentDB的问题

1. 处理「Unknown admin command atlasVersion」错误

这个错误是因为MongoDB Atlas导出的备份里包含了Atlas专属的系统集合(比如admin.atlasVersion),而AWS DocumentDB不支持这类Atlas特有的命令与集合。

解决方式是在mongorestore命令中添加--excludeCollection参数,排除这些Atlas专属集合:

mongorestore --ssl --host="<hostname>:27017" --username=<username> --password --sslCAFile rds-combined-ca-bundle.pem --excludeCollection=atlasVersion /home/ubuntu/file

如果后续仍有其他Atlas相关系统集合报错,可以追加多个--excludeCollection参数,比如用--excludeCollection=atlas*匹配所有以atlas开头的集合。

2. 处理密码可见的安全警告

直接在命令行输入密码会被ps等系统进程捕获,存在安全隐患。可以通过两种方式规避:

  • 移除命令中的--password=<password>,仅保留--password,执行命令后终端会提示输入密码,输入内容不会明文显示。
  • 使用配置文件:创建一个包含认证信息的配置文件(比如mongorestore.conf):
    username: "<你的用户名>"
    password: "<你的密码>"
    
    然后在命令中用--config mongorestore.conf加载该配置。

内容的提问来源于stack exchange,提问作者Krishnakumar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.25 13:02:36