如何将Robomongo连接到MongoDB

Kar*_*ade 41 mongodb robo3t

我在运行系统中使用MongoDB和Robomongo,我使用Robomongo作为客户端,我在不同的系统上安装了MongoDB,我将其视为服务器,我想将系统的Robomongo(作为客户端)连接到其他系统上的MongoDB(服务器).我应该遵循哪些步骤来实现相同的目标?任何线索都会有所帮助.提前致谢

Vai*_*hav 58

我能够使用连接字符串将Robomongo连接到在Mongo Labs上运行的Mongo DB的远程实例,如下所示:

  1. 下载最新的Robomongo.我从这里下载了0.9 RC6 .

  2. 从连接字符串中,按如下方式填充服务器地址和端口号.

连接设置

  1. 在身份验证选项卡下填写数据库名称,用户名和密码,如下所示.

验证设置

  1. 测试连接.

测试连接 在此输入图像描述

希望这有帮助!

  • 因为该死的细节导向的道具! (11认同)

Sha*_*han 20

编辑:注释掉bind_ip可能会使您的系统容易受到安全漏洞的影响,请参阅https://docs.mongodb.com/manual/administration/security-checklist/#limit-network-exposure 添加更多IP更好打开你的系统到一切.

您需要编辑/etc/mongod.conf文件的bind_ip变量以包含您正在使用的计算机的IP,或者完全取消它.

我能够使用以下mongod.conf连接,我注释掉了bind_ip和未注释的端口.

# 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 mongo 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
Run Code Online (Sandbox Code Playgroud)

在尝试连接之前不要忘记重启mongod服务:

service mongod restart
Run Code Online (Sandbox Code Playgroud)

从robomongo我使用以下连接设置:

连接选项卡:

地址:[VPS IP]:27017

SSH标签:

SSH地址:[VPS IP]:22

SSH用户名:[启用sudo的用户名]

SSH验证方法:密码

用户密码:Supersecret


Man*_*ore 5

  1. 首先,您必须mongod在终端中运行命令,确保命令正确执行.

  2. 然后在新的终端选项卡运行mongo命令.

  3. 然后打开Robomongo GUI并使用默认设置创建新连接.

希望这将解决您的问题

干杯!!


sep*_*ehr 2

这就是我们所做的:

  • 创建一个新连接,设置名称、IP 地址和适当的端口:

    连接设置

  • 如果需要,设置身份验证

    认证设置

  • (可选)设置 SSL、SSH 等其他可用设置。

  • 保存并连接