创建高可用性能的mysql集群

本文探讨如何构建一个高可用性的MySQL集群,重点介绍MySQL NDB存储引擎的特点与配置方法,适用于需要高度冗余环境的应用场景。

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.

<!--CS_PAGE_INDEX-->

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


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

原文地址:http://www.oreillynet.com/lpt/a/6474

基于遗传算法的新的异构分布式系统任务调度算法研究(Matlab代码实现)内容概要:本文档围绕基于遗传算法的异构分布式系统任务调度算法展开研究,重点介绍了一种结合遗传算法的新颖优化方法,并通过Matlab代码实现验证其在复杂调度问题中的有效性。文中还涵盖了多种智能优化算法在生产调度、经济调度、车间调度、无人机路径规划、微电网优化等领域的应用案例,展示了从理论建模到仿真实现的完整流程。此外,文档系统梳理了智能优化、机器学习、路径规划、电力系统管理等多个科研方向的技术体系与实际应用场景,强调“借力”工具与创新思维在科研中的重要性。; 适合人群:具备一定Matlab编程基础,从事智能优化、自动化、电力系统、控制工程等相关领域研究的研究生及科研人员,尤其适合正在开展调度优化、路径规划或算法改进类课题的研究者; 使用场景及目标:①学习遗传算法及其他智能优化算法(如粒子群、蜣螂优化、NSGA等)在任务调度中的设计与实现;②掌握Matlab/Simulink在科研仿真中的综合应用;③获取多领域(如微电网、无人机、车间调度)的算法复现与创新思路; 阅读建议:建议按目录顺序系统浏览,重点关注算法原理与代码实现的对应关系,结合提供的网盘资源下载完整代码进行调试与复现,同时注重从已有案例中提炼可迁移的科研方法与创新路径。
【微电网】【创新点】基于非支配排序的蜣螂优化算法NSDBO求解微电网多目标优化调度研究(Matlab代码实现)内容概要:本文提出了一种基于非支配排序的蜣螂优化算法(NSDBO),用于求解微电网多目标优化调度问题。该方法结合非支配排序机制,提升了传统蜣螂优化算法在处理多目标问题时的收敛性分布性,有效解决了微电网调度中经济成本、碳排放、能源利用率等多个相互冲突目标的优化难题。研究构建了包含风、光、储能等多种分布式能源的微电网模型,并通过Matlab代码实现算法仿真,验证了NSDBO在寻找帕累托最优解集方面的优越性能,相较于其他多目标优化算法表现出更强的搜索能力稳定性。; 适合人群:具备一定电力系统或优化算法基础,从事新能源、微电网、智能优化等相关领域研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①应用于微电网能量管理系统的多目标优化调度设计;②作为新型智能优化算法的研究与改进基础,用于解决复杂的多目标工程优化问题;③帮助理解非支配排序机制在进化算法中的集成方法及其在实际系统中的仿真实现。; 阅读建议:建议读者结合Matlab代码深入理解算法实现细节,重点关注非支配排序、拥挤度计算蜣螂行为模拟的结合方式,并可通过替换目标函数或系统参数进行扩展实验,以掌握算法的适应性与调参技巧。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值