MySQL read and write separation of Mysql-proxy

Source: Internet
Author: User
Tags lua

Official website: http://dev.mysql.com/downloads/mysql-proxy

Learning version: mysql-proxy-0.8.5-1.el6.x86_64

Environment Preparation: mysql_a (10.0.13-mariadb) Read and write :n1.test.com;172.16.2.11 Mysql_b ( 10.0.13-mariadb) Read only: n2.test.com;172.16.2.12       Mysql-proxy ( 0.8.5):n3.test.com;172.16.2.13 Mysql-proxy:epel Source: yum-y Install mysql-proxy read/write separation using the Rw-splitting.lua script in the official binary format file # Mysql-proxy--help-all==> Command HelpConfiguration file:/etc/mysql-proxy.cnf
[Mysql-proxy]daemon = Truepid-file =/var/run/mysql-proxy.pidlog-file =/var/log/mysql-proxy.loglog-level = Debug        #调试级别max-open-files = 1024plugins = Admin,proxyuser = mysql-proxy# #Proxy configurationproxy-address = 0.0.0.0:3306        #代理服务监听的地址和端口proxy-backend-addresses = 172.16.2.11:3306        #支持读写操作的后端mysql                       proxy-read-only-backend-addresses = 172.16.2.12:3306        # read-only backend #proxy-lua-script = Proxy-lua-script =/usr/lib64/ Mysql-proxy/lua/rw-splitting.lua        #读写分离脚本 #proxy-skip-profiling = true## Admin configurationadmin-address = 0.0.0.0:4041        #msyql-prxoy-connected management Port Admin-lua-script =/usr/lib64/mysql-proxy/lua/admin.lua         # Msyql-prxoy Admin Script Location admin-username = admin         #msyql-prxoy Admin Account admin-password = admin         #msyql-prxoy admin password to be connected
mysql-proxy.cnf

Back-end hosts need to create an authorized account
    • mysql> GRANT All on * * to [e-mail protected] ' 172.16.%.% ' identified by ' cm ';  
    • mysql> FLUSH privileges;
initiate a query or modify a statement in Mysql-proxy
    • # mysql-uroot-h172.16.2.13-pcm-e ' SHOW DATABASES; '   
    • # mysql-uroot-h172.16.2.13-pcm-e ' CREATE DATABASE test9; '
    • MySQL on the back end can see the created database Test9
Native Login Mysql-proxy Management
    • # mysql-uadmin-padmin-p4041-h172.16.2.13
Get help after mysql-proxy after landing on the machine
    • Mysql> SELECT * from Help
After the native login mysql-proxy after the query backend node
    • mysql> SELECT * from backends;  

MySQL read and write separation of Mysql-proxy

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.