1:登录代理端口1234

[root@localhost bin]# mysql -uroot -p -P1234 -h127.0.0.1

proxy-address项配置,例如proxy-address = 0.0.0.0:1234代表客户端应该使用1234这个端口连接Atlas来发送SQL请求。

  

2:登录管理端口2345

[root@localhost bin]# mysql -ugechong -p -P2345 -h127.0.0.1

admin-address项配置,例如admin-address = 0.0.0.0:2345代表DBA应该使用2345这个端口连接Atlas来执行运维管理操作。

#管理接口的用户名
admin-username = gechong #管理接口的密码
admin-password = gechong.atlas

  

3:管理界面

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", ... |
| SELECT * FROM clients | lists the clients |
| ADD CLIENT $client | example: "add client 192.168.1.2", ... |
| REMOVE CLIENT $client | example: "remove client 192.168.1.2", ... |
| SELECT * FROM pwds | lists the pwds |
| ADD PWD $pwd | example: "add pwd user:raw_password", ... |
| ADD ENPWD $pwd | example: "add enpwd user:encrypted_password", ... |
| REMOVE PWD $pwd | example: "remove pwd user", ... |
| SAVE CONFIG | save the backends to config file |
| SELECT VERSION | display the version of Atlas |
+----------------------------+---------------------------------------------------------+
16 rows in set (0.00 sec)

  

SELECT * FROM help        #查看帮助
SELECT * FROM backends #查看主从节点状态
SET OFFLINE $backend_id #set offline 2;
SET ONLINE $backend_id
ADD MASTER $backend #add master 192.168.91.132:3306可以用来更改读写状态
ADD SLAVE $backend
REMOVE BACKEND $backend_id#删除
SELECT * FROM clients #
ADD CLIENT $client
REMOVE CLIENT $client
SELECT * FROM pwds
ADD PWD $pwd
ADD ENPWD $pwd
REMOVE PWD $pwd
SAVE CONFIG
SELECT VERSION

  

select * from backends;

mysql> select * from backends;
+-------------+---------------------+-------+------+
| backend_ndx | address | state | type |
+-------------+---------------------+-------+------+
| 1 | 192.168.91.132:3306 | up | rw |
| 2 | 192.168.91.144:3306 | up | ro |
+-------------+---------------------+-------+------+
2 rows in set (0.00 sec) #Atlas后端连接的MySQL主库的IP和端口,可设置多项,用逗号分隔
proxy-backend-addresses = 192.168.91.132:3306 #Atlas后端连接的MySQL从库的IP和端口,@后面的数字代表权重,用来作负载均衡,若省略则默认为1,可设置多项,用逗号分隔
proxy-read-only-backend-addresses = 192.168.91.144:3306@1

  

set offline 2;

mysql> set offline 2;
+-------------+---------------------+---------+------+
| backend_ndx | address | state | type |
+-------------+---------------------+---------+------+
| 2 | 192.168.91.144:3306 | offline | ro |
+-------------+---------------------+---------+------+
1 row in set (0.00 sec)
mysql> select * from backends;
+-------------+---------------------+---------+------+
| backend_ndx | address | state | type |
+-------------+---------------------+---------+------+
| 1 | 192.168.91.132:3306 | up | rw |
| 2 | 192.168.91.144:3306 | offline | ro |
+-------------+---------------------+---------+------+
2 rows in set (0.00 sec)

  

add master 192.168.91.144:3306

mysql> add master 192.168.91.144:3306;
Empty set (0.00 sec) mysql> select * from backends;
+-------------+---------------------+-------+------+
| backend_ndx | address | state | type |
+-------------+---------------------+-------+------+
| 1 | 192.168.91.132:3306 | up | rw |
| 2 | 192.168.91.144:3306 | up | rw |
| 3 | 192.168.91.144:3306 | up | ro |
+-------------+---------------------+-------+------+
3 rows in set (0.00 sec)

remove backend 2;

