Fatal error: Uncaught exception 'MongoCursorException' with message 'mongo3:27017: not master and slaveOk=false' in ***
$this->connection = new Mongo($this->connection_string, $options);
多个mongo 在new Mongo的时候 因为没有加上 $options['readPreference']=MongoClient::RP_PRIMARY_PREFERRED;
MongoClient::RP_PRIMARY_PREFERRED
In most situations, operations read from the primary member of the set. However, if the primary is unavailable, as is the case during failover situations, operations read from secondary members.
When the read preference includes a tag set, the client reads first from the primary, if available, and then from secondaries that match the specified tags. If no secondaries have matching tags, the read operation will produce an exception.