我在 AWS 上运行 mongodb。

当我sudo service mongod start在端口运行 mongo27017时,应用程序和数据库之间的数据通信工作完美。但是,我无法使用 MongoDB Compass SSH 连接来连接它。它说Error creating SSH Tunnel: (SSH) Channel open failure: Connection refused

当我检查netstat端口27017是否正在监听时。另外,我无法启动另一个 mongo 实例,因为该端口已被监听。

Funny thing is that if I stop the serivce by going sudo service mongod stop and if I don't run it as a service but just run it on the terminal by going sudo mongod, I can connect via SSH just fine. Why is this?


看看ianlondon.github.io/blog/mongodb-auth