可靠性:主/从模式是注定的吗?

发布于 2024-09-18 03:16:00 字数 239 浏览 1 评论 0原文

越来越多备受关注的 noSQL 数据库使用主/从模式来提供“可用性”,但它的作用(至少从我的角度来看)是在链条中创建随时会断裂的薄弱环节。 - 主人宕机,奴隶停止运作。

这是处理大量数据并平衡读/写的好方法,但从可用性角度来看?没那么多......

我从一些noSQL中了解到,从属设备可以轻松地变成主设备,但在大多数应用程序中这样做会很头疼。正确的?

那么你们如何处理这类事情呢?主/从数据库在现实世界中如何工作?

More and more of the noSQL databases that are in the spotlight uses the master/slave pattern to provide "availability", but what it does (at least from my perspective) is creating the weak link in a chain that will break anytime. - Master goes down, slaves stops to function.

It's a great way to handle big amounts of data and to even out reads/writes, but seen in an availability perspective? Not so much...

I understand from some noSQL's that the slaves can be changed to be a master easily, but doing this would be a headache to handle in most applications. Right?

So how do you people take care of this sort of stuff? How does master/slave-databases work in the real world?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清晰传感 2024-09-25 03:16:00

这是一个相当普遍的问题;您能具体说明您具体谈论哪些数据存储吗?

我一直在使用 MongoDB,它可以非常优雅地处理这个问题; “副本集”(基本上是主从集群)中的每个成员都有资格成为主节点。连接到副本集时,该集将告诉连接客户端该集中的每个成员。如果集合中的主节点离线,从节点将自动选举一个新的主节点,而客户端(因为它有集合中所有节点的列表)将尝试新节点,直到连接;它连接的节点将向客户端通知新的主节点,然后客户端切换其连接。这允许完全透明的主/从故障转移,而无需对应用程序进行任何更改。

这对于单连接来说显然没问题,但是重新启动呢? MongoDB 驱动程序也可以处理这个问题;它可以接受要尝试连接的节点列表,并将串行尝试它们,直到找到要连接的节点。一旦连接,它会询问节点谁是它的主节点,并将连接转发到该节点。

最终结果是,如果您建立了副本集,您实际上可以不用担心任何单个节点爆炸会使您离线。

This is a fairly generalized question; can you specify what data stores you're specifically talking about?

I've been working with MongoDB, and it handles this very gracefully; every member in a "replica set" (basically, a master-slave cluster) is eligible to become the master. On connecting to a replica set, the set will tell the connecting client about every member in the set. If the master in the set goes offline, the slaves will automatically elect a new master, and the client (since it has a list of all nodes in the set) will try new nodes until it connects; the node it connects to will inform the client about the new master, and the client switches its connection over. This allows for fully transparent master/slave failover without any changes in your application.

This is obviously fine for single connections, but what about restarts? The MongoDB driver handles this as well; it can accept a list of nodes to try connecting to, and will try them in serial until it finds one to connect to. Once it connects, it will ask the node who its master is, and forward the connection there.

The net result is that if you have a replica set established, you can effectively just not worry that any single node exploding will take you offline.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文