Closed
Description
I'm trying to connect to a cluster of 2 databases.
I'm aware that you build the connection string in the getDsn function.
so I set some extra parameters in the config for mongo like below
'mongodb' => array(
'cluster' => 'true',
'host' => 'ds031708-a0.mongolab.com',
'host2' => 'ds031708-a1.mongolab.com',
'port' => port_num,
'database' => 'db_name',
'username' => 'user',
'password' => 'password',
),
and in getDsn I added this block:
if (isset($config['cluster']) and (isset($config['host2'])) and ($config['cluster'] === 'true')) {
$dsn .= ',{$host2}:{$port}';
}
However I continue to get this error:
MongoCursorException
ds031708-a0.mongolab.com:31708: not master and slaveOk=false
Is there something that I'm overlooking?
It seems that the connection string should be built properly if these conditions are met.
Metadata
Metadata
Assignees
Labels
No labels