mysql> set offline 2;
+-------------+---------------------+---------+------+
| backend_ndx | address | state | type |
+-------------+---------------------+---------+------+
| 2 | 192.168.91.144:3306 | offline | rw |
+-------------+---------------------+---------+------+
1 row in set (0.00 sec) mysql> select * from backends;
+-------------+---------------------+---------+------+
| backend_ndx | address | state | type |
+-------------+---------------------+---------+------+
| 1 | 192.168.91.132:3306 | up | rw |
| 2 | 192.168.91.144:3306 | offline | rw |
| 3 | 192.168.91.144:3306 | up | ro |
+-------------+---------------------+---------+------+
3 rows in set (0.00 sec)
mysql> remove backend 2;
Empty set (0.00 sec) mysql> select * from backends;
+-------------+---------------------+-------+------+
| backend_ndx | address | state | type |
+-------------+---------------------+-------+------+
| 1 | 192.168.91.132:3306 | up | rw |
| 2 | 192.168.91.144:3306 | up | ro |
+-------------+---------------------+-------+------+
2 rows in set (0.00 sec)

  

ADD PWD $pwd   用来添加登录1234端口的用户;

mysql> add pwd gechong:gechong;

mysql> select * from pwds;
+----------+--------------------------+
| username | password |
+----------+--------------------------+
| root | sqoz56tuS587tWqbqy+SiQ== |
| gechong | YenmSjAqxT4= |
+----------+--------------------------+
2 rows in set (0.00 sec) 增加允许代理接口1234的用户名和密码 另外起一个端口登录
[root@localhost bin]# mysql -ugechong -p -P1234 -h127.0.0.1
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.81-log Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>

该效果跟test.cnf配置一样的。pwds=root:sqoz56tuS587tWqbqy+SiQ==,gechong:YenmSjAqxT4=  

ADD ENPWD $pwd  允许使用加密后的密码

mysql> select * from pwds;
+----------+--------------------------+
| username | password |
+----------+--------------------------+
| root | sqoz56tuS587tWqbqy+SiQ== |
| gechong | YenmSjAqxT4= |
+----------+--------------------------+
2 rows in set (0.00 sec) mysql> add enpwd testlogin:YenmSjAqxT4=;
Empty set (0.00 sec) mysql> select * from pwds;
+-----------+--------------------------+
| username | password |
+-----------+--------------------------+
| root | sqoz56tuS587tWqbqy+SiQ== |
| gechong | YenmSjAqxT4= |
| testlogin | YenmSjAqxT4= |
+-----------+--------------------------+
3 rows in set (0.00 sec)

  

