抽取一部分显示在这里,如下,
What's the difference in using Cluster
vs using replication?
在复制系统中,一个MySQL主服务器会更新一个或多个从服务器.事务是顺序地提交的,因此一个慢事务就可能导致从服务器比主服务器落后一段时间.这也意 味着,如果主服务器出错失败了,那么从服务器可能会缺少记录最后的那一小部分事务日志.如果使用的是事务安全存储引擎的话,例如InnoDB
, 那么事务日志则会完全记录到从服务器上去或者完全不记录,但是复制不能保证主和从服务器上的数据总是保持一致性.在MySQL集群中,所有的数据总是保持 同步,在任何数据节点上提交的事务都同步到所有其他的数据节点上了.如果有一个数据节点失败了,其他正常的数据节点照样能保持数据的一致性.
In a replication setup, a master MySQL server updates one or
more slaves. Transactions are committed sequentially, and a
slow transaction can cause the slave to lag behind the
master. This means that if the master fails, it is possible
that the slave might not have recorded the last few
transactions. If a transaction-safe engine such asInnoDB
is being used, a transaction will
either be complete on the slave or not applied at all, but
replication does not guarantee that all data on the master
and the slave will be consistent at all times. In MySQL
Cluster, all data nodes are kept in synchrony, and a
transaction committed by any one data node is committed for
all data nodes. In the event of a data node failure, all
remaining data nodes remain in a consistent state.
In short, whereas standard MySQL replication is
asynchronous, MySQL Cluster is synchronous.
We have implemented (asynchronous) replication for Cluster
in MySQL 5.1. This includes the capability to replicate both
between two clusters, and from a MySQL cluster to a
non-Cluster MySQL server. However, we do not plan to
backport this functionality to MySQL 5.0.
How many computers do I need to run a cluster, and why?
集群最少要求有3台计算机.不过我们建议
最好是4台;有2台分别运行管理节点和SQL节点,另外2台作为数据节点.采取2台数据节点的目的是提高数据的冗余度,管理节点放在一个独立的主机上是为了能够保证在万一有一台数据节点失败的情况下提供仲裁服务.
A minimum of three computers is required to run a viable
cluster. However, the minimum
recommended number of
computers in a MySQL Cluster is four: one each to run the
management and SQL nodes, and two computers to serve as data
nodes. The purpose of the two data nodes is to provide
redundancy; the management node must run on a separate
machine to guarantee continued arbitration services in the
event that one of the data nodes fails.
To provide increased throughput and high availability, you
should use multiple SQL nodes (MySQL Servers connected to
the cluster). It is also possible (although not strictly
necessary) to run multiple management servers.