MySQL installation Altas

Source: Internet
Author: User

Preparation: You need to configure MySQL master and slave first.

1, Installation Altas

RPM-IVH atlas-2.2. 1

Installation location:

/usr/local/mysql-proxy

Configuration file:

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

Important configuration file:

(1) Number of threadsEvent-threads setting, too small can not fully play the performance of multi-core CPU, too large to cause unnecessary thread switching overhead, recommended to set the number of CPU cores. (2) Minimum number of idle connections (2. x does not require this item for the above version.1. x version required) min-idle-connections set, too small in high concurrency will have an error, too large although not error, but in the test is not easy to see read and write separation effect, recommended set to the client's concurrency peak slightly larger, see the configuration parameters in detail. The configuration example above is for the atlas2. x version, without this option. For Atlas1. x version of the configuration file, you need to include this configuration option (3) working port proxy for Atlas-address item configuration, such as Proxy-address =0.0.0.0: 1234 On behalf of the client should use the 1234 port to connect to Atlas to send SQL requests. (4) management port admin for Atlas-address item configuration, such as Admin-address =0.0.0.0: 2345 means that the DBA should use the 2345 port to connect to Atlas to perform operational management operations. (5Management Interface user name and password admin-username Items and admin-The password setting, which is used to access the management interface of Atlas, is not related to the back-end connection of MySQL, so it can be set arbitrarily and does not require MySQL to make any changes to the configuration. (6) logging level with log-level item configuration, divided into message, warning, critical, error, debug five levels. (7the log path takes log-path item configuration, such as Log-path =/usr/local/mysql-proxy/log. (8) IP and port proxy for the main library-backend-addresses =192.168.0.12:3306(9) from the library's IP and port, the number after the @ represents the weight, used for load balancing, if omitted the default is 1, you can set a number of items, separated by commas.       If you want the main library to be able to share read requests, you only need to add the main library information to the following configuration items. Proxy-read-only-backend-addresses =192.168.0.13:3306,192.168.0.14:3306(Ten) Username and its corresponding encrypted MySQL password, password using Prefix/bin directory encryption program encrypt encryption, user name and password separated by a colon. You need to create the user and set the password on the master/slave database (the user name and password are consistent on the master-slave database). For example, the user name is MyUser, password is MyPwd, execute./encrypt mypwd result is hjboxfrsjei=. If more than one user is separated by commas. Then set the following line as shown: PWDs= myuser:hjboxfrsjei=,myuser2:hjboxfrsjei=( One) table settings, 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 a number of items, separated by commas, if the table does not need to set the item, the child table needs to be built in advance, the child table name is the table name _0, number of child tables-1], as in this example, the child table name is Mt_0, mt_1, mt_2 tables= Person.mt.id.3

2. Set the password

./encrypt MySQL. 1234

3. Modify TEST.CNF configuration information

[mysql-Proxy] #带 # for non-required configuration Item # Admin interface User name Admin-username =Password admin for user# management interface-password =Pwd#atlas backend connected to the MySQL main library IP and port, you can set a number of items, separated by a comma proxy-backend-addresses = 192.168. 7.245:13306 #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 =127.0.0.1:3305@1Proxy-read-only-backend-addresses = 192.168. 7.151:13306@1 #用户名与其对应的加密过的MySQL密码, password use prefix/The encryption program under the Bin directory is encrypt encrypted, the downstream User1 and User2 are examples, replace it with your MySQL username and encryption password! #pwds= user1:+jksgb3yag8=, user2:gs+tr4tpgqc= PWDs = repl:twbz0dlu35u=, sa:t+srvvdh0ja=#设置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的运行方式, when set to True, Atlas starts two processes, one for monitor, and one for Worker,monitor, which automatically restarts the worker when it exits unexpectedly, set to False when only the worker, Without monitor, the 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 situationEvent-threads = -#日志级别, divided into message, warning, critical, error, debug five levels of log-level =message# Log stored path-path =/usr/local/mysql-proxy/log#sql Log switch, can be set to off, on, Realtime,off for not logging SQL log, on for logging SQL log, REALTIME for logging SQL log and write to disk in real time, the default is Off#sql-log =off# slow log output settings. When this parameter is set, the log only outputs execution time beyond SQL-log-Slow (unit: MS) logging. If you do not set this parameter, all logs are output. #sql-log-slow =Ten#实例名称, for distinguishing between multiple Atlas instances on the same machine #instance=Test#atlas Monitor the working interface IP and Port proxy-address = 0.0. 0.0:12340 #Atlas监听的管理接口IP和端口admin-address = 0.0. 0.0:23450 #分表设置, 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 also 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,192.168.1#Atlas前面挂接的LVS的物理网卡的IP (note is not a virtual IP), if there is LVS and the client is set-IPs then this must be set, otherwise you can not set #lvs-ips =192.168.1.1

From the above configuration you can see clearly:

Main Library: 192.168.7.245:13306

From library: 192.168.7.151:13306 weights to 1

Note: Master-slave replication requires self-configuration.

The IP and port of the Atlas proxy are: 0.0.0.0:12340

The user and password for the master-slave replication are: Repl=mysql and sa=1234, the above PWDs password is encrypted

If you use Navicat login, using the IP and port of the Atlas Proxy, user name and password with the master-slave copy, the master-slave copy of the account needs to be set can be landed on the navicat.

4. Write the startup script for simple atlas:

Vim/etc/init.d/atlas

#!/bin/sh# #atlas: Atlas daemon## chkconfig:- -  -# Description:atlas daemon## Source function Library.start () {echo-N $"Starting Atlas:"/usr/local/mysql-proxy/bin/mysql-proxyd Test start echo}stop () {echo-N $"shutting down Atlas:"/usr/local/mysql-proxy/bin/mysql-proxyd test Stop Echo} ATLAS="/usr/local/mysql-proxy/bin/mysql-proxyd"[ -F $ATLAS] | | Exit1# See how we were called. Case " $" inchstart) Start;        stop) stop;; Restart) Stop Sleep3start;; *) echo $"Usage: $ {Start|stop|restart}"Exit1Esacexit0

5, authorize and join the boot start

chmod +x/etc/init.d/Atlas Chkconfig Atlas on

6. Set up a firewall

12340 -J Accept  23450 -J Accept  /etc/sysconfig/iptables

7. Start Altas Service

Service Atlas Start  -- start Atlas Service service Atlas stop   --Stop the Atlas service

8. Client Connection

Transferred from: http://blog.csdn.net/jhq0113/article/details/44302703

MySQL installation Altas

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.