AWS Thinkbox Discussion Forums

MongoDB Compass and MongoDB PyMongo Client

Hi,

I can connect from Compass, but I can’t connect from pymongo. Can you help me?

mongo = pymongo.MongoClient(
host="192.168.1.27", 
port=27100,
connectTimeoutMS=1000,
username="OU=Deadline10Client,O=Deadline10Installer,CN=Deadline10Client",
authMechanism="MONGODB-X509",
ssl_cert_reqs=ssl.CERT_REQUIRED,
ssl_ca_certs="C:\\Users\\AdminTest\\Desktop\\certs\\ca2.crt",
ssl_certfile="C:\\Users\\AdminTest\\Desktop\\certs\\mongo_client.pem", 
ssl_keyfile="C:\\Users\\AdminTest\\Desktop\\certs\\mongo_client.pem",
ssl_pem_passphrase="VERY_LONG_PASSWORD"
)
print(mongo.server_info())
print(mongo.list_database_names())

I also can’t connect from the command line :frowning:

userforubuntu@Notebook:/mnt/c/Users/AdminTest/Desktop/certs$ mongo "deadline10db" --host "192.168.1.27" --port 27100 -ssl -sslPEMKeyFile mongo_client.pem --sslCAFile ca2.crt --authenticationMechanism "MONGODB-X509"  --username "OU=Dead
line10Client,O=Deadline10Installer,CN=Deadline10Client" --authenticationDatabase "$external"
Enter PEM passphrase
MongoDB shell version v3.6.3
connecting to: mongodb://192.168.1.27:27100/deadline10db
2019-01-10T06:52:26.097+0300 E NETWORK  [thread1] The server certificate does not match the host name. Hostname: 192.168.1.27 does not match CN: Master-Server
2019-01-10T06:52:26.099+0300 E QUERY    [thread1] Error: socket exception [CONNECT_ERROR] for The server certificate does not match the host name. Hostname: 192.168.1.27 does not match CN: Master-Server :
connect@src/mongo/shell/mongo.js:251:13
@(connect):1:6
exception: connect failed 

MongoDB Compass

Privacy | Site terms | Cookie preferences