mysql集群提升性能_创建高可用性能的mysql集群

Today's enterprise depends on the availability of mail and web services. Failure is never far away, whether it be a hardware failure or a human error. We have to try to make an infrastructure as highly available as possible.

When building highly available clusters, people often choose one extra physical machine per service, creating an A-B, fail-over schema. With static websites, there is no problem making the application highly available; you can just store the data in two places. However, the moment you add a database to your environment, things start to become more difficult. The easy way out is to move the database to a different machine and move that server into a SEP field.

今天的企业靠提供电子邮件和网上服务。离故障很远,无论是硬件故障或人为错误。我们要设法创建高可用性能的基础架构。

当创建高可用性能集群,人们常常选择一个额外的物理机每服务中,创造了一-二,故障切换模式。静态网站,是没有问题,使应用高度可用;你可以只存储数据在两台机器上。不过,你放入一个数据库的环境,事情开始变得更加困难。

That's not how we do it. In the old days when sites became too heavily loaded, we used MySQL replication to create multiple read-only copies of the database, which LVS load balanced. This, however, meant that we had to modify the application itself so that it could only write to the master node.

这不是我们如何去做。在以前网站变得太沉重负载时候,我们使用mysql的复制创建多个只读副本数据库,其中lvs的负载平衡。但是,这意味着我们不得不修改自己的应用,所以它只能写给主节点。

Later, many people tried to create a replication environment that implemented high availability. All of them struggled with the problem that they couldn't exactly define where a node failed, so it was possible to lose records. Also, recovering from a failover seemed to be a difficult task.

后来,许多人试图建立一个复制环境,实施高可用性。他们都挣扎问题,他们不能确定到底哪里一个节点失败,因此有可能失去记录。此外,从收回故障似乎是一个艰巨的任务。

In late 2004 and early 2005, MySQL announced MySQL Cluster--the NDB storage engine from MySQL that plugs into the MySQL environment. With this cluster environment, I built a highly redundant environment. This article discusses how to do it yourself.

在2004年末和2005年初,公布的mysql mysql的集群-ndb存储引擎从m ysql插入m ysql的环境。这个集群环境下,我建立了一个高度冗余环境。文章论述了如何去做吧。

Hold on before you decide to implement MySQL cluster, as it certainly doesn't suit all jobs yet. The MySQL NDB engine currently runs its database completely in memory. This means that you have to be able to fit your database in memory. If you have a 1GB dataset and you want to have your data spread over two nodes, you need 1GB of memory per node. If you have four nodes, you can deal with 512MB per node. The first thing that becomes clear is that you have to look at your dataset. Giant data-warehousing databases won't fit into the MySQL NDB engine yet. Today, you might need to look at commercial alternatives such as Continuent, the former Emic Networks.

在你决定实施的mysql集群之前,要清楚这个不能满足所有的任务。 mysql的ndb引擎目前运行在内存的数据库当中。这意味着你必须要能够适合你的数据库中的内存。如果你有一个1gb的数据集,你想拥有你的数据遍布两个节点,你需要1gb内存每节点。如果你有四个节点,你可以应付每512mb的节点。第一件事变得清楚的是,你要看看你的数据。大型数据仓储数据库,将不适合成为mysql的ndb引擎。今天,你可能需要看看商业等替代延伸,前主位网络。

Secondly, this article is about building a truly available MySQL cluster, which means it focuses on high availability, not on high throughput. If your database is suffering from too-high loads, you still might want to look back at replication in combination with LVS.

其次,这篇文章是对建设一个真正可用的mysql集群,即它着重于高可用性,而不是对高吞吐量。如果你的数据库是从事高度负载,你还是可能想回头在复制结合lvs的。

The MySQL NDB storage engine consists of different parts:

ndb_mgmd is the NDB management daemon. This daemon manages the cluster. It should start first in order to monitor the state of the other parts. The management daemon can arbitrate who becomes master and which nodes have to be disconnected from the cluster. It is also capable of (re)starting different nodes and starting backups. The other nodes will ask the management node for their configuration details, but from then on, they don't really need the management node anymore. You can easily stop and start the management node while not disturbing the cluster, as long as no other fault happens during this restart. The management node listens on port tcp/1186 (tcp/2200 in older versions).

ndb_mgm is the management client. It sends commands to ndb_mgmd.

ndbd is the actual network database engine. You need at least the number of nodes equal to the amount of replicas you want. To spread data over multiple nodes, increase the number of nodes.

mysqld is the standard SQL node that connects to the ndbd for NDB engine type storage. It still can use MyISAM or InnoDB tables.

mysql的ndb存储引擎构成的不同部分:

ndb_mgmd是ndb管理守护。这个守护管理集群。它应该首先启动,以顺序监控其他部分。管理守护可以仲裁的主节点和其他节点都必须从断开其他集群环境。它同时也能够(重新)开始不同节点并开始备份。其他节点会要求管理节点的配置细节,但从此,不是真的不要管理其他节点了。在重启其间只要没有其他故障发生,你可以轻易停止,并启动管理节点,而不是烦恼的集群。管理节点监听端口tcp/1186 ( tcp/2200在较旧版本) 。

ndb_mgm是管理客户端。它发出命令到ndb_mgmd 。

ndbd是实际的网络数据库引擎。你至少需要想要复制的个数的节点。数据覆盖在多个节点,增加节点数目。

mysqld是ndbd为ndb引擎类型存储的标准sql节点连接。它仍然可以使用或myisam innodb的图表。

Standard MySQL clients connect to the SQL node and won't notice the difference between a MyISAM or InnoDB query, so there is no need to change the API.

标准的mysql客户连接到sql节点,不会通知区别myisam 或innodb表,所以没有必要改变API。

In order to achieve high availability, you need at least three nodes: one management node, and two different replica nodes for ndbd.

为了实现高可用性,你需要至少三个节点:一个管理节点,以及两种不同的复制节点ndbd 。

下面就是老版本的配置细节,我就不继续说明了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值