无法通过 redash 连接 mongodb

Not able to connect mongodb via redash

我正在尝试连接到 mongodb 以从本地计算机进行 redash。

1) mongo 和 redash 都在独立系统上。
2) 我可以从终端连接到 mongo。之后请查看我的终端详细信息,我登录它。

rahul@rahul-VirtualBox:~$ mongo -u rahul -p
MongoDB shell version v3.6.3
Enter password: 
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.6.3
Server has startup warnings: 
2019-05-24T20:05:14.788+0530 I STORAGE  [initandlisten] 
2019-05-24T20:05:14.788+0530 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-05-24T20:05:14.788+0530 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-05-24T20:05:16.607+0530 I CONTROL  [initandlisten] 
2019-05-24T20:05:16.607+0530 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-05-24T20:05:16.607+0530 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2019-05-24T20:05:16.607+0530 I CONTROL  [initandlisten] 
> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
>

3) 我正在使用 Ubuntu 16.04 作为我的 OS.
4) 我输入的详细信息是使用 redash

连接到 Mongo

Name: Localhost_mongo
Connection String:mongodb://rahul:password@127.0.0.1:27017
Database Name:admin

5) 我遇到错误 connection refused err no:111
6) 以下是我的配置文件详细信息和位置:/etc/mongodb.conf

# mongodb.conf

# Where to store the data.
dbpath=/var/lib/mongodb

#where to log
logpath=/var/log/mongodb/mongodb.log

logappend=true

bind_ip = 0.0.0.0
port = 27017

# Enable journaling, http://www.mongodb.org/display/DOCS/Journaling
journal=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 diagnostic logging level where n is
#   0=off (default)
#   1=W
#   2=R
#   3=both
#   7=W+some reads
#diaglog = 0

# Diagnostic/debugging option
#nocursors = true

# Ignore query hints
#nohints = true

# Disable the HTTP interface (Defaults to localhost:27018).
#nohttpinterface = 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>

# Accout token for Mongo monitoring server.
#mms-token = <token>

# Server name for Mongo monitoring server.
#mms-name = <server-name>

# Ping interval for Mongo monitoring server.
#mms-interval = <seconds>

# Replication Options
#   3=both
#   7=W+some reads
#diaglog = 0

# Diagnostic/debugging option
#nocursors = true

# Ignore query hints
#nohints = true

# Disable the HTTP interface (Defaults to localhost:27018).
#nohttpinterface = 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>

# Accout token for Mongo monitoring server.
#mms-token = <token>

# Server name for Mongo monitoring server.
#mms-name = <server-name>

# Ping interval for Mongo monitoring server.
#mms-interval = <seconds>

# Replication Options

请帮忙。 感谢您的帮助。

自从您提到 redash 和 mongodb 都在独立系统上后,您是否 added iptable rules?如果您已经完成,请检查您是否在多个规则之间存在冲突。

我注意到一个用户建议注释掉你不应该做的 bind_ip 行,因为 bind_ip = 0.0.0.0 允许从所有建立连接主持人。