无法连接到mongodb服务

时间:2018-08-10 14:27:10

标签: mongodb swisscomdev

我创建了 mongodb 服务,然后创建了服务密钥来访问数据库,但是无法连接。这是我尝试使用Studio 3T的响应:

Connection failed.

SERVER [kubernetes-service-node.service.consul:XXX] (Type: UNKNOWN) 
|_/ Connection error (MongoSocketOpenException): Exception opening socket
|____/ Unknown host: kubernetes-service-node.service.consul

SERVER [kubernetes-service-node.service.consul:XXX] (Type: UNKNOWN) 
|_/ Connection error (MongoSocketOpenException): Exception opening socket
|____/ Unknown host: kubernetes-service-node.service.consul

SERVER [kubernetes-service-node.service.consul:XXX] (Type: UNKNOWN) 
|_/ Connection error (MongoSocketOpenException): Exception opening socket
|____/ Unknown host: kubernetes-service-node.service.consul

Details:
Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=kubernetes-service-node.service.consul:XXX, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.UnknownHostException: kubernetes-service-node.service.consul}}, {address=kubernetes-service-node.service.consul:XXX, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.UnknownHostException: kubernetes-service-node.service.consul}}, {address=kubernetes-service-node.service.consul:XXX, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.UnknownHostException: kubernetes-service-node.service.consul}}]

我应该如何连接?我想念什么吗?

1 个答案:

答案 0 :(得分:1)

服务未公开到互联网。将应用程序绑定到服务后即可连接。如果您需要从外部(即通过Internet)连接到服务,则需要使用cf ssh打开ssh隧道。有关更多详细信息,请参阅以下指南: https://docs.developer.swisscom.com/devguide/deploy-apps/ssh-services.html