Master-master vs主从数据库架构? [英] Master-master vs master-slave database architecture?

查看:246
本文介绍了Master-master vs主从数据库架构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说过两种数据库架构。




  • master-master


  • 主从




今天的网站因为它像Git,每个单元都有整套数据,如果一个数据下降,这并不重要。



主从提醒我SVN (我不喜欢)你有一个中央单位处理事情。



问题:


  1. 每个人的利弊是什么?


  2. 如果你想在手机上有本地数据库


  3. 是否选择其中一个是非常重要的考虑因素?



解决方案

我们在交易可用性,一致性和复杂性。首先解决最后一个问题:这是否重要?是非常!有关如何管理数据的选择是绝对必要的,没有最佳实践可以躲避决策。



一个副本:一致性很容易,但是你需要了解你的特殊要求。但如果它恰好是下来每个人都是在水中,如果人们是遥远的,那么可能会付出可怕的通信成本。将便携设备(可能需要断开连接)插入图片,一个副本不会剪切。



主从:一致性不是太难,因为每个数据只有一个拥有主。但是,如果你看不到那个大师,你该怎么办,需要某种延期的工作。



硕士硕士:好的,如果你能使它工作,它似乎提供一切,没有单点故障,每个人都可以工作的所有时间。麻烦是很难保持绝对一致性。参见维基百科文章了解更多。



维基百科似乎对优点和缺点有一个很好的总结。





  • 如果一个主人失败,其他主人将继续更新
    数据库。


  • 大师可以位于几个实体网站,即
    分布在整个网络中。




缺点




  • 大多数多主复制系统只是松散一致,
    即延迟和异步,违反ACID属性。


  • 渴望的复制系统是复杂的,并引入一些
    的通信延迟。


  • 冲突解决等问题可能变得棘手,因为
    涉及的节点数量增加,所需的延迟减少。




I've heard about two kind of database architectures.

  • master-master

  • master-slave

Isn't the master-master more suitable for today's web cause it's like Git, every unit has the whole set of data and if one goes down, it doesn't quite matter.

Master-slave reminds me of SVN (which I don't like) where you have one central unit that handles thing.

Questions:

  1. What are the pros and cons of each?

  2. If you want to have a local database in your mobile phone like iPhone, which one is more appropriate?

  3. Is the choice of one of these a critical factor to consider thoroughly?

解决方案

We're trading off availability, consistency and complexity. To address the last question first: Does this matter? Yes very much! The choices concerning how your data is to be managed is absolutely fundamental, and there's no "Best Practice" dodging the decisions. You need to understand your particular requirements.

There's a fundamental tension:

One copy: consistency is easy, but if it happens to be down everybody is out of the water, and if people are remote then may pay horrid communication costs. Bring portable devices, which may need to operate disconnected, into the picture and one copy won't cut it.

Master Slave: consistency is not too difficult because each piece of data has exactly one owning master. But then what do you do if you can't see that master, some kind of postponed work is needed.

Master-Master: well if you can make it work then it seems to offer everything, no single point of failure, everyone can work all the time. Trouble is it very hard to preserve absolute consistency. See the wikipedia article for more.

Wikipedia seems to have a nice summary of the advantages and disadvantages

Advantages

  • If one master fails, other masters will continue to update the database.

  • Masters can be located in several physical sites i.e. distributed across the network.

Disadvantages

  • Most multi-master replication systems are only loosely consistent, i.e. lazy and asynchronous, violating ACID properties.

  • Eager replication systems are complex and introduce some communication latency.

  • Issues such as conflict resolution can become intractable as the number of nodes involved rises and the required latency decreases.

这篇关于Master-master vs主从数据库架构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