所以我试图在Ubuntu VM上安装RocketChat和MongoDB。我已正确配置所有内容,包括使用适当的IP地址:192.168.50.56(按预期注释掉):
# network interfaces
net:
port: 27017
#bindIp: 192.168.50.56
#processManagement:
#security:
#operationProfiling:
#replication:
replication:
oplogSizeMB;
1
replSetName: rs0
当我尝试连接时,我一直收到此错误:
@RocketChat:/etc$ mongo
MongoDB shell version v3.4.7
connecting to: mongodb://127.0.0.1:27017
2017-08-16T15:05:31.690-0400 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2017-08-16T15:05:31.690-0400 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed
答案 0 :(得分:2)
如果你想让mongo监听多个接口/ ip地址,你需要列出两个ip地址。
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1,192.168.50.56
replication:
oplogSizeMB: 1
replSetName: rs0
ip可以用逗号分隔。
然后重启mongodb