mysql-proxy源码安装及配置mysql读写分离
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了mysql-proxy源码安装及配置mysql读写分离,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2234字,纯文字阅读大概需要4分钟。
内容图文
![mysql-proxy源码安装及配置mysql读写分离](/upload/InfoBanner/zyjiaocheng/463/5dd4810ccf484fe2b2df5aac25f8822e.jpg)
libevent
libevent-devel
glib2
glib2-devel
lua 5.1.x
lua-devel-5.1.x
pkg-config
mysql-devel
openssl
openssl-devel
gcc*
2安装MySQL-proxy 0.8.5
下载源码包并解压
在源码包路径下安装
./configure –prefix=/u01/mysql-proxy make make install
3.配置mysql-proxy.cnf
内容如下:
[mysql-proxy] admin-username=root admin-password=oracle daemon=true keepalive= true proxy-backend-addresses= 10.8.13.207:3307 proxy-read-only-backend-addresses= 10.8.13.178:3306 proxy-lua-script= /u01/mysql-proxy/share/doc/mysql-proxy/rw-splitting.lua admin-lua-script= /u01/mysql-proxy/share/doc/mysql-proxy/admin.lua log-file= /var/log/mysql-proxy.log log-level= debug
4.配置rw-splitting.lua
-- *build a connection pool of min_idle_connections for each backend and maintain -- its size -- * -- -- localcommands =require("proxy.commands") localtokenizer =require("proxy.tokenizer") locallb =require("proxy.balance") localauto_config = require("proxy.auto-config") ---config -- --connection pool if notproxy.global.config.rwsplit then proxy.global.config.rwsplit = { min_idle_connections = 1, max_idle_connections = 2, is_debug = false } end --- --read/write splitting sends all non-transactional SELECTs to the slaves -- --is_in_transaction tracks the state of the transactions localis_in_transaction = false -- ifthis was a SELECT SQL_CALC_FOUND_ROWS ... stay on the same connections localis_in_select_calc_found_rows = false --- -- get aconnection to a backend -- -- as long as we don‘t have enough connections in the pool,create new connections
视情况配置
5.启动mysql-proxy
/u01/mysql-proxy/bin/mysql-proxy --defaults-file=/etc/mysql.cnf
6.测试
mysql-proxy 服务器ip为10.8.13.251
mysql –utest -p###### -h10.8.13.251 –P4040
在多个mysql客户端连接代理做dml及select操作,可以暂停主从库,看数据查询情况,从而确定mysql-proxy读写分离是否成功。
本文出自 “DBA的天空” 博客,请务必保留此出处http://kevinora.blog.51cto.com/9406404/1768351
mysql-proxy源码安装及配置mysql读写分离
标签:mysql share
本文系统来源:http://kevinora.blog.51cto.com/9406404/1768351
内容总结
以上是互联网集市为您收集整理的mysql-proxy源码安装及配置mysql读写分离全部内容,希望文章能够帮你解决mysql-proxy源码安装及配置mysql读写分离所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。