[英]How to connect Robomongo to MongoDB
我的运行系统中有 MongoDB 和 Robomongo,我使用 Robomongo 作为客户端。
我已经在我将其视为服务器的不同系统上安装了 MongoDB,并且我想将我的系统(作为客户端)的 Robomongo 连接到另一个系统(服务器)上的 MongoDB。 我应该遵循哪些步骤来实现相同的目标?
我使用的是机器名称,因为系统的 IP 地址不是静态的。 但即使我使用系统的 IP 地址,我也会收到同样的错误:
连接失败,无法连接无法连接到服务器 W7IN05200067D:27017"
我直接连接到它,我没有使用任何身份验证。
我能够使用如下连接字符串将 Robomongo 连接到在 Mongo Labs 上运行的 MongoDB 远程实例:
下载最新版本的 Robomongo。 我从这里下载了 0.9 RC6。
从连接字符串中,如下填充服务器地址和端口号。
在身份验证选项卡下按如下所示填充数据库名称和用户名和密码。
测试连接。
注意:注释掉 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 中,我使用了以下连接设置:
连接选项卡:
SSH 选项卡:
SSH 地址:[VPS IP]:22
SSH 用户名:[启用 sudo 的用户的用户名]
SSH 身份验证方法:密码
用户密码:Supersecret
首先,您必须在终端中运行mongod
命令。 确保命令正确执行。
然后在新的终端选项卡中运行mongo
命令。
然后打开 Robomongo GUI 并使用默认设置创建新连接。
看起来 Robomongo 还不能与 MongoDB 3 一起使用:
目前,Robomongo 0.8.x 不适用于 MongoDB 3.0:
现在,不要使用 Robomongo。 对我来说,最好的解决方案是使用MongoChef 。
这是我们要做的:
创建一个新连接,设置名称、IP 地址和适当的端口:
如果需要,设置身份验证
(可选)为 SSL、SSH 等设置其他可用设置。
保存并连接
Robomongo 0.8.5 绝对适用于 MongoDB 3.X(我的 MongoDB 版本是 3.0.7,最新版本)。
要连接到 MongoDB 服务器,应执行以下步骤:
我从 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
我在以下屏幕中填写了它:
注释掉/etc/mongod.conf文件的bind_ip
下载https://download.robomongo.org/0.9.0-rc9/windows/robomongo-0.9.0-rc9-windows-x86_64-0bb5668.exe
连接选项卡:
3.1 名称(随便)
3.2 Address(服务器的IP地址):端口号(27017)
SSH 选项卡(我使用了普通的PuTTY连接详细信息)
4.1 SSH Address:(服务器的IP地址)
4.2 SSH 用户名(User Name)
4.3 用户密码(密码)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.