Alt*_*ter 3 mongodb openshift openshift-client-tools
我创建了一个缩放的nodejs应用程序并添加了mongodb,一切运行正常(使用环境变量从nodejs内连接到mongodb).现在我想从我的本地机器连接到数据库,我无法让它在我的生活中工作.
rhc port-forward -a [myapp]
Run Code Online (Sandbox Code Playgroud)
收益:
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
Run Code Online (Sandbox Code Playgroud)
据我所知,这看起来很好,不确定这个Address already in use
部分.
当我尝试通过我的机器连接时
mongo -u admin -p [password] --host [mysubdomain].rhcloud.com --port 65211 [dbname]
Run Code Online (Sandbox Code Playgroud)
我只是得到一个
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
Run Code Online (Sandbox Code Playgroud)
所以它看起来只是端口不可达(ping
在域上工作).我直接复制了rhc port-forward
.有没有这方面经验的人?
看起来你正在连接到错误的主机,你应该像这样连接到你的localhost:
mongo -u admin -p [password] --host 127.0.0.1 --port 65211 [dbname]
归档时间: |
|
查看次数: |
3072 次 |
最近记录: |