I am using MongoDB Atlas cloud services with my Symfony 3 application and I am having lots of warnings in my PHP logs saying MongoClient::__construct(): SSL: Connection reset by peer
. Even though I have warnings some times, I can connect successfully and read/write to the server.
I use Doctrine ODM which uses MongoClient
for connecting to the server. I have configured the replicaSet
according to MongoDB Atlas configuration.
When I look at MongoDB logs, I do not see any strange thing that appears to be linked to my issue.
Here is my connection string: mongodb://<USERNAME>:<PASSWORD>@datalake-shard-00-00-lnres.mongodb.net:27017,datalake-shard-00-01-lnres.mongodb.net:27017,datalake-shard-00-02-lnres.mongodb.net:27017/test?ssl=true&replicaSet=DataLake-shard-0&authSource=admin
Here is my Doctrine ODM config
doctrine_mongodb:
connections:
default:
server: "mongodb://<USERNAME>:<PASSWORD>@datalake-shard-00-00-lnres.mongodb.net:27017,datalake-shard-00-01-lnres.mongodb.net:27017,datalake-shard-00-02-lnres.mongodb.net:27017/test?ssl=true&replicaSet=DataLake-shard-0&authSource=admin"
options:
authMechanism: SCRAM-SHA-1
authSource: admin
connect: true
ssl: true
password: "<PASSWORD>"
username: "<USERNAME>"
readPreference: secondaryPreferred
replicaSet: "DataLake-shard-0"
default_database: "test"
document_managers:
default:
auto_mapping: true
retry_connect: 4
retry_query: 4