PHP中安装主从插件

1. wget http://pecl.php.net/get/mysqlnd_ms-1.5.2.tgz 
2. tar xzvf mysqlnd_ms-1.5.2.tgz
3. cd mysqlnd_ms-1.5.2
4. /path/to/phpize
5. ./configure --enable-mysqlnd-ms --with-php-config=/usr/local/php/bin/php-config
6. make
7. make install
8. sudo /etc/init.d/php-fpm restart
9. php -m | grep mysql #看到"mysqlnd_ms"扩展表示安装成功

执行代码
      if (function_exists('mysqlnd_ms_set_qos')) {
            try {
                $db = $this->db;
                $mysqli = $db->conn_id;
                mysqlnd_ms_set_qos($mysqli, MYSQLND_MS_QOS_CONSISTENCY_SESSION);
            }catch (Exception $e) {

            }

        }