Mansoor Nathani
asked on
How do I setup Wordpress to use Master / Slave MySQL database setup?
I would like to increase performance on Wordpress. Is using a Master / Slave MySQL database setup a viable option these days?
ASKER
I guess I was intending to ask if load balancing can be performed, sending reads to a SLAVE server and only writes to a Master MySQL server.
you can, but you are relying on the two being in-sync. wordpress is not built into verifying that the two are synchronized.
As noted you could use the slave for reports where immidiate data is not as important as historical....i.e. weekly, monthly, report that does not include today.
You still have to have monitoring scripts on the slave to make sure it is synchronized... and to alert you when an issue that prevents replication or errors ....
In the abstract, wordpress if not mistaken, uses a single include file for the connection to the DB and that reference is uniform. unless you plan on rewriting to use one connection when running selects and another when running inserts excluding select into or insert into (select .......)
If your data is out of sync and you send a read request to see whether a record exists or what the current state of a record, and then based on that response do a write to the master, you might skew your data ...
As noted you could use the slave for reports where immidiate data is not as important as historical....i.e. weekly, monthly, report that does not include today.
You still have to have monitoring scripts on the slave to make sure it is synchronized... and to alert you when an issue that prevents replication or errors ....
In the abstract, wordpress if not mistaken, uses a single include file for the connection to the DB and that reference is uniform. unless you plan on rewriting to use one connection when running selects and another when running inserts excluding select into or insert into (select .......)
If your data is out of sync and you send a read request to see whether a record exists or what the current state of a record, and then based on that response do a write to the master, you might skew your data ...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Are you asking whether wordpress by itself/configuration wise could do:
1) failover to the new master should the primary fail and you have in place an automatic transition setup?
2) offload certain queries for reports etc. to hit the secondary/slave mysql to limit the load on the primary/master?
If you have two wordpress sites, you would need to use a master/master setup with each wordpress instance querying its local mysql first. and only if the local is failed use the other after notifying the admin of the mysql event. There must be other monitoring scripts/tools to manage/monitor the health the mysql/replication.
Your single line question lacks detail ... hopefully I provide something that might obtain additional detail on what you are interested in this context.