Install and configure Atlas middleware in centos 6.5
Atlasy is developed on mysqp-proxy by Qihoo and comes with lua script. th is used to replace mysql-proxy and amoebo, and the two are no longer developed.
Atlas: 192.168.168.130
Master: 192.168.168.128
Slave: 192.168.168.129
Configure master and slave:
Reference: http://752030200.blog.51cto.com/8936921/1853460
First download the rpm installation package from the official website. Https://github.com/Qihoo360/Atlas/releases # el6 stands for centos 6. x systems, el5 for centos 5.x
3. Installation: rpm-I Atlas-2.2.1.el6.x86_64.rpm # default installation path:/usr/local/mysql-proxy/
4. vim/usr/local/mysql-proxy/conf/test. cnf # modify the configuration file. Note that "true" and "false" cannot be followed by spaces. Otherwise, an error is reported. Judgment Method: in non-editing mode, the cursor cannot be moved to the right to indicate that there is no space, otherwise, there is a space.
Mainly adjusted based on actual conditions:
[Mysql-proxy]
# Non-essential configuration items with # signs
# User Name of the Management Interface
Admin-username = atlas
# Management Interface Password
Admin-password = atlas
# The IP address and port of the MySQL master database connected to the backend of Atlas. Multiple IP addresses and ports can be set and separated by commas (,).
Proxy-backend-addresses = 192.168.168.128: 3306
# The IP address and port of the MySQL slave database connected to the backend of Atlas. @ indicates the weight, which is used for load balancing. If this parameter is omitted, the default value is 1. You can set multiple entries separated by commas (,).
Proxy-read-only-backend-addresses = 192.168.168.129: 3306 @ 1
# The user name corresponds to the encrypted MySQL password. The password is encrypted using the encryption program encrypt In the PREFIX/bin directory. The following are examples of user1 and user2, replace it with your MySQL user name and encrypted password!
# Password encryption: encrypt 123456 and the result is/iZxz + 0 GRoA =
Pwds = root @ yaho:/iZxz + 0 GRoA =
5. start/stop/restart atlas:
[Root @ yaho ~] #/Usr/local/mysql-proxy/bin/mysql-proxyd test start
[Root @ yaho ~] #/Usr/local/mysql-proxy/bin/mysql-proxyd test stop
[Root @ yaho ~] #/Usr/local/mysql-proxy/bin/mysql-proxyd test restart
6. log on to the atlas management page:
[Root @ yaho ~] # Mysql-u atlas-patlas-h127.0.0.1-P2345
Mysql> SELECT * FROM help; --- view all available commands for help
Mysql> SELECT * FROM backends; -- View backend Information
+ ------------- + ---------------------- + ------ + ------- + --------- +
| Backend_ndx | address | state | type |
+ ------------- + ---------------------- + ------ + ------- + --------- +
| 1 | 168.128: 3306 | up | rw |
| 2 | 192.168.168.129: 3306 | up | ro |
+ ------------- + ---------------------- + ---- + --------- +
2 rows in set (0.00 sec)
Verification:
7. log on to atlas to operate mysql:
[Root @ yaho ~] # Mysql-u root-p123456-h127.0.0.1-P1234
Mysql> show databases;
+ -------------------- +
| Database |
+ -------------------- +
| Information_schema |
| Mysql |
| Test |
+ -------------------- +
5 rows in set (0.00 sec)
Mysql> create database TOP; -- create a database TOP. succeeded.
Query OK, 1 row affected (0.00 sec)
Mysql> show databases;
+ -------------------- +
| Database |
+ -------------------- +
| Information_schema |
| TOP |
| Mysql |
| Test |
+ -------------------- +
4 rows in set (0.01 sec)
8. log on to the master to check whether the TOP database exists.
[Root @ yaho ~] # Mysql
Mysql> show databases;
+ -------------------- +
| Database |
+ -------------------- +
| Information_schema |
| TOP |
| Mysql |
| Test |
+ -------------------- +
4 rows in set (0.00 sec)
9. log on to the SLAVE and check whether the TOP database exists.
[Root @ yaho ~] # Mysql
Mysql> show databases;
+ -------------------- +
| Database |
+ -------------------- +
| Information_schema |
| TOP |
| Mysql |
| Test |
+ -------------------- +
4 rows in set (0.00 sec)
10. You can see that when creating a TOP database in atlas, the database is successfully written to the master, and the SLAVE is successfully copied from the MASTER.
Note: 1. the username and encrypted password are used to log on to mysql for operations.
2. Management Interface users are used to manage atlas.
3. When atlas is not started, restart cannot start the atlas service and an error is reported.