RabbitMQ 中的主从

发布于 2024-11-17 08:23:59 字数 721 浏览 2 评论 0原文

我们如何使用RabbitMQ服务器实现Master_slave配置。 我在很多地方读过并且亲自经历过

“集群下的 RabbitMQ 节点除了 cookie 文件之外不能真正共享相同的文件。脚本本身确保它创建以“$NODE_ID$”为前缀的文件夹和文件名,而启动代理,以便该节点的所有文件都将在单个文件夹中创建,它基本上会在文件夹中创建两个主要文件夹,执行以下操作: 一个。 db :创建名为“$NODE_ID$”-mnesia 的文件夹并在其中创建所有数据库文件。 b. log :创建名称前缀为“$NODE_ID$”的文件
即使我们调整两个节点的脚本以指向相同的 mnesia 文件夹,由于 mnesia 锁定问题,代理的第二个实例也将无法启动,并出现以下错误:

{"init terminating in do_boot",
{{nocatch,{error,{cannot_start_application,mnesia,{killed,{mnesia_sup,start,[normal,[]]}}}}},[{init,start_it,1},{init,start_em,1}]}} 
Crash dump was written to: erl_crash.dump init terminating in do_boot ()".

我想知道的是是否在有 2 个节点的站点中集群中的“主设备”和“从设备”,如果主设备停机一段时间,那么在这段时间内从设备如何代表主设备接收和发送消息。由于数据库共享是不可能的。

How can we implement Master_slave configuration using RabbitMQ server.
I have read at many places and have experienced it myself that

"RabbitMQ Nodes under a Cluster can't really share same files except for the cookie file. Script itself makes sure that it creates folders and files names prefixed with "$NODE_ID$" while starting the broker so that all the files for that node will be created inside a single folder ill it. It basically creates two main folders inside folders does following thing:
a. db : Creates Folder named "$NODE_ID$"-mnesia and creates all db files inside it.
b. log : Creates files with name prefixed with "$NODE_ID$"
Even if we tweak the script for both nodes to point to same mnesia folder, 2nd instance of the broker will fail to start because of mnesia locking issue with following error :

{"init terminating in do_boot",
{{nocatch,{error,{cannot_start_application,mnesia,{killed,{mnesia_sup,start,[normal,[]]}}}}},[{init,start_it,1},{init,start_em,1}]}} 
Crash dump was written to: erl_crash.dump init terminating in do_boot ()".

All I wanted to know is if in a sitation in which there are 2 nodes 'master' and 'slave' in a cluster and if master is down for some time, then for that time how can slave can come in picture for recieving and sending messages on behalf of master. Since the sharing of database is not possible.

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

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

发布评论

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

评论(1

坐在坟头思考人生 2024-11-24 08:23:59

查看使用 DRDB 和 Pacemaker 构建高可用集群的指南:http://www.rabbitmq。 com/pacemaker.html

但是,设置起来有点困难,因此您可能更愿意再等待几周,因为下一个主要版本将包括对集群冗余队列的内置支持。请在此处的附件中查看更多相关信息:

http://lists。 rabbitmq.com/pipermail/rabbitmq-discuss/2011-June/013304.html

Take a look at the guidelines for building a highly available cluster with DRDB and Pacemaker: http://www.rabbitmq.com/pacemaker.html

However, that's a bit difficult to set up, so you might prefer to wait for a few more weeks, as the next major release will include built in support for redundant queues for clusters. See more about that in the attachment here:

http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2011-June/013304.html

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