doctrine / doctrine/DoctrineMongoDBBundle
Replica set connection issue
- Dominant language
- PHP
- Stars
- 384
- Forks
- 228
- PR merge metrics
- No merged PRs in 30d
Description
Hi there,
I'm trying to connect to my replica set within Symfony. I have my config settings as follows as per http://symfony.com/doc/current/bundles/DoctrineMongoDBBundle/config.html#connecting-to-a-pool-of-mongodb-servers-on-1-connection
```
connections:
default:
server: 'mongodb://*.*.*.1:27017,*.*.*.2:27017,*.*.*.3:27017'
```
However I get the error:
`Uncaught PHP Exception MongoException: "Cannot run command count(): not master and slaveOk=false"`
Let me add a bit of context. Primary is `*.*.*.1` and I want to be able to connect via `*.*.*.2 or *.*.*.3` if primary goes down and one of the secondaries then become primary. If I go with just the primary mongo server IP address, instead of a comma'd list of my servers, I can connect fine, but that fails if `*.*.*.1` goes down and `*.*.*.2` becomes primary for example.
Has anyone any suggestions?
Regards
Paul Pounder
Contributor guide
Assessment
This issue has not been assessed yet.