I have a docker-compose.yml
file that runs a MongoDB instance. This is happening on a remote server.
The port for MongoDB is not exposed to the internet.
I am trying to be able to connect to this MongoDB instance.
version: "2.1"
services:
...
database:
image: mongo
volumes:
- data:/data/db
ports:
- "127.0.0.1:27017:27017"
volumes:
data:
name: data
When I used the "Test Connection" feature...
Connection failed.
SERVER [example.com:22] (Type: UNKNOWN) |_/ Database error (MongoInternalException): The reply message length 759714643 is greater than the maximum message length 33554432
Details: Timed out after 5000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=example.com:22, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoInternalException: The reply message length 759714643 is greater than the maximum message length 33554432}}]
The connection string is...
mongodb://example.com:22/?serverSelectionTimeoutMS=5000&connectTimeoutMS=10000&3t.uriVersion=3&3t.connection.name=production&3t.ssh=true&3t.sshAddress=example.com&3t.sshPort=22&3t.sshAuthMode=password&3t.sshUser=root&3t.alwaysShowAuthDB=true&3t.alwaysShowDBFromUserRole=true
It worked when having the port exposed publicly to the internet, but I would like to avoid that.
You connect to port 22 but the MongoDB runs on port 27017. Port 22 is only used for the SSH tunnel.