Altas mysql-proxy Configuration Read-write separation

Source: Internet
Author: User

Altas software is a upgrade version of Mysql-proxy, whose function is the same as Mysql-proxy.

Where can you get it?

Altas 2.2.1

Rpm:

https://github.com/Qihoo360/Atlas/releases/download/2.2.1/Atlas-2.2.1.el5.x86_64.rpm

https://github.com/Qihoo360/Atlas/releases/download/2.2.1/Atlas-2.2.1.el6.x86_64.rpm

Source Code:

Https://github.com/Qihoo360/Atlas/archive/2.2.1.zip

How does you install ALTs 2.2.1?

For RPM:

RPM-IVH altas-2.2.1.el6x86_64.rpm

For source code:

./configure--prefix=/usr/local/mysql-proxy

Make && make install

How to configure it.

1. Edit Altas mysql-proxy configuration file which locates at/usr/local/mysql-proxy/conf

Cat Test.cnf | Grep-v ' ^# ' | Grep-v ' ^$ ' > mysql-proxy.cnf

Vim mysql-proxy.cnf[mysql-proxy] #带 # for non-required configuration item # The user name of the management interface admin-username = user# Management interface Password Admin-password = pwd#atlas backend connected to the MySQL main library IP and port, you can set multiple items, separated by commas proxy-backend-addresses =  127.0.0.1:3306#atlas back-end connected MySQL 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 multiple items, separated by commas # Proxy-read-only-backend-addresses = 127.0.0.1:[email protected] #用户名与其对应的加密过的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= #设置Atlas的运行方式, set to True when the daemon mode, set to False is the foreground mode, General development debugging is set to False, the line run time set to True,true after cannot have the space. daemon = true# set how Atlas runs, set to True when Atlas starts two processes, one for monitor, and one for worker,monitor automatically restarts the worker after it exits unexpectedly. Set to False when only the worker, no monitor, general development debugging is set to False, the line run time set to true,true cannot have space after. keepalive = true# number of worker threads, has a great impact on the performance of Atlas, the event-threads = 8# log level can be set appropriately according to the situation, divided into message, warning, Critical, error, debug five levels log-level = message# log storage path log-path = /usr/local/mysql-proxy/log# SQL log switch, can be set to off, on, Realtime,off represents not logging SQL logs, on means logging SQL logs, REALTIME representing logging of SQL logs and writing to disk in real time, defaults to off#sql-log = off# slow log output settings. 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# Instance name for the distinction between multiple Atlas instances on the same machine #instance = test# The management interface IP and port proxy-address = 0.0.0.0:1234#atlas monitoring for the work interface IP and port of the Atlas listener admin-address =  0.0.0.0:2345# 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 #tables = person.mt.id.3 #默认字符集, after setting the item, the client no longer needs to execute the Set names statement #charset = utf8# allow the IP of the client connecting to Atlas, which can be an exact IP or an IP segment, separated by commas, If you do not set this entry, all IP connections are allowed, otherwise only IP connections in the list are allowed to #client-ips = 127.0.0.1, 192.168.1#atlas the IP of the physical network card of the previously attached LVS (note not the virtual IP). If there is LVS and set client-ips, this must be set, otherwise you can not set #lvs-ips = 192.168.1.1

2. How to start Altas mysql-proxy

Execute the command which is "/usr/local/mysql-proxy/bin/mysql-proxy--defaults-file=/usr/local/mysql-proxy/conf/ Mysql-proxy.cnf ".

3.Configure Altas mysql-proxy engine startting shell.

Vim /etc/init.d/mysql-proxyd#!/bin/bash## altas mysql-proxy this script starts  and stops the mysql-proxy daemon## chkconfig: - 78 30#  processname: mysql-proxy# description: altas mysql-proxy is a proxy  daemon to mysql# config: /usr/local/mysql-proxy/conf/mysql-proxy.cnf# pidfile: / usr/local/mysql-proxy/mysql-proxy.pid#daemon= "/usr/local/mysql-proxy/bin/mysql-proxy" CONFIGFILE= "/usr/local/ Mysql-proxy/conf/mysql-proxy.cnf "pidfile="/usr/local/mysql-proxy/mysql-proxy.pid "LOCKFILE="/var/lock/subsys/ Mysql-proxy "prog= ' basename  $DAEMON ' Retval=0start ()  {echo -n $" Starting ${prog} ... " [ -x  $DAEMON  ] | |  exit 5[ -f  $CONFIGFILE  ] | |  exit 6${daemon} --defaults-file=${configfile} | |  echo -n  "${prog} already running" Retval=$?echo[[  $RETVAL  -eq 0 ]] && touch  $LOCKFILEreturn   $RETVAL}stop ()  { echo -n $ "Stopping ${prog} ..." if [[  ' ps aux | grep bin/ Mysql-proxy | grep -v grep | wc -l '  -gt 0 ]]; thenkill  -TERM  ' ps -a -oppid,pid,cmd | grep bin/mysql-proxy | grep - v grep | awk  ' {print $2} ' firetval=$?echo[[  $RETVAL  -eq 0 ]  && rm -f  $LOCKFILE   $PIDFILEreturn   $RETVAL}restart ()  {stopsleep  1start}case  "$"  instart) start; stop) stop;; restart) restart;; Condrestart) [[ -e  $LOCKFILE  ]] && restart;; *) echo  "Usage: $0 {start|stop|restart|condrestart}" retval=1;; esacexit  $RETVALchmod  u+x /etc/init.d/mysql-proxyd


This article is from the "DBA Sky" blog, so be sure to keep this source http://kevinora.blog.51cto.com/9406404/1854952

Altas mysql-proxy Configuration Read-write separation

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.