我创建了一个缩放的 nodejs 应用程序并添加了 mongodb,一切运行良好(使用环境变量从 nodejs 内连接到 mongodb)。现在我想从我的本地机器连接到数据库,但我无法让它为我的生活工作。
rhc port-forward -a [myapp]
返回:
Forwarding ports ...
Address already in use - bind(2) while forwarding port 8080. Trying local port 8081
Address already in use - bind(2) while forwarding port 8080. Trying local port 8081
Address already in use - bind(2) while forwarding port 8081. Trying local port 8082
To connect to a service running on OpenShift, use the Local address
Service Local OpenShift
------- --------------- ---- -------------------------------------------------
haproxy 127.0.0.1:8080 => 127.2.114.130:8080
haproxy 127.0.0.1:8081 => 127.2.114.131:8080
mongodb 127.0.0.1:65211 => [mysubdomain].rhcloud.com:65211
node 127.0.0.1:8082 => 127.2.114.129:8080
据我所知,这看起来不错,不确定Address already in use
部分。
尝试通过我的机器连接时
mongo -u admin -p [password] --host [mysubdomain].rhcloud.com --port 65211 [dbname]
我只是得到一个
Error: couldn't connect to server [mysubdomain].rhcloud.com:65211 (54.197.84.134), connection attempt failed at src/mongo/shell/mongo.js:148
exception: connect failed
因此,看起来该端口无法访问(ping
在域上有效)。我直接从rhc port-forward
. 有人对这个问题有任何经验吗?