Are there any comrades who are using MongoDB to do the read and write separation?
How does the PHP extension implement MongoDB read-write separation?
Reply content:
Are there any comrades who are using MongoDB to do the read and write separation?
How does the PHP extension implement MongoDB read-write separation?
Can be a layer of ORM, such as the addition of Select,insert,update orm three methods, pointing to different servers, so that you can easily implement the read separation, you can refer to the thinkphp read separation mechanism
MongoDB has a bit of a pit in the MapReduce query, if there is an out result to the new set this does not know how to deal with it.
A master multiple from a replica set can write master read from by specifying the read_preferences implementation.
Extensions directly specify Read_preferences.
MongoDB does not recommend the use of Master/slave way to do read and write separation, so it is best not to do so, using replica sets bar.
Replica sets replace Master-slave replication for most use cases. If possible, use replica sets rather than Master-slave replication for all new production deployments. This documentation remains to support legacy deployments and for archival purposes only.
If you want to optimize read and write performance, you should try using auto-sharding, which mongos
dynamically balances the pressure of each database as a DB proxy.