Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've installed php5-mysqlnd via:

apt-get install php5-mysqlnd

This is a brand new virgin Debian install with just apache2 and php5 via:

apt-get install apache2
echo "deb http://http.us.debian.org/debian unstable main contrib non-free" >> /etc/apt/sources.list
apt-get update
apt-get install php5 php5-dev php5-cli libapache2-mod-php5 php5-mysqlnd

When I do a phpinfo() it shows that mysqlnd is being used.

My question is, where do I place config details to specify the master/slave details so I can use automatic load balancing and read/write splitting?

I've read and followed: http://www.php.net/manual/en/mysqlnd-ms.quickstart.configuration.php

I appended:

mysqlnd_ms.enable=1
mysqlnd_ms.config_file=/etc/php5/mysqlnd_ms_plugin.ini

To /etc/php5/conf.d/10-mysqlnd.ini

Which now reads:

; configuration for php MySQL module
; priority=10
extension=mysqlnd.so

mysqlnd_ms.enable=1
mysqlnd_ms.config_file=/etc/php5/mysqlnd_ms_plugin.ini

Unfortunately these settings don't seem to have made any difference as I cannot do a mysql_connect() using the hostname "myapp" as the section name I configured in /etc/php5/mysqlnd_ms_plugin.ini as:

{
    "myapp": {
        "master": {
            "master_0": {
                "host": "127.0.0.1",
                "port": "3306"
            }
        },
        "slave": {
            "slave_0": {
                "host": "10.0.0.1",
                "port": "3306"
            }
        }
    }
}

Can anyone shed light on where I have gone wrong with the config and what I can do to get it working so I can connect using read/write splitting using my replicated DBs?

EDIT: After the comment below I realised I hadn't actually added the mysqlnd_ms plugin. After attempting to install this plugin via pecl I get an error about mysqlnd.h missing.

share|improve this question

2 Answers 2

you not only need php5-mysqlnd but also mysqlnd_ms plugin (http://pecl.php.net/package/mysqlnd_ms) installed.

share|improve this answer
    
Ahh really? That explains a lot LOL. I'll give that a go now... –  Rob Evans Mar 22 '13 at 16:51
    
Hmm doesn't really work on Debian... lots of errors. I'm trying dotdeb-based repos now... –  Rob Evans Mar 22 '13 at 19:18
    
    
My error is not the same as the link you provided. I already searched before posting this and discounted that page. –  Rob Evans Mar 24 '13 at 17:41
up vote 1 down vote accepted

So after getting errors about missing mysqlnd.h I switched to DotDeb repos and rebuilt the cloud server from scratch. After that the plugin compiled.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.