如何设置一个简单的dockerized RabbitMQ集群? [英] How do I set up a simple dockerized RabbitMQ cluster?

查看:244
本文介绍了如何设置一个简单的dockerized RabbitMQ集群?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读一下关于设置Dockerized RabbitMQ群集的信息,而谷歌在同一台机器上提供了各种各样的结果。





我有三台名为 dockerswarmmodemaster1 dockerswarmmodemaster2 dockerswarmmodemaster3



在第一台机器dockerswarmmodemaster1),我发出以下命令:

  docker run -d -p 4369:4369 -p 5671:5671 -p 5672 :5672 -p 15671:15671 -p 15672:15672 \ 
-p 25672:25672 --hostname dockerswarmmodemaster1 --name roger_rabbit \
-e RABBITMQ_ERLANG_COOKIE ='secret cookie here'rabbitmq:3-管理

现在这个启动了一个rabbitMQ就好了,我可以在15672和看到它按预期工作。



然后我SSH到我的第二台机器(dockerswarmmodemaster2),这是我坚持的一点。我一直在尝试以下命令的变体:

  docker run -d -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15671:15671 \ 
-p 15672:15672 -p 25672:25672 --name jessica_rabbit -e CLUSTERED = true \
-e CLUSTER_WITH = rabbit @ dockerswarmmodemaster1 \
-e RABBITMQ_ERLANG_COOKIE ='secret cookie here'\
rabbitmq:3-management

无论我尝试什么,两个RabbitMQ机器上的网页都表示在集群链接部分下没有集群。我没有尝试涉及第三台机器。



所以 - 一些更多的信息:

1.机器名可以由DNS解析。 br>
2.我已经尝试在两台机器上的没有变化。

3.我没有使用docker群组或群组模式。

4.我没有安装Docker组合。如果可能,我不想使用它。



有没有办法从docker运行命令执行此操作,或者我必须下载兔子管理员cli并手动加入群集?

解决方案

您可以使用此插件 https://github.com/aweber/rabbitmq-autocluster 创建一个RabbitMQ码头群集。



插件使用 etcd2 consul 作为服务发现,这样就不需要使用 rabbitmqctl 命令行。



我用docker swarm ,但没有必要。



这里是结果


I've been doing a bit of reading up about setting up a dockerized RabbitMQ cluster and google turns up all sorts of results for doing so on the same machine.

I am trying to set up a RabbitMQ cluster across multiple machines.

I have three machines with the names dockerswarmmodemaster1, dockerswarmmodemaster2 and dockerswarmmodemaster3

On the first machine (dockerswarmmodemaster1), I issue the following command:

docker run -d -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15671:15671 -p 15672:15672 \
    -p 25672:25672 --hostname dockerswarmmodemaster1 --name roger_rabbit \
    -e RABBITMQ_ERLANG_COOKIE='secret cookie here' rabbitmq:3-management

Now this starts up a rabbitMQ just fine, and I can go to the admin page on 15672 and see that it is working as expected.

I then SSH to my second machine (dockerswarmmodemaster2) and this is the bit I am stuck on. I have been trying variations on the following command:

docker run -d -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15671:15671  \
    -p 15672:15672 -p 25672:25672 --name jessica_rabbit -e CLUSTERED=true \
    -e CLUSTER_WITH=rabbit@dockerswarmmodemaster1 \
    -e RABBITMQ_ERLANG_COOKIE='secret cookie here' \
    rabbitmq:3-management

No matter what I try, the web page on both RabbitMQ machines says that there is no cluster under the 'cluster links' section. I haven't tried involving the third machine yet.

So - some more info:
1. The machine names are resolvable by DNS.
2. I have tried using the --net=host switch in the docuker run command on both machines; no change.
3. I am not using docker swarm or swarm mode.
4. I do not have docker compose installed. I'd prefer not to use it if possible.

Is there any way of doing this from the docker run command or will I have to download the rabbit admin cli and manually join to the cluster?

解决方案

You can use this plugin https://github.com/aweber/rabbitmq-autocluster to create a RabbitMQ docker cluster.

The plugin uses etcd2 or consul as service discovery, in this way you don't need to use the rabbitmqctl command line.

I used it with docker swarm, but it is not necessary.

Here is the result

这篇关于如何设置一个简单的dockerized RabbitMQ集群?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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