Install MySQL Proxy in RHEL5.5

Source: Internet
Author: User

(1) version: 1. Operating System: RHEL5.5
2.mysql-proxy-0.8.1-linux-rhel5-x86-64bit.tar.gz
(2) installation 1. Extract mysql-proxy-0.8.1-linux-rhel5-x86-64bit.tar.gz directly.(Note: the source code has not been downloaded for self-compilation. Cause: It is too troublesome. Version 0.8.1 requires pkg-config, glib2, and so on. The system version is too low, Re-compile these packages, it is very troublesome) 2. Add environment variables:# Vi/etc/profileAdd at the end of the filePATH = "/usr/local/mysql-proxy-0.8.1/bin: $ PATH"ThenSave#Source/etc/profile3. Add a configuration file: # Vi/etc/my-proxy.cnfContent:[Mysql-proxy]
Daemon = true -- running mode
Keepalive = true -- automatically restarts after the process exits unexpectedlyUser = mysql -- mysql-proxy user
Admin-address = 192.168.128.130: 4041 -- manage the address and port
Proxy-address = 192.168.128.130: 4040 -- backend server access address and port
Admin-username = admin -- Access Management Username
Admin-password = 123456-- Access management password
Admin-lua-script =/usr/local/mysql-proxy-0.8.1/share/doc/mysql-proxy/admin-sql.lua -- manage lua scripts
Proxy-read-only-backend-addresses = 192.168.128.140: 3306,192.168.128.141: 3306 -- Read-Only server (slave)
Proxy-backend-addresses = 192.168.128.130: 3306 -- Backend read/write server (master)
Proxy-lua-script =/usr/local/mysql-proxy-0.8.1/share/doc/mysql-proxy/rw-splitting.lua -- read/write splitting script
Log-file =/usr/local/mysql-proxy-0.8.1/log/my-proxy.log -- log file Location
Log-level = debug -- Log Level
# Similarly,You can write all the content of the preceding configuration file to the startup command line, for example:# Mysql-proxy
Daemon = true

Keepalive = true
User = mysql
Admin-address = 192.168.128.130: 4041

Proxy-address = 192.168.128.130: 4040

Admin-username = admin

Admin-password = 123456

Admin-lua-script =/usr/local/mysql-proxy-0.8.1/share/doc/mysql-proxy/admin-sql.lua

Proxy-read-only-backend-addresses = 192.168.128.140: 3306

Proxy-read-only-backend-addresses =
192.168.128.141: 3306
Proxy-backend-addresses = 192.168.128.130: 3306

Proxy-lua-script =/usr/local/mysql-proxy-0.8.1/share/doc/mysql-proxy/rw-splitting.lua
Log-file =/usr/local/mysql-proxy-0.8.1/log/my-proxy.logLog-level = debug4. mysql-proxy -- help-all -- view all help commands

5. Start mysql-proxy
# Mysql-proxy -- defaults-file =/etc/my-proxy.cnf
Disable mysql-proxy
# Killall-9 mysql-proxy

Connect to the database through proxy
# Mysql-h 192.168.128.130-u xxx-pxxx-P4040

6. Test
Table Structure: create table mytest (id int, name varchar (30), address varchar (30), job varchar (30 ));
Insert Database: Use a random string to insert 0.1 million records.
Result: the time consumed by proxy is 41.5310630798 seconds.
Direct mysql, time consumed: 33.9793388844

The difference is not obvious. I don't know why the data volume is not large enough.

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.