2017-03-24 93 views
-2

我想从集合的数据库转储文件中运行mongorestore.exe到DocumentDB数据库。我有使用MongoDB和Azure的经验,但对DocumentDB没有太多的经验。从MongoDB到DocumentDB的mongorestore

如果我用命令从this tutorial我得到一个错误

error parsing command line options: unknown option "ssl"

我在本地安装了最新稳定版本3.2.4的MongoDB社区服务器“Windows Server 2008 R2 64位及更高版本,带SSL支持x64”。 它看起来像--ssl命令自版本3以来可能不可用(link)。

但是,SSL由DocumentDB执行。

任何想法如何将现有的数据库从MongoDB迁移到DocumentDB?数据库相当大(〜GB),因此mongoimport需要很长时间,我们需要用户mongorestore。

更新,命令例如:

mongorestore.exe --host myhost123.documents.azure.com:10250 -u myhost123 -p somepassword== --db myhost123 --ssl --sslAllowInvalidCertificates 

给了我这个错误:

error parsing command line options: unknown option "ssl"

如果我删除了两个SSL选项(--ssl --sslAllowInvalidCertificates)我回来了错误哪一种因为SSL在Azure DocumentDB上实施:

Failed: error connecting to db server: no reachable servers

+0

我会建议编辑你的问题,以显示你使用的确切的命令行(模糊任何真正的数据库连接字符串,密码等)。并显示确切的错误。否则,猜测真的很难。 –

+0

谢谢,大卫,我已经更新了我的问题 – Piki

+0

'--ssl'选项_is_在mongo v3.2中有效;如果链接的文档中显示“版本3.0_中的_Changed”,则更改是以前大多数分发不支持ssl;但是从v3.0开始,大多数发行版都是_do_。 –

回答

0

根据您的描述n,我安装了MongoDB社区服务器Windows Server 2008 R2 64-bit and later, with SSL support x64 -3.4.3,并关注此官方tutorial关于使用mongorestore将数据导入MongoDB的API。一些试验后,我可以恢复由mongodump产生到我的Azure的DocumentDB(MongoDB的API)我的本地文件,如下所示:

enter image description here

Failed: error connecting to db server: no reachable servers

我也遇到了这个错误,并发现它是由IP引起的访问控制, 我的当前IP不包括在允许的客户端IP地址列表中。您可以找到有关DocumentDB防火墙here的更多详细信息。