Atlas+Keepalived系列二:管理Atlas
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的更多相关文章
- 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 ...
- centos 7 Atlas keepalived 实现高可用 MySQL 5.7 MHA环境读写分离
目录 简介 相关链接 环境准备 Atlas 环境 MySQL 集群环境 Atlas 安装 和 配置 为数据库的密码加密 修改配置文件 启动 Keepalived 安装配置 安装 master 配置 K ...
- linux磁盘管理系列二:软RAID的实现
磁盘管理系列 linux磁盘管理系列一:磁盘配额管理 http://www.cnblogs.com/zhaojiedi1992/p/zhaojiedi_linux_040_quota.html l ...
- Nginx系列二:(Nginx Rewrite 规则、Nginx 防盗链、Nginx 动静分离、Nginx+keepalived 实现高可用)
一.Nginx Rewrite 规则 1. Nginx rewrite规则 Rewrite规则含义就是某个URL重写成特定的URL(类似于Redirect),从某种意义上说为了美观或者对搜索引擎友好, ...
- [知识库分享系列] 二、.NET(ASP.NET)
最近时间又有了新的想法,当我用新的眼光在整理一些很老的知识库时,发现很多东西都已经过时,或者是很基础很零碎的知识点.如果分享出去大家不看倒好,更担心的是会误人子弟,但为了保证此系列的完整,还是选择分享 ...
- 【圣诞特献】Web 前端开发精华文章推荐【系列二十一】
<Web 前端开发精华文章推荐>2013年第九期(总第二十一期)和大家见面了.梦想天空博客关注 前端开发 技术,分享各种增强网站用户体验的 jQuery 插件,展示前沿的 HTML5 和 ...
- Web 前端开发精华文章集锦(jQuery、HTML5、CSS3)【系列二十】
<Web 前端开发精华文章推荐>2013年第八期(总第二十期)和大家见面了.梦想天空博客关注 前端开发 技术,分享各种增强网站用户体验的 jQuery 插件,展示前沿的 HTML5 和 C ...
- 系列二VS项目软件配置工具介绍
原文:系列二VS项目软件配置工具介绍 Svn和VisualSvn介绍 在使用TortoiseSvn(SVN客户端)+ AnkhSvn(VS2008插件) +VisualSvn Server(版本控制服 ...
- RedHat系列软件管理(第二版) --脚本安装
RedHat系列软件管理 --脚本安装 一.解压缩 tar -zxvf webmin-1.700.tar.gz 二.进入相关目录 cd webmin-1.700 三.如果此时执行./configure ...
随机推荐
- UE简单操作
一:UE恢复默认配置 1.开始--运行-- “%APPDATA%” 回车 . 2. 找到并打开 IDMComp 文件夹.将文件夹“UltraEdit”整个给删除. 3.重 ...
- 数论(poj 1401)
题目:Factorial 题意:求N!末尾的0 的数量. 思路:10 = 2 * 5:N!中的2 的数量肯定比 5多:只需寻找5 的数量,暴力寻找TLE: 快点的方法:f(N) = N/5 + f( ...
- 关于java声明的一点杂感
从php这种弱类型的语言转到java,每次看到这种声明,一下子转不过弯来,总感觉很违和,最近思考了一下,有了点感悟 FileInputStream fileInputStream = new File ...
- MindFusion Pack for ASP.NET发布v2013.R2
在MindFusion.Diagramming for WebForms中: 导入OpenOffice Draw文件 新的DrawImporter类允许你通过OpenOffice Draw Vecto ...
- 3.3 SQLite数据库
1.使用嵌入式关系型SQLite数据库存储数据 轻量级嵌入式数据库引擎,它支持 SQL 语言,并且只利用很少的内存就有很好的性能.SQLite最大的特点是你可以把各种类型的数据保存到任何字段中,而不用 ...
- Django学习(二)
一 高亮显示 <script type="text/javascript"> $(document).ready(function () { $("#nav ...
- JAVA对象转化JSON出现死循环问题
主要是解决JSON因Hibernate映射生成的集合的转化出现的死循环问题. 这个方法很重要 public String ajaxJsonByObjectDirecdt(Object obj, Str ...
- halcon摄像机标定
摄像机标定程序: 注意:E:/calibration_image :为标定图像文件路径 'E:/calibration_description/caltab_123mm.descr:为标定 ...
- 使用java 程序创建格式为utf-8文件的方法(写入和读取json文件)
使用java 程序创建格式为utf-8文件的方法: try{ File file=new File("C:/11.jsp"); ...
- MongoDB基本概念
MongoDB是一种强大灵活可扩展的数据存储方式,它扩展了关系数据库的众多功能.MongoDB的功能非常丰富,但是却非常容易上手和便于使用,今天来了解一下MongoDB的主要概念. 文档 文档是的核心 ...