RDS realizes read-write separation via Mysql-porxy

Source: Internet
Author: User

RDS realizes read-write separation via Mysql-porxy
If your application SQL has process processing, then this scenario is not feasible, and this scenario is limited to read-write separation of SQL without process daemon.
1. The machine where MySQL is located
192.168.49.52 (Master)
192.168.49.53 (Slave)
2. Download and install Atlas
HTTPS github.com/qihoo360/atlas/releases
Note the operating system version, install the corresponding version of Atlas, which I downloaded here is atlas-2.2.el6.x86_64.rpm
It's mounted directly on the 192.168.49.50 machine.
Rpm-i atlas-2.2.el6.x86_64.rpm
3. Configure Atlas
The installation directory for Atlas is/usr/local/mysql-proxy, go to the installation directory conf directory, edit test.cnf file, many options with default values can be
[Email protected] conf]# More (www.neitui.me) test.cn
[Mysql-proxy]
#带 # is a non-required configuration item
#管理接口的用户名
Admin-username = Admin
#管理接口的密码
Admin-password = Admin
#Atlas后端连接的MySQL主库的IP和端口, multiple items can be set, separated by commas
proxy-backend-addresses = RDS Main Library Intranet IP address
#Atlas后端连接的MySQL从库的IP和端口, the number at the end of the @ represents the weight, used for load balancing, and if omitted the default is 1, you can set multiple items, separated by commas
proxy-read-only-backend-addresses = RDS Read-only library intranet IP address
#用户名与其对应的加密过的MySQL密码, password using the Prefix/bin directory encryption program encrypt encryption, downlink user1 and User2 For example, replace it with your MySQL username and encryption password!
pwds= account: Password after encryption
#设置Atlas的运行方式, set to True when the daemon mode, set to False as the foreground mode, the general development debugging is set to False, the line run when set to true,true cannot have space behind.
Daemon = True
#设置Atlas的运行方式, set to True when Atlas starts two processes, one for monitor, one for worker,monitor automatically restarts after worker exits unexpectedly, set to false when only worker, no monitor, General development debugging is set to False, the line run time set to True,true after cannot have the space.
KeepAlive = True
#工作线程数, there is a significant impact on the performance of Atlas, which can be set appropriately depending on the situation
Event-threads = 8
#日志级别, divided into a message, warning, critical, error, debug five levels
Log-level = Message
#日志存放的路径
Log-path =/usr/local/mysql-proxy/log
#SQL日志的开关, can be set to off, on, Realtime,off for not logging SQL logs, on for logging SQL logs, REALTIME for logging SQL logs and writing to disk in real time, default to OFF
Sql-log = On
#慢日志输出设置. When this parameter is set, the log only outputs log records with a execution time exceeding sql-log-slow (in ms). If you do not set this parameter, all logs are output.
#sql-log-slow = 10
#实例名称 for the distinction between multiple Atlas instances on the same machine
#instance = Test
#Atlas监听的工作接口IP和端口
Proxy-address = 0.0.0.0:1234
#Atlas监听的管理接口IP和端口
Admin-address = 0.0.0.0:2345
#分表设置, in this case, the person is the library name, MT is the table name, the ID is a sub-table field, 3 is the number of child tables, you can set multiple items, separated by commas, if the table does not need to set the item
#tables = Person.mt.id.3
#默认字符集, the client no longer needs to execute the SET NAMES statement after setting the item
#charset = UTF8
#允许连接Atlas的客户端的IP, can be a precise IP, can be an IP segment, comma-delimited, if not set the entry allows all IP connections, otherwise only allow IP connections in the list
#client-ips = Whitelist IP
#Atlas前面挂接的LVS的物理网卡的IP (note is not a virtual IP), if there is LVS and set client-ips, this key must be set, otherwise you can not set
#lvs-ips = 192.168.1.1
4. Launch Atlas
Cd/usr/local/mysql-proxy/bin
./mysql-proxyd test Start, launch atlas
./mysql-proxyd test restart, restart Atlas
./mysql-proxyd test Stop, Stop Atlas

RDS realizes read-write separation via Mysql-porxy

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.