How to code PHP MySQL class for master and slave setup?

前端 未结 4 700
抹茶落季
抹茶落季 2020-12-11 12:38

I have never used a master/slave setup for my mysql databases so please forgive if I make no sense here.

I am curious, let\'s say I want to have a master DB and 3

4条回答
  •  醉话见心
    2020-12-11 12:57

    You should consider using mysqlnd_ms - PHP's replication and load balancing plugin.

    I think this is better solution, especially for a production environment, since it's native to PHP and MySQL Proxy is still in Alpha release.

    Useful links:

    • https://blog.engineyard.com/2014/easy-read-write-splitting-php-mysqlnd
    • http://pecl.php.net/package/mysqlnd_ms

提交回复
热议问题