【MySQL数据库之Atlas介绍】

一、官方介绍

.1)、Brief introduction

Atlas is a MySQL protocol-based database middleware project developed and maintained by infrastructure team of the Web platform Department in QIHU 360 SOFTWARE CO. LIMITED(NYSE:QIHU). It fixed lots of bugs and added lot of new functions on the basis of MySQL-Proxy 0.8.2. Currently the project has been widely applied in QIHU, many MySQL business has connected to the Atlas platform. The number of read and write requests forwarded by Atlas has reached billions.

2)、Major functions

a).Read/Write Splitting.

b).Load balancing and failover handling.

c).IP filtering.

d).Data sharding

e).DBA can online or offline the backend database server smoothly.

f).Remove the failed database server automatically.

g).Config file reload without downtime.

3)、The improvement of Atlas compared with Mysql-proxy

a、Rewrite all lua code with C, Lua is only used for management interface.

b、Rewrite the network model and the threading model.

c、Implement the connection pool.

d、Optimize the locking mechanism, performance improved immensely.

Atlas是由 Qihoo 360,  Web平台部基础架构团队开发维护的一个基于MySQL协议的数据中间层项目。它在MySQL官方推出的MySQL-Proxy 0.8.2版本的基础上,修改了大量bug,添加了很多功能特性。目前该项目在360公司内部得到了广泛应用,很多MySQL业务已经接入了Atlas平台,每天承载的读写请求数达几十亿条。

名字来源:

    Atlas,希腊神话中双肩撑天的巨人,普罗米修斯的兄弟,最高大强壮的神之一,因反抗宙斯失败而被罚顶天。我们期望这个系统能够脚踏后端DB,为前端应用撑起一片天。



 

主要功能:

* 读写分离

* 从库负载均衡

* IP过滤

* SQL语句黑白名单

* 自动分表

Atlas相对于官方MySQL-Proxy的优势

1.将主流程中所有Lua代码用C重写,Lua仅用于管理接口

2.重写网络模型、线程模型

3.实现了真正意义上的连接池

4.优化了锁机制,性能提高数十倍

Atlas配置文件示例

[mysql-proxy]

#带#号的为非必需的配置项目

#管理接口的用户名

admin-username = admin

#管理接口的密码

admin-password = passw0rd

#Atlas后端连接的MySQL主库的IP和端口,可设置多项,用逗号分隔

proxy-backend-addresses = 192.168.1.66:3306

#Atlas后端连接的MySQL从库的IP和端口,@后面的数字代表权重,用来作负载均衡,若省略则默认为1,可设置多项,用逗号分隔

proxy-read-only-backend-addresses = 192.168.1.64:3306,192.168.1.244:3306

#用户名与其对应的加密过的MySQL密码,密码使用PREFIX/bin目录下的加密程序encrypt加密,下行的user1和user2为示例,将其替换为你的MySQL的用户名和加密密码!

#pwds = user1:+jKsgB3YAG8=, user2:GS+tr4TPgqc=

pwds = root:FYCDJMDki+SiquyHfJnWyQ==

#设置Atlas的运行方式,设为true时为守护进程方式,设为false时为前台方式,一般开发调试时设为false,线上运行时设为true

daemon = true

#设置Atlas的运行方式,设为true时Atlas会启动两个进程,一个为monitor,一个为worker,monitor在worker意外退出后会自动将其重启,设为false时只有worker,没有monitor,一般开发调试时设为false,线上运行时设为true

keepalive = true

#工作线程数,对Atlas的性能有很大影响,可根据情况适当设置

event-threads = 64

#日志级别,分为message、warning、critical、error、debug五个级别

log-level = message

#日志存放的路径

log-path = /usr/local/mysql-proxy/log

#SQL日志的开关,可设置为OFF、ON、REALTIME,OFF代表不记录SQL日志,ON代表记录SQL日志,REALTIME代表记录SQL日志且实时写入磁盘,默认为OFF

#sql-log = OFF

#实例名称,用于同一台机器上多个Atlas实例间的区分

#instance = test

#Atlas监听的工作接口IP和端口

proxy-address = 0.0.0.0:1234

#Atlas监听的管理接口IP和端口

admin-address = 0.0.0.0:2345

#分表设置,此例中person为库名,mt为表名,id为分表字段,3为子表数量,可设置多项,以逗号分隔,若不分表则不需要设置该项

#tables = person.mt.id.3

#默认字符集,设置该项后客户端不再需要执行SET NAMES语句

#charset = utf8

#允许连接Atlas的客户端的IP,可以是精确IP,也可以是IP段,以逗号分隔,若不设置该项则允许所有IP连接,否则只允许列表中的IP连接

#client-ips = 127.0.0.1, 192.168.1

#Atlas前面挂接的LVS的物理网卡的IP(注意不是虚IP),若有LVS且设置了client-ips则此项必须设置,否则可以不设置

#lvs-ips = 192.168.1.1

猜你喜欢

转载自gaojingsong.iteye.com/blog/2329805