Atlas+Keepalived系列二:管理Atlas的更多相关文章

  1. Atlas+Keepalived系列一:安装Atlas:

    1:下载Atlas https://github.com/Qihoo360/Atlas/releases/download/2.2.1/Atlas-2.2.1.el6.x86_64.rpm 2:安装A ...

  2. centos 7 Atlas keepalived 实现高可用 MySQL 5.7 MHA环境读写分离

    目录 简介 相关链接 环境准备 Atlas 环境 MySQL 集群环境 Atlas 安装 和 配置 为数据库的密码加密 修改配置文件 启动 Keepalived 安装配置 安装 master 配置 K ...

  3. linux磁盘管理系列二:软RAID的实现

    磁盘管理系列 linux磁盘管理系列一:磁盘配额管理   http://www.cnblogs.com/zhaojiedi1992/p/zhaojiedi_linux_040_quota.html l ...

  4. Nginx系列二:(Nginx Rewrite 规则、Nginx 防盗链、Nginx 动静分离、Nginx+keepalived 实现高可用)

    一.Nginx Rewrite 规则 1. Nginx rewrite规则 Rewrite规则含义就是某个URL重写成特定的URL(类似于Redirect),从某种意义上说为了美观或者对搜索引擎友好, ...

  5. [知识库分享系列] 二、.NET(ASP.NET)

    最近时间又有了新的想法,当我用新的眼光在整理一些很老的知识库时,发现很多东西都已经过时,或者是很基础很零碎的知识点.如果分享出去大家不看倒好,更担心的是会误人子弟,但为了保证此系列的完整,还是选择分享 ...

  6. 【圣诞特献】Web 前端开发精华文章推荐【系列二十一】

    <Web 前端开发精华文章推荐>2013年第九期(总第二十一期)和大家见面了.梦想天空博客关注 前端开发 技术,分享各种增强网站用户体验的 jQuery 插件,展示前沿的 HTML5 和  ...

  7. Web 前端开发精华文章集锦(jQuery、HTML5、CSS3)【系列二十】

    <Web 前端开发精华文章推荐>2013年第八期(总第二十期)和大家见面了.梦想天空博客关注 前端开发 技术,分享各种增强网站用户体验的 jQuery 插件,展示前沿的 HTML5 和 C ...

  8. 系列二VS项目软件配置工具介绍

    原文:系列二VS项目软件配置工具介绍 Svn和VisualSvn介绍 在使用TortoiseSvn(SVN客户端)+ AnkhSvn(VS2008插件) +VisualSvn Server(版本控制服 ...

  9. RedHat系列软件管理(第二版) --脚本安装

    RedHat系列软件管理 --脚本安装 一.解压缩 tar -zxvf webmin-1.700.tar.gz 二.进入相关目录 cd webmin-1.700 三.如果此时执行./configure ...

随机推荐

  1. struts2的result的type属性

    一共有两个属性name和type name这里就不介绍了 type    返回结果的类型,值可以从default-struts.properties中看到看到 常用的值:dispatcher (默认) ...

  2. HTML5的touch事件

    HTML5中新添加了很多事件,但是由于他们的兼容问题不是很理想,应用实战性不是太强,所以在这里基本省略,咱们只分享应用广泛兼容不错的事件,日后随着兼容情况提升以后再陆续添加分享.今天为大家介绍的事件主 ...

  3. 【动态规划】bzoj1669 [Usaco2006 Oct]Hungry Cows饥饿的奶牛

    #include<cstdio> #include<algorithm> using namespace std; int n,a[5001],b[5001],en; int ...

  4. Keepalived安装配置

    一.  介绍 keepalived:是一个类似于 layer3, 4 & 7 交换机制的软件,也就是我们平时说的第 3 层.第 4 层和第 7层交换. Keepalived 的作用是检测 we ...

  5. Programming Assignment 4: 8 Puzzle

    The Problem. 求解8数码问题.用最少的移动次数能使8数码还原. Best-first search.使用A*算法来解决,我们定义一个Seach Node,它是当前搜索局面的一种状态,记录了 ...

  6. 一些CSS常见的小问题小笔记

    父元素与子元素之间的margin-top问题: 给子元素盒子一个垂直外边距margin-top,父元素盒子也会往下走margin-top的值 解决方法: 1.修改父元素的高度,增加padding-to ...

  7. Hyper-V初涉_早期Windows安装虚拟硬件驱动

    虽然微软已经一再强调将要对Windows XP停止提供服务,但是难免在一些特殊场合需要早期的系统进行测试.为了测试需要,我在Hyper-V中安装了Windows XP. 按照之前的方法,对Hyper- ...

  8. java获取classpath文件路径空格转变成了转义字符%20的问题

    java获取classpath文件路径空格转变成了转义字符%20的问题 这个问题很纠结,服务器的文件路径带有空格,空格被转化是%20了,悲剧就出现了 下面展示一段代码String path = get ...

  9. NoSQL学习一:MongoDB下载与安装

    MongoDB是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最丰富,最像关系数据库的.他支持的数据结构非常松散,是类似json的bjson格式,因此可以存储比较复杂的数据类型.M ...

  10. 秀才提笔忘了字:javascript使用requestAnimationFrame实现动画

    requestAnimationFrame优于setTimeout/setInterval的地方在于它是由浏览器专门为动画提供的API,在运行时浏览器会自动优化方法的调用,并且如果页面不是激活状态下的 ...