I have 3 instances on EC2, each with elastic IP, and each running mongo version 3.2. All are in the replica set by the type name. The bind_ip settings in mongod.conf are configured with the IP 0.0.0.0.
I'm trying to connect mongo through php. I already have installed the extension mongodb and library.
All of which are on the same port, and the primary IP: 52.67.34.1
My connection:
$this->manager = new MongoDB\Driver\Manager(
"mongodb://52.67.34.1,52.67.77.2,52.67.30.3/?replicaSet=homologation");
But to do query or insert, it gives the following error:
Fatal error: Uncaught exception 'MongoDB \ Driver \ Exception \ ConnectionTimeoutException' with message 'No suitable servers found (
serverselectiontryonce
set): [connection error calling ismaster on '52.67.34.1:27017'] [connection error calling ismaster on '52.67.77.2:27017'] [connection error calling ismaster on '52.67.30.3:27017'] [Failed connecting to '172.31.1.1:27017': Connection timed out] [Failed connecting to '172.31.2.2:27017': Connection timed out] [Failed connecting to '172.31.3.3:27017': Connection timed out]
How do I fix this error? Connect to mongo?