2017-03-24 55 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的更多詳細信息。