Percona XtraDB Cluster集群讲解 贺春旸

Slides:



Advertisements
Similar presentations
新目标初中英语 七年级下册. Unit 8 I’d like some noodles. Section B Period Two.
Advertisements

allow v. wrong adj. What’s wrong? midnight n. look through guess v. deal n. big deal work out 允许;准许 有毛病;错误的 哪儿不舒服? 午夜;子夜 快速查看;浏览 猜测;估计 协议;交易 重要的事.
第七课:电脑和网络. 生词 上网 vs. 网上 我上网看天气预报。 今天早上看了网上的天气预报。 正式 zhèngshì (报告,会议,纪录) 他被这所学校正式录取 大桥已经落成,日内就可以正式通车 落伍 luòw ǔ 迟到 chídào 他怕迟到,六点就起床了.
教学网站: 数据库及应用 授课教师:岳静 Tel: 教学网站:
穆公(朱金清 微博:淘穆公 阿里HBase业务设计实践 穆公(朱金清 微博:淘穆公
专题八 书面表达.
How can we become good leamers
2013华东数据库技术大会 MySQL5.6版InnoDB引擎深入剖析 演讲嘉宾:何登成
第6章 資料庫管理系統 6-1 關聯式資料庫管理系統 6-2 SQL Server資料庫管理系統
MySQL主从同步
Scrum 实践.
第4章 VHDL设计初步.
-Artificial Neural Network- Hopfield Neural Network(HNN) 朝陽科技大學 資訊管理系 李麗華 教授.
课程名称 黄杉 讲师的CSDN博客地址:
Chapter 8 Liner Regression and Correlation 第八章 直线回归和相关
摘要的开头: The passage mainly tells us sth.
天文望远镜集成建模研究 杨德华 南京天文光学技术研究所 30 NOV, 年中国虚拟天文台年会 广西师范大学 桂林
Unit 4 I used to be afraid of the dark.
Module 5 Shopping 第2课时.
關聯式資料庫.
Alibaba 数据库高可用架构 Alibaba
MariaDB Spider分库分表引擎调研
初二英语写作课 课件 福建省闽清县第一中 王国豪
第五讲 数据的分组、合并与转换.
EndNote X6 Advance your Research and Publish Instantly
Draft Amendment to STANDARD FOR Information Technology -Telecommunications and Information Exchange Between Systems - LAN/: R: Fast BSS.
Flash数据管理 Zhou da
欢乐玩转GIT 讲师:FREE QQ:
HLA - Time Management 陳昱豪.
创建型设计模式.
SAP 架構及基本操作 SAP前端軟體安裝與登入 Logical View of the SAP System SAP登入 IDES
刘红岩 清华大学 管理科学与工程系 第17章 事务管理 刘红岩 清华大学 管理科学与工程系
An Introduction to Cloud RDBMS
Lesson 28 How Do I Learn English?
Redis 客户端和工具集 潘海龙 平安健康互联网
客户服务 询盘惯例.
第4章(1) 空间数据库 —数据库理论基础 北京建筑工程学院 王文宇.
服務於中國研究的網絡基礎設施 A Cyberinfrastructure for Historical China Studies
第十五课:在医院看病.
英语教学课件 九年级全.
Microsoft SQL Server 2008 報表服務_設計
IBM SWG Overall Introduction
資料庫 靜宜大學資管系 楊子青.
Version Control System Based DSNs
Have you read Treasure Island yet?
高性能计算与天文技术联合实验室 智能与计算学部 天津大学
Guide to a successful PowerPoint design – simple is best
高正宗 System Consultant Manager
BORROWING SUBTRACTION WITHIN 20
中国科学技术大学计算机系 陈香兰 2013Fall 第七讲 存储器管理 中国科学技术大学计算机系 陈香兰 2013Fall.
虚 拟 仪 器 virtual instrument
中国科学技术大学计算机系 陈香兰 Fall 2013 第三讲 线程 中国科学技术大学计算机系 陈香兰 Fall 2013.
Common Qs Regarding Earnings
中央社新聞— <LTTC:台灣學生英語聽說提升 讀寫相對下降>
Presentation 约翰316演示 John 3 : 16
從 ER 到 Logical Schema ──兼談Schema Integration
17 交易處理與鎖定 17-1 交易的基礎 17-2 交易處理 17-3 並行控制 17-4 資料鎖定 17-5 死結問題.
第六類 資料庫備份與回復.
高考应试作文写作训练 5. 正反观点对比.
Chapter 10 Mobile IP TCP/IP Protocol Suite
CHAPTER 6 Concurrency:deadlock And Starvation
SAP 架構及基本操作 SAP前端軟體安裝與登入 Logical View of the SAP System SAP登入 IDES
名词从句(2).
 隐式欧拉法 /* implicit Euler method */
怎樣把同一評估 給與在不同班級的學生 How to administer the Same assessment to students from Different classes and groups.
MGT 213 System Management Server的昨天,今天和明天
Hospitality English 酒店商务英语 讲师:罗云利 工商与公共管理学院.
OrientX暑期工作总结及计划 XML Group
Experimental Analysis of Distributed Graph Systems
When using opening and closing presentation slides, use the masterbrand logo at the correct size and in the right position. This slide meets both needs.
Presentation transcript:

Percona XtraDB Cluster集群讲解 贺春旸 http://hcymysql.blog.51cto.com

Percona XtraDB Cluster集群介绍 官网:http://www.percona.com/doc/percona-xtradb-cluster/5.5/ Percona XtraDB Cluster provides: Synchronous replication. Transaction either commited on all nodes or none. 译:实时同步复制。事物要么在所有节点上都提交,要么就都失败。 Multi-master replication. You can write to any node. 译:多主复制。你可以在任意一个节点上去写。 Parallel applying events on slave. Real “parallel replication”. 译:实现了真正意义上的“并行复制(多线程并发同步)” Automatic node provisioning. 译:节点自动部署。 Data consistency. No more unsynchronized slaves. 译:数据不丢失,保证了数据一致性。 Percona XtraDB Cluster is fully compatible with MySQL or Percona Server in the following meaning: 译:提供了良好的数据兼容性,MySQL的数据可以直接使用无需转换。应用上也无需做调整。 Data compatibility. Percona XtraDB Cluster works with databases created in MySQL / Percona Server Application compatibility. There is no or minimal application changes required to start work with Percona XtraDB Cluster

Percona XtraDB Cluster集群介绍 The Cluster consists of Nodes. Recommended configuration is to have at least 3 nodes, but you can make it running with 2 nodes as well. 译:至少3个节点,当然2个也可以,但为了防止脑裂,我们这里推荐为3个。 Each Node contains the full copy of data. That defines XtraDB Cluster behavior in many ways. And obviously there are benefits and drawbacks. 译:每个节点都包含着一份完整的数据副本。

Percona XtraDB Cluster集群介绍 Benefits of such approach: 利: When you execute a query, it is executed locally on the node. All data is available locally, no need for remote access. No central management. You can loose any node at any point of time, and the cluster will continue to function. 译:架构简单,没有中央管理节点,不像MySQL NDB引擎那样。 一个节点挂掉,其他节点继续工作。 Good solution for scaling a read workload. You can put read queries to any of the nodes. 译:你可以在任意一个节点上查询,因为节点上的数据都是一致的,这样也分担了机器的压力。 Drawbacks: 弊: Overhead of joining new node. The new node has to copy full dataset from one of existing nodes. If it is 100GB, it copies 100GB. 译:如果节点数据很大,那么新增加的节点开销就会越大,如果节点是100G数据,那么就要复制100G数据到新增加的节点上。 This can’t be used as an effective write scaling solution. There might be some improvements in write throughput when you run write traffic to 2 nodes vs all traffic to 1 node, but you can’t expect a lot. All writes still have to go on all nodes. You have several duplicates of data, for 3 nodes – 3 duplicates. 译:对于写操作来说,有几个节点,就要写几份数据副本。所以在性能上没有主从复制这种架构好。

Percona XtraDB Cluster集群介绍 Let’s take look into the well known CAP theorem for Distributed systems. Characteristics of Distributed systems: 译:分布式数据库特点 C - Consistency (all your data is consistent on all nodes), 译:一致性(所有节点的数据都是一样的) A - Availability (your system is AVAILABLE to handle requests in case of failure of one or several nodes ), 译:可靠性(一个节点挂了,其他节点继续提供服务。) P - Partitioning tolerance (in case of inter-node connection failure, each node is still available to handle requests). CAP theorem says that each Distributed system can have only two out of these three. MySQL replication has: Availability and Partitioning tolerance. Percona XtraDB Cluster has: Consistency and Availability. That is MySQL replication does not guarantee Consistency of your data, while Percona XtraDB Cluster provides data Consistency. (And yes, Percona XtraDB Cluster looses Partitioning tolerance property). 译:MySQL复制并不能保证数据的一致性,而Percona XtraDB集群提供了数据一致性。

Percona XtraDB Cluster集群介绍 Components Percona XtraDB Cluster is based on Percona Server with XtraDB and includes Write Set Replication patches. It uses the Galera library, version 2.x, a generic Synchronous Multi-Master replication plugin for transactional applications.Galera library is developed by Codership Oy. 译:Percona XtraDB Cluster是基于XtraDB(InnoDB引擎)打的一个实时同步复制和多主复制的一个补丁,使用的Galera library类库,是由Codership Oy公司所研发。 和MySQL Cluster的区别: 1、MySQL集群是通过NDB引擎的基础上实现的,而Percona集群是在InnoDB基础上打了patch实现的。 2、MySQL集群可以设置副本数量,且数据分片,例如123存放到节点1,456存放到节点2,而Percona集群有几个节点就有几个副本,每个节点数据是一致的,不支持分片。 3、MySQL集群通过管理节点,维护着整个集群,而Percona集群没有管理节点,每个节点都是充当master角色。

Percona XtraDB Cluster集群局限性 Percona XtraDB Cluster Limitations Currently replication works only with InnoDB storage engine. Any writes to tables of other types, including system (mysql.*) tables, are not replicated. However, DDL statements are replicated in statement level, and changes to mysql.* tables will get replicated that way. So, you can safely issue: CREATE USER..., but issuing: INSERT INTO mysql.user..., will not be replicated. 译:只支持InnoDB引擎,如果使用其他引擎不能正常复制数据到其他节点。但如果你用DDL语句创建用户,是可以正常复制的,但如果insert into mysql.user表是不能复制的。 Unsupported queries: LOCK/UNLOCK TABLES cannot be supported in multi-master setups. lock functions (GET_LOCK(), RELEASE_LOCK()... ) 译:不支持LOCK/UNLOCK TABLES,以及GET_LOCK(), RELEASE_LOCK().函数。 Query log cannot be directed to table. If you enable query logging, you must forward the log to a file: log_output = FILE. Use general_log and general_log_file to choose query logging and the log file name. 译:general_log日志不能存放到表里,必须输出到文件。 Maximum allowed transaction size is defined by wsrep_max_ws_rows and wsrep_max_ws_size. LOAD DATA INFILE processing will commit every 10K rows. So large transactions due to LOAD DATA will be split to series of small transactions. 译:事务大小是由wsrep_max_ws_rows和wsrep_max_ws_size参数控制,超过了此参数设置,数据复制将失败。LOAD DATA INFILE导入的数据每次1万行,如果事务很大,就会拆分成很多小事物。 Due to cluster level optimistic concurrency control, transaction issuing COMMIT may still be aborted at that stage. There can be two transactions writing to same rows and committing in separate XtraDB Cluster nodes, and only one of the them can successfully commit. The failing one will be aborted. For cluster level aborts, XtraDB Cluster gives back deadlock error code: (Error: 1213 SQLSTATE: 40001 (ER_LOCK_DEADLOCK)). 译:由于集群是乐观锁控制,针对同一行做变更,例如一个事务在节点1,执行update t1 set id=id+1 where id=6; 另一个事务在节点2,也执行update t1 set id=id+1 where id=6; 在提交的时候,另一个事务就会中断,抛出一个死锁。ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction

Percona XtraDB Cluster集群局限性 XA transactions can not be supported due to possible rollback on commit. 译:不支持XA事务,因为XA事务有可能在commit的时候出现异常发生rollback。 The write throughput of the whole cluster is limited by weakest node. If one node becomes slow, whole cluster is slow. If you have requirements for stable high performance, then it should be supported by corresponding hardware. 译:整个集群的吞吐量受到最弱节点的限制。如果一个节点变得缓慢,整个集群都变得缓慢。如果你有稳定的高性能要求,那么应该用硬件配置相同的服务器。 The minimal recommended size of cluster is 3 nodes. 译:至少3个节点。 Currently using the query cache isn’t supported as it was showing some issues during the cache invalidation with certain multi-master use cases. 译:不支持query_cache缓存,由于在缓存失效后会出现一些问题。

Percona XtraDB Cluster集群注意事项 State Snapshot Transfer is a full data copy from one node (donor) to the joining node (joiner). It’s used when a new node joins the cluster. In order to be synchronized with the cluster, new node has to transfer data from the node that is already part of the cluster. There are three methods of SST available in Percona XtraDB Cluster: mysqldump, rsync and xtrabackup. The downside of mysqldump and rsync is that the donor node becomes READ-ONLY while data is being copied from one node to another (SST applies FLUSH TABLES WITH READ LOCK command). Xtrabackup SST does not require READ LOCK for the entire syncing process, only for syncing the MySQL system tables and writing the information about the binlog, galera and slave information (same as the regular XtraBackup backup). State snapshot transfer method can be configured with the wsrep_sst_method variable. 译:当新加入的节点时,要把某个节点的数据全量拷贝过去。wsrep_sst_method 参数有三个变量,mysqldump,rsync,和xtrabackup,前两个会锁表(只读),这里不推荐,官方推荐xtrabackup,这样基本不会影响访问。

Percona XtraDB Cluster集群注意事项 galera.cache This file is used as a main writeset store. It’s implemented as a permanent ring-buffer file that is preallocated on disk when the node is initialized. File size can be controlled with the variable gcache.size. If this value is bigger, more writesets are cached and chances are better that the re-joining node will get IST instead of SST. Filename can be changed with the gcache.name variable. 译:galera.cache事务日志文件默认128M,循环写入类似redo log,如果在宕机时没有找到恢复的LOG点,那么就要进行一次全量拷贝,如果数据很大的话,这将是一个漫长的过程,所以提高这个参数值,使其增大,这样在恢复的时候,可以增量恢复,节省恢复时间。 wsrep_provider_options="gcache.size = 4G"

Percona XtraDB Cluster集群注意事项 译:调大这个参数将会带来更好的并行复制性能,默认为1,这个值根CPU核数有关。