我在像这样的docker容器中运行MongoDBdocker run --name mongo -d -p 27017:27107 mongo与节目核对docker ps77f1a11295c3 mongo "docker-entrypoint.s…" 20 minutes ago Up 20 minutes 27017/tcp, 0.0.0.0:27017->27107/tcp mongo所以它在正确映射端口的情况下运行。当我尝试通过 Intellij 设置连接时它失败com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Exception receiving message}, caused by {java.net.SocketException: Connection reset}}].当我尝试从 golang Web 服务器进行连接时客户端选项 := 选项。客户端()。ApplyURI(“mongodb://localhost:27017”) client, err := mongo.连接(上下文。TODO(), clientOptions)我收到此错误,它关闭了Web服务器:server selection error: server selection timeout, current topology: { Type: Unknown, Servers: [{ Addr: localhost:27017, Type: Unknown, Average RTT: 0, Last error: connection() error occured during connection handshake: connection(localhost:27017[-64]) incomplete read of message header: read tcp 127.0.0.1:40700->127.0.0.1:27017: read: connection reset by peer }, ] }这是MongoDB docker映像中的一个错误,还是我需要做其他事情?
2 回答
- 2 回答
- 0 关注
- 155 浏览
添加回答
举报
0/150
提交
取消