mysql集群-ndb
SQL节点:这是用来访问集群数据的节点。对于MySQL集群,客户端节点是使用NDB集群存储引擎的传统MySQL服务器。
NDB 存储引擎也叫NDB Cluster 存储引擎,主要用于MySQL Cluster 分布式集群环境,
Cluster 是MySQL 从5.0 版本才开始提供的新功能。这部分我们可能并不仅仅只是介绍NDB
存储引擎,因为离开了MySQL CLuster 整个环境,NDB 存储引擎也将失去太多意义。所以
这一节主要是介绍一下MySQL Cluster 的相关内容。
简单的说,Mysql Cluster 实际上就是在无共享存储设备的情况下实现的一种内存数据
库Cluster 环境,其主要是通过NDB Cluster(简称NDB)存储引擎来实现的。
一般来说,一个Mysql Cluster 的环境主要由以下三部分组成:
a) 负责管理各个节点的Manage 节点主机:
管理节点负责整个Cluster 集群中各个节点的管理工作,包括集群的配置,启动关闭
各节点,以及实施数据的备份恢复等。管理节点会获取整个Cluster 环境中各节点的状态和
错误信息,并且将各Cluster 集群中各个节点的信息反馈给整个集群中其他的所有节点。由
于管理节点上保存在整个Cluster 环境的配置,同时担任了集群中各节点的基本沟通工作,
所以他必须是最先被启动的节点。
b) SQL 层的SQL 服务器节点(后面简称为SQL 节点),也就是我们常说的Mysql Server:
主要负责实现一个数据库在存储层之上的所有事情,比如连接管理,query 优化和响
应,cache 管理等等,只有存储层的工作交给了NDB 数据节点去处理了。也就是说,在纯粹
的Mysql Cluster 环境中的SQL 节点,可以被认为是一个不需要提供任何存储引擎的Mysql
服务器,因为他的存储引擎有Cluster 环境中的NDB 节点来担任。所以,SQL 层各Mysql 服
务器的启动与普通的Mysql 启动有一定的区别,必须要添加ndbcluster 项,可以添加在
my.cnf 配置文件中,也可以通过启动命令行来指定。
c) Storage 层的NDB 数据节点,也就是上面说的NDB Cluster:
NDB 是一个内存式存储引擎也就是说,他会将所有的数据和索引数据都load 到内存中,
但也会将数据持久化到存储设备上。不过,最新版本,已经支持用户自己选择数据可以不全
部Load 到内存中了,这对于有些数据量太大或者基于成本考虑而没有足够内存空间来存放
所有数据的用户来说的确是一个大好消息。
NDB 节点主要是实现底层数据存储的功能,保存Cluster 的数据。每一个NDB 节点保存
完整数据的一部分(或者一份完整的数据,视节点数目和配置而定),在MySQL CLuster 里
面叫做一个fragment。而每一个fragment,正常情况来讲都会在其他的主机上面有一份(或
者多分)完全相同的镜像存在。这些都是通过配置来完成的,所以只要配置得当,Mysql
Cluster 在存储层不会出现单点的问题。一般来说,NDB 节点被组织成一个一个的NDB Group,
一个NDB Group 实际上就是一组存有完全相同的物理数据的NDB 节点群。
上面提到了NDB 各个节点对数据的组织,可能每个节点都存有全部的数据也可能只保存
一部分数据,主要是受节点数目和参数来控制的。首先在Mysql Cluster 主配置文件(在管
理节点上面,一般为config.ini)中,有一个非常重要的参数叫NoOfReplicas,这个参数
指定了每一份数据被冗余存储在不同节点上面的份数,该参数一般至少应该被设置成2,也
只需要设置成2 就可以了。因为正常来说,两个互为冗余的节点同时出现故障的概率还是非
常小的,当然如果机器和内存足够多的话,也可以继续增大。一个节点上面是保存所有的数
据还是一部分数据,还受到存储节点数目的限制。NDB 存储引擎首先保证NoOfReplicas 参
数配置的要求对数据冗余,来使用存储节点,然后再根据节点数目将数据分段来继续使用多
余的NDB 节点,分段的数目为节点总数除以NoOfReplicas 所得。
ysql的innodb和cluster的NDB引擎都支持事务,在有共同的特性外,也有不同之处:
以mysql cluster NDB 7.3和MySQL 5.6之InnoDB为例:
ndb7.3基于mysql5.6,包括支持innodb1.1,因此可以在cluster里使用innodb表,但这些表不是集群的。
MySQL Cluster NDB存储引擎用分布式, shared-nothing的架构实现,这使其和innodb有不少不同之处。比如事务、外键、表限制等,具体见下表:
Theseare shown in the following table:
Feature |
|
MySQLCluster |
---|---|---|
MySQLServer Version |
5.6 |
5.6 |
|
|
|
MySQLCluster Version |
N/A |
|
StorageLimits |
64TB |
3TB (Practicalupper limit based on 48 data nodes with 64GB RAM each; can beincreased with disk-based data and BLOBs) |
ForeignKeys |
Yes |
Priorto MySQL Cluster NDB 7.3: No. (Ignored, as with Availablein MySQL Cluster NDB 7.3. |
Transactions |
Allstandard types |
|
MVCC |
Yes |
No |
DataCompression |
Yes |
No (MySQLCluster checkpoint and backup files can be compressed) |
LargeRow Support (> 14K) |
Supportedfor |
Supportedfor (Usingthese types to store very large amounts of data can lower MySQLCluster performance) |
ReplicationSupport |
Asynchronousand semisynchronous replication using MySQL Replication |
Automaticsynchronous replication within a MySQL Cluster. Asynchronousreplication between MySQL Clusters, using MySQL Replication |
Scaleoutfor Read Operations |
Yes(MySQL Replication) |
Yes(Automatic partitioning in MySQL Cluster; MySQL Replication) |
Scaleoutfor Write Operations |
Requiresapplication-level partitioning (sharding) |
Yes(Automatic partitioning in MySQL Cluster is transparent toapplications) |
HighAvailability (HA) |
Requiresadditional software |
Yes(Designed for 99.999% uptime) |
NodeFailure Recovery and Failover |
Requiresadditional software |
Automatic (Keyelement in MySQL Cluster architecture) |
Timefor Node Failure Recovery |
30seconds or longer |
Typically< 1 second |
Real-TimePerformance |
No |
Yes |
In-MemoryTables |
No |
Yes (Somedata can optionally be stored on disk; both in-memory and diskdata storage are durable) |
NoSQLAccess to Storage Engine |
Nativememcached interface in development (see the MySQL Dev ZonearticleMySQLCluster 7.2 (DMR2): NoSQL, Key/Value, Memcached) |
Yes MultipleAPIs, including Memcached, Node.js/JavaScript, Java, JPA, C++,and HTTP/REST |
Concurrentand Parallel Writes |
Notsupported |
Upto 48 writers, optimized for concurrent writes |
ConflictDetection and Resolution (Multiple Replication Masters) |
No |
Yes |
HashIndexes |
No |
Yes |
OnlineAddition of Nodes |
Read-onlyreplicas using MySQL Replication |
Yes(all node types) |
OnlineUpgrades |
No |
Yes |
OnlineSchema Modifications |
Yes,as part of MySQL 5.6. |
Yes. |
数据驱动型应用负载于innodb和NDB存储引擎之主要不同:
Workload |
|
MySQLCluster ( |
---|---|---|
High-VolumeOLTP Applications |
Yes |
Yes |
DSSApplications (data marts, analytics) |
Yes |
Limited(Join operations across OLTP datasets not exceeding 3TB in size) |
CustomApplications |
Yes |
Yes |
PackagedApplications |
Yes |
Limited(should be mostly primary key access). MySQLCluster NDB 7.3 supports foreign keys. |
In-NetworkTelecoms Applications (HLR, HSS, SDP) |
No |
Yes |
SessionManagement and Caching |
Yes |
Yes |
E-CommerceApplications |
Yes |
Yes |
UserProfile Management, AAA Protocol |
Yes |
Yes |
这两种存储引擎适合的应用场景
Preferredapplication requirements for |
Preferredapplication requirements for |
---|---|
|
|
2
如何选择memory存储引擎或mysql cluster:
When to Use MEMORY or MySQL Cluster.
Developers looking to deploy applications that use the MEMORY storage engine for important, highly available, or frequently updated data should consider whether MySQL Cluster is a better choice. A typical use case for the MEMORY engine involves these
characteristics:
• Operations involving transient, non-critical data such as session management or caching. When the MySQL server halts or restarts, the data in MEMORY tables is lost.
• In-memory storage for fast access and low latency. Data volume can fit entirely in memory without causing the operating system to swap out virtual memory pages.
• A read-only or read-mostly data access pattern (limited updates).
MySQL Cluster offers the same features as the MEMORY engine with higher performance levels, and provides additional features not available with MEMORY:
• Row-level locking and multiple-thread operation for low contention between clients.
• Scalability even with statement mixes that include writes.
• Optional disk-backed operation for data durability.
• Shared-nothing architecture and multiple-host operation with no single point of failure, enabling 99.999% availability.
• Automatic data distribution across nodes; application developers need not craft custom sharding or partitioning solutions.
• Support for variable-length data types (including BLOB and TEXT) not supported by MEMORY.
MEMORY存储引擎和MySQL Cluster的更多细节对比参见白皮书《Scaling Web Services with MySQL Cluster: An Alternative to the MySQL Memory Storage Engine》
Table 15.4 MEMORY
Storage Engine Features
Storagelimits |
RAM |
Transactions |
No |
Lockinggranularity |
Table |
MVCC |
No |
Geospatialdata type support |
No |
Geospatialindexing support |
No |
B-treeindexes |
Yes |
T-treeindexes |
No |
Hashindexes |
Yes |
Full-textsearch indexes |
No |
Clusteredindexes |
No |
Datacaches |
N/A |
Indexcaches |
N/A |
Compresseddata |
No |
Encrypteddata[a] |
Yes |
Clusterdatabase support |
No |
Replicationsupport[b] |
Yes |
Foreignkey support |
No |
Backup/ point-in-time recovery[c] |
Yes |
Querycache support |
Yes |
Updatestatistics for data dictionary |
Yes |
[a]Implemented in the server (via encryption functions), ratherthan in the storage engine. [b]Implemented in the server, rather than in the storage engine. [c]Implemented in the server, rather than in the storage engine. |
3
myisam, memory, ndb, archive, innodb存储引擎功能汇总:
Table 15.1 StorageEngines Feature Summary
Feature |
MyISAM |
Memory |
InnoDB |
Archive |
NDB |
---|---|---|---|---|---|
Storagelimits |
256TB |
RAM |
64TB |
None |
384EB |
Transactions |
No |
No |
Yes |
No |
Yes |
Lockinggranularity |
Table |
Table |
Row |
Table |
Row |
MVCC |
No |
No |
Yes |
No |
No |
Geospatialdata type support |
Yes |
No |
Yes |
Yes |
Yes |
Geospatialindexing support |
Yes |
No |
Yes[a] |
No |
No |
B-treeindexes |
Yes |
Yes |
Yes |
No |
No |
T-treeindexes |
No |
No |
No |
No |
Yes |
Hashindexes |
No |
Yes |
No[b] |
No |
Yes |
Full-textsearch indexes |
Yes |
No |
Yes[c] |
No |
No |
Clusteredindexes |
No |
No |
Yes |
No |
No |
Datacaches |
No |
N/A |
Yes |
No |
Yes |
Indexcaches |
Yes |
N/A |
Yes |
No |
Yes |
Compresseddata |
Yes[d] |
No |
Yes[e] |
Yes |
No |
Encrypteddata[f] |
Yes |
Yes |
Yes |
Yes |
Yes |
Clusterdatabase support |
No |
No |
No |
No |
Yes |
Replicationsupport[g] |
Yes |
Yes |
Yes |
Yes |
Yes |
Foreignkey support |
No |
No |
Yes |
No |
No |
Backup/ point-in-time recovery[h] |
Yes |
Yes |
Yes |
Yes |
Yes |
Querycache support |
Yes |
Yes |
Yes |
Yes |
Yes |
Updatestatistics for data dictionary |
Yes |
Yes |
Yes |
Yes |
Yes |
[a]InnoDB support for geospatial indexing is available in MySQL5.7.5 and higher. [b]InnoDB utilizes hash indexes internally for its AdaptiveHash Index feature. [c]InnoDB support for FULLTEXT indexes is available in MySQL5.6.4 and higher. [d]Compressed MyISAM tables are supported only when using thecompressed row format. Tables using the compressed row formatwith MyISAM are read only. [e]Compressed InnoDB tables require the InnoDB Barracuda fileformat. [f]Implemented in the server (via encryption functions), ratherthan in the storage engine. [g]Implemented in the server, rather than in the storageengine. [h]Implemented in the server, rather than in the storageengine. |
要选mysql cluster要根据ndb存储引擎的特征和应用场景做详细测试,安装简测见我的博文《centos65安装简测mysql cluster 7.3.7》http://blog.csdn.net/beiigang/article/details/43485585
参考
http://dev.mysql.com/doc/refman/5.6/en/mysql-cluster.html
mysql集群-ndb相关推荐
- mysql ndb 测试_.部署MYSQL集群 --测试
最近把MYSQL集群给研究了下,并做了一个测试,且成功了!现在总结如下: 一.规划好节点 MGM:192.168.79.135 NDB1:192.168.1.79.136 NDB2:192.168.1 ...
- MySQL cluster集群/NDB集群学习
公司主业务用的MySQL集群是官方自带的MySQL Cluster,MySQL自带的集群模式,这个集群的模式和MGR.PXC.主从 有点不一样. 一.存储引擎不是innodb,MySQL Cluste ...
- mysql集群安装(centos)
永不放弃,一切皆有可能!!! 只为成功找方法,不为失败找借口! mysql集群安装(centos) mysql cluster : 1. 基于NDB Cluster 的分布式数据库系统 2. mysq ...
- mysql 集群 增加服务器_MYSQL集群服务配置
MYSQL集群服务配置 篇文档旨在介绍如何安装配置基于2台服务器的MySQL集群.并且实现任意一台服务器出现问题或宕机时MySQL依然能够继续运行. 注意! 虽然这是基于2台服务器的MySQL集群,但 ...
- mysql 集群实践_MySQL Cluster集群探索与实践
MySQL集群是一种在无共享架构(SNA,Share Nothing Architecture)系统里应用内存数据库集群的技术.这种无共享的架构可以使得系统使用低廉的硬件获取高的可扩展性. MySQL ...
- mysql集群的使用与简单测试
应用场景 当搭建了mysql集群后,现在应当需要使用该mysql集群了,在使用的过程中,和单节点的mysql极为相似. 操作步骤 1. 配置mysql集群 mysql集群已启动完毕,需要给mysql重 ...
- MySQL Cluster(MySQL 集群) 初试(转)
作/译者:叶金荣(imysql#imysql.com>),来源:http://imysql.com,欢迎转载. 作/译者:叶金荣(Email: ),来源:http://imysql.cn,转载请 ...
- MySQL Cluster(MySQL 集群) 初试
MySQL Cluster 是MySQL适合于分布式计算环境的高实用.高冗余版本.它采用了NDB Cluster 存储引擎,允许在1个 Cluster 中运行多个MySQL服务器.在MyQL 5.0及 ...
- mysql集群安装配置
看网上很多人说mysql集群不是很稳定,因此这2天做了下mysql的集群,打算配置没有什么问题了,过2天做下相关的性能测试,我的配置环境如下: 操作系统: Centos5.2 软件包: mysql-c ...
最新文章
- IDEA中maven的命令及作用
- 国民认证科技有限公司助力构建我国可信网络空间
- 别找了 这就是适合入门的第一本算法书
- php面向对象面试题
- OpenXml编程--去除自动生成的word文档中由分页符和换行符产生的空白页
- Android Studio 单刷《第一行代码》系列 03 —— Activity 基础
- C/C++、JAVA、Python简单运行速度实验与分析
- 【C++】Visual Studio教程(七) -修改 Visual Studio
- 手把手教你报表工具PentahoBI安装和简单使用
- scm maven_在运行时访问工件的Maven和SCM版本
- linux 使用 byzanz 生成 gif 图片程序
- Office在线预览及PDF在线预览的实现方式大集合
- arcpy.SpatialJoin_analysis 空间连接分析
- php写dnf脚本,dnf分解机脚本c
- 微信小程序启动页完整模板
- L1-020. 帅到没朋友
- 岛田庄司《占星术杀人魔法》读后感
- Mac下浏览器超实用快捷键
- uniapp添加阿里字体图标库图标
- 人工智能的下半场,一定少不了自监督学习
热门文章
- LoadLibrary 绝对路径,错误193的(dll 和 跑的程序版本不一致x86和x64)
- 谷歌眼镜设计规范之沉浸式
- 公众版与政企版,这两款云电脑我都要
- 断网安装是什么意思_关于ADSL宽带断网掉线的几个处理办法
- 大型机、小型机、x86服务器的区别
- ROSCORE 失败解决方法
- 这本PyTorch官方出品的Deep Learning With PyTorch终于有了中文版
- RPG游戏《黑暗之光》流程介绍与代码分析之(一):游戏载入界面的创建
- 【Maven】自定义插件(新建项目开始):AbstractMojo,Mojo,pluginGroups,build,plugin,execution,phase,goals
- 如何获取物理网卡的MAC地址信息