MYSQL-MHA Pre-release environment architecture share (iv) read/write Separation of Atlas

Source: Internet
Author: User
Tags lua


RPM-IVH atlas-2.2.1.el5.x86_64.rpm "RPM Package Direct Installation"


RPM-QL Atlas "View installation path"


Grep-v ' ^# '/usr/local/mysql-proxy/conf/test.cnf |grep-v ' ^$ ' > Lipengfei ' filter garbage prompt '


MV Test.cnf Test.cnf.old


Cat Lipengfei > TEST.CNF





/usr/local/mysql-proxy/bin/encrypt MySQL "MySQL is my password, password encryption"

twbz0dlu35u=



Vi/usr/local/mysql-proxy/conf/test.cnf


[Mysql-proxy]

Plugins = Admin,proxy

Admin-username=admin

Admin-password=admin

Admin-lua-script =/usr/local/mysql-proxy/lib/mysql-proxy/lua/admin.lua

Proxy-backend-addresses = 10.142.132.49:3306

Proxy-read-only-backend-addresses = 10.142.132.47:3306,10.142.132.48:3306

PWDs = root:twbz0dlu35u=

Daemon = True

KeepAlive = True

Event-threads = 8

Log-level = Message

Log-path =/usr/local/mysql-proxy/log

Instance = Test

Proxy-address = 0.0.0.0:1234

Admin-address = 0.0.0.0:5678

#min-idle-connections = 128

charset = UTF8








Viewing the Listening port

NETSTAT-TANLP | grep MySQL



Open


/usr/local/mysql-proxy/bin/mysql-proxyd Test Start

/usr/local/mysql-proxy/bin/mysql-proxyd Test Stop



Login Management


Mysql-h 10.142.132.50-p 5678-u Admin-padmin

Normal operation via proxy


Mysql-h 10.142.132.50-p 1234-u Root-pmysql


SHOW VARIABLES like ' server_id ';




Mysql> select * from Help;

+-------------------+---------------------------------------+

| Command | Description |

+-------------------+---------------------------------------+

| SELECT * FROM Help | Shows this Help |

| SELECT * from Backends | Lists the backends and their state |

| SET OFFLINE $backend _id | Offline backend server, $backend _id is backend_ndx ' s ID |

| SET ONLINE $backend _id | Online backend server, ... |

| ADD MASTER $backend | Example: "Add Master 127.0.0.1:3306", ... |

| ADD SLAVE $backend | Example: "Add slave 127.0.0.1:3306", ... |

| REMOVE Backend $backend _id | Example: "Remove backend 1", ... |

| ADD CLIENT $client | Example: "Add client 192.168.1.2", ... |

| REMOVE CLIENT $client | Example: "Remove client 192.168.1.2", ... |

| SAVE CONFIG | Save the backends to config file |

+-------------------+---------------------------------------+

Rows in Set (0.00 sec)

Mysql> select * from Backends;

+-------------+-------------------+-------+------+

|           Backend_ndx | Address |  State | Type |

+-------------+-------------------+-------+------+

| 1 | 192.168.0.42:3306 | Down | RW |

| 2 | 192.168.0.44:3306 | Down | Ro |

| 3 | 192.168.0.43:3306 | Down | Ro |

+-------------+-------------------+-------+------+

3 Rows in Set (0.00 sec)










------------------------configuration File Description------------------------

[Mysql-proxy]

#管理接口的用户名, define it according to your needs

Admin-username = Admin

#管理接口的密码

Admin-password = password

#Atlas后端连接的MySQL主库的IP和端口, multiple items can be set, separated by commas

Proxy-backend-addresses = 10.57.1.131:3306

#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 = 10.57.1.132:[email protected]

#用户名与其对应的加密过的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 = root:yqsbjy4g4oc=,test:yqsbjy4g4oc=

Note that these two users are required to create and open corresponding access rights on Mysql-master, where the user is the user who needs to be open to use

#设置Atlas的运行方式, set to True when the daemon mode, set to False as the foreground mode, general development debugging is set to False, the online runtime is set to True

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, and the on-line runtime is set to True

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 = OFF

#实例名称 for the distinction between multiple Atlas instances on the same machine

#instance = Test

#Atlas监听的工作接口IP和端口

Proxy-address = 0.0.0.0:3306

#Atlas监听的管理接口IP和端口

Admin-address = 0.0.0.0:2345

#连接池的最小空闲连接数, can be adjusted or resized according to the size of the business request volume

Min-idle-connections = 128

#分表设置, 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 = 127.0.0.1, 10.0.0

#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

# End


This article is from "Allen Lee Oracle" blog, please make sure to keep this source http://lipengfei666666.blog.51cto.com/6384154/1613947

MYSQL-MHA Pre-release environment architecture share (iv) read/write Separation of Atlas

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.