开发者

What alternatives do I have if I want a distributed multi-master database?

开发者 https://www.devze.com 2022-12-26 06:02 出处:网络
I will build a system where I wan开发者_高级运维t to reduce single-point-of-failures, and I need a database. Is there any (free) relational database systems that can handle multi-master setups good (i

I will build a system where I wan开发者_高级运维t to reduce single-point-of-failures, and I need a database. Is there any (free) relational database systems that can handle multi-master setups good (i.e where it is easy to add and remove nodes) or is it better to go with a NoSQL-database?

As what I have understood, a key-value store will handle this better. What database system do you recommend for a multi-master (cluster) setup?


Mysql's NDB Cluster WILL do this. But it's far from easy to set up and has a lot of gotchas.

And also, its performance is generally fairly sucky and it keeps data in memory (yes, I know they sound contradictory).

Essentially, updates need to acquire distributed locks throughout the cluster (or at least in the storage node group where those table(s) are held)

It is not easy to manage, but you can do some level of hot-add.

Unless you require very rapid failover and consistency, I'd recommend against it.

I'd recommend ignoring multi-master, and using a HA MySQL instead (with e.g. InnoDB) which is easy to set up and works very well with typical sub 30-second failover times. This is a master-slave system where the slave cannot even do reads (but you can add read slaves with replication provided you don't need them to be completely up to date)


Key-value stores are not necessarily fault tolerant. They are primarily performance tools. Only when data is stored on more than one server is there any form of fault tolerance. If it is just safety, reducing single point of failure the simplest solution is probably set up a mirroring solution, where you have a mirror that just tracks the master database. When the master somehow fails, you quickly switch over (hopefully automatically).

The complexity of this is much lower as there is no consistency management needed during normal operation. The mirror is read-only and just tracks the master database. When the master fails, the mirror is switched to master and the link broken. After the master gets back up the state between them is inconsistent and you must make sure to update the original master from the mirror now acting as master. Most database systems can handle this scenario, and if you have no insane uptime requirements or a very heavy load it is the most pragmatic solution.


I think Oracle has nailed this concept. However, if you're a mortal without a swiss bank account, then maybe you should look into MySQL's NDB Cluster.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号