[HyperDB] Splitting READs and WRITEs

Barry Abrahamson barry at automattic.com
Tue Mar 2 23:55:57 UTC 2010


On Mar 2, 2010, at 12:05 PM, J M wrote:

> i have this configuration:
> 
> add_db_server('global',0,'slave1',1,0,'192.168.136.141:3306','
> 192.168.136.141:3306',wordpress,user,user);
> // Slave DB
> 
> add_db_server('global',0,'master1',2,1,'192.168.136.70:3306','
> 192.168.136.70:3306',wordpress,user,user);
> // Master DB
> 
> 
> 
> -- enabled logging in mysql but some reason not select's are being thrown to
> the "slave1" node.. all SQL are being executed on "master"
> 
> any ideas why? did i miss something?

This shouldn't happen unless:

1) The slave is not available (are you sure you are able to connect?)
2) There is a write query on the same page load as the read queries - if there is a write, HyperDB will send all subsequent reads on that page load to the master to try and alleviate possible data inconsistency caused by replication lag.

Any errors in your logs?

--
Barry Abrahamson | Systems Wrangler | Automattic
Blog: http://barry.wordpress.com





More information about the HyperDB mailing list