簡體   English   中英

如何將 Robomongo 連接到 MongoDB

[英]How to connect Robomongo to MongoDB

我的運行系統中有 MongoDB 和 Robomongo,我使用 Robomongo 作為客戶端。

我已經在我將其視為服務器的不同系統上安裝了 MongoDB,並且我想將我的系統(作為客戶端)的 Robomongo 連接到另一個系統(服務器)上的 MongoDB。 我應該遵循哪些步驟來實現相同的目標?

我使用的是機器名稱,因為系統的 IP 地址不是靜態的。 但即使我使用系統的 IP 地址,我也會收到同樣的錯誤:

連接失敗,無法連接無法連接到服務器 W7IN05200067D:27017"

我直接連接到它,我沒有使用任何身份驗證。

我能夠使用如下連接字符串將 Robomongo 連接到在 Mongo Labs 上運行的 MongoDB 遠程實例:

  1. 下載最新版本的 Robomongo。 我從這里下載了 0.9 RC6。

  2. 從連接字符串中,如下填充服務器地址和端口號

    連接設置

  3. 在身份驗證選項卡下按如下所示填充數據庫名稱和用戶名和密碼

    身份驗證設置

  4. 測試連接。

    測試連接

    在此處輸入圖片說明

注意:注釋掉 bind_ip 會使您的系統容易受到安全漏洞的影響。 請參閱安全檢查表 添加更多 IP 地址比將系統開放給所有內容更好。

您需要編輯/etc/mongod.conf文件的bind_ip變量以包含您正在使用的計算機的 IP,或者完全消除它。

我能夠使用以下mongod.conf文件進行連接。 我注釋掉了bind_ip和未注釋的port

# mongod.conf

# Where to store the data.

# Note: if you run MongoDB as a non-root user (recommended) you may
# need to create and set permissions for this directory manually.
# E.g., if the parent directory isn't mutable by the MongoDB user.

dbpath=/var/lib/mongodb

# Where to log
logpath=/var/log/mongodb/mongod.log

logappend=true

port = 27017

# Listen to local interface only. Comment out to listen on all
interfaces.

#bind_ip = 127.0.0.1


# Disables write-ahead journaling
# nojournal = true

# Enables periodic logging of CPU utilization and I/O wait
#cpu = true

# Turn on/off security.  Off is currently the default
#noauth = true

#auth = true

# Verbose logging output.
#verbose = true

# Inspect all client data for validity on receipt (useful for
# developing drivers)
#objcheck = true

# Enable db quota management
#quota = true

# Set oplogging level where n is
#   0=off (default)
#   1=W
#   2=R
#   3=both
#   7=W+some reads
#diaglog = 0

# Ignore query hints
#nohints = true

# Enable the HTTP interface (Defaults to port 28017).
#httpinterface = true

# Turns off server-side scripting.  This will result in greatly limited
# functionality
#noscripting = true

# Turns off table scans.  Any query that would do a table scan fails.
#notablescan = true

# Disable data file preallocation.
#noprealloc = true

# Specify .ns file size for new databases.
# nssize = <size>

# Replication Options
# In replicated MongoDB databases, specify the replica set name here
#replSet=setname

# Maximum size in megabytes for replication operation log
#oplogSize=1024

# Path to a key file storing authentication info for connections
# between replica set members
#keyFile=/path/to/keyfile

在嘗試連接之前不要忘記重新啟動mongod服務:

service mongod restart

在 Robomongo 中,我使用了以下連接設置:

連接選項卡:

  • 地址:【VPS IP】:27017

SSH 選項卡:

  • SSH 地址:[VPS IP]:22

  • SSH 用戶名:[啟用 sudo 的用戶的用戶名]

  • SSH 身份驗證方法:密碼

  • 用戶密碼:Supersecret

  1. 首先,您必須在終端中運行mongod命令。 確保命令正確執行。

  2. 然后在新的終端選項卡中運行mongo命令。

  3. 然后打開 Robomongo GUI 並使用默認設置創建新連接。

看起來 Robomongo 還不能與 MongoDB 3 一起使用:

無法連接到 Mongo 3.0 數據庫服務器 #771

目前,Robomongo 0.8.x 不適用於 MongoDB 3.0:

現在,不要使用 Robomongo。 對我來說,最好的解決方案是使用MongoChef

這是我們要做的:

  • 創建一個新連接,設置名稱、IP 地址和適當的端口:

    連接設置

  • 如果需要,設置身份驗證

    身份驗證設置

  • (可選)為 SSL、SSH 等設置其他可用設置。

  • 保存並連接

如果沒有啟用身份驗證(用戶名/密碼)並且仍然無法連接。 只需使用本地主機和默認端口。 如果測試連接成功,請單擊“測試並保存”。

在此處輸入圖片說明

在此處輸入圖片說明

在此處輸入圖片說明

在此處輸入圖片說明

問候賈格迪什

Robomongo 0.8.5 絕對適用於 MongoDB 3.X(我的 MongoDB 版本是 3.0.7,最新版本)。

要連接到 MongoDB 服務器,應執行以下步驟:

  1. 安裝 MongoDB 服務器(在 Windows、Linux 等上,您的選擇)
  2. 運行 MongoDB 服務器。 如果你想讓客戶端通過服務器自己的IP地址連接到服務器,不要設置net.bind_ip = 127.0.0.1
  3. 如果需要,使用服務器 IP 地址從 Robomongo 連接到服務器 + 設置身份驗證。

我從 Studio 3T 導出了以下連接:

mongodb://youn-nosql-grej-test:xxxyyyzzz@youn-nosql-grej-test.documents.azure.com:10255/admin?3t.uriVersion=2&3t.certificatePreference=RootCACert:accept_any&3t.databases=admin&3t.connectionMode= direct&3t.useClientCertPassword=false&3t.connection.name=Grej-Test&readPreference=primary&ssl=true

我在以下屏幕中填寫了它:

聯系

驗證

安全證書

好的!

  1. 注釋掉/etc/mongod.conf文件的bind_ip

  2. 下載https://download.robomongo.org/0.9.0-rc9/windows/robomongo-0.9.0-rc9-windows-x86_64-0bb5668.exe

  3. 連接選項卡:

    3.1 名稱(隨便)

    3.2 Address(服務器的IP地址):端口號(27017)

  4. SSH 選項卡(我使用了普通的PuTTY連接詳細信息)

    4.1 SSH Address:(服務器的IP地址)

    4.2 SSH 用戶名(User Name)

    4.3 用戶密碼(密碼)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM