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. imageNamed、imageWithContentsOfFile、imageWithData

    [UIImage imageNamed:ImageName]; 1.加载图片占据的内存较大 2.相同的图片只会加载一份到内存中,如果同时使用,使用同一个对象即可 3.当对象销毁,图片对象不会随着一起销 ...

  2. JS初级-作用域

    作用域:域:空间.范围.区域--作用:读.写    script        全局变量.全局函数        自上而下        函数        由里到外        {}    浏览器 ...

  3. 诡异的too manany connections报错

    问题现象: 应用重启,日志里面报错too manany connections 问题分析: 昨天割接,线上该业务线应用全部重启,一个有38个应用,每个应用3台服务器,每台服务器启动5个链接: num= ...

  4. Android性能优化方法(四)

    在一个应用程序中,一般都会存在多个Activity,每个Activity对应着一个UI布局文件.一般来说,为了保持不同窗口之间的风格统一,在这些UI布局文件中,几乎肯定会用到很多相同的布局.如果我们在 ...

  5. Windows 8.1 应用再出发 (WinJS) - 几种新增控件(2)

    上篇我们介绍了Windows 8.1 和 WinJS 中新增控件中的 AppBarCommand.BackButton.Hub.ItemContainer,本篇我们接着来介绍 NavBar.Repea ...

  6. 软件工程结组开发软件特色——NABC模型

    特点:通过学生提前点餐,可以让摊主在准备食材的时候有个参照,当准备的食材比较少的时候可以及时回家取来. N(Need):每当放学的时候,学校外边的卖饭摊位总是挤满了人,好多同学都要排好长的队等比较长的 ...

  7. 【概念笔记】 EL表达式

    一.EL简介 1.语法结构  ${expression} 2.[]与.运算符  EL 提供.和[]两种运算符来存取数据. 当要存取的属性名称中包含一些特殊字符,如.或?等并非字母或数字的符号,就一定要 ...

  8. [MFC] MFC 获取指定窗口截图(大小可调)

    void screenShot(CRect rect,int left,int top,char *name){//截取窗口的大小,位置,名字(保存在默认路径下) CBitmap* m_pBitmap ...

  9. [游戏模版20] Win32 物理引擎 加速运动

    >_<:Compared with previous talk,there will be taking about how to create an accelerated speed. ...

  10. AngularJS快速入门指南03:表达式

    AngularJS通过表达式将数据绑定到HTML. AngularJS表达式 AngularJS表达式写在双大括号中:{{ 表达式语句 }}. AngularJS表达式绑定数据到HTML的方式与ng- ...