How do I set up a simple dockerized RabbitMQ cluster?
<p>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.</p>
<p>I am trying to set up a RabbitMQ cluster across multiple machines.</p>
<p>I have three machines with the names <code>dockerswarmmodemaster1</code>, <code>dockerswarmmodemaster2</code> and <code>dockerswarmmodemaster3</code></p>
<p>On the first machine (dockerswarmmodemaster1), I issue the following command:</p>
<pre><code>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
</code></pre>
<p>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.</p>
<p>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:</p>
<pre><code>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
</code></pre>
<p>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.</p>
<p>So - some more info:</p>
<ol>
<li>The machine names are resolvable by DNS.</li>
<li>I have tried using the --net=host switch in the docker run command on both machines; no change.</li>
<li>I am not using docker swarm or swarm mode.</li>
<li>I do not have docker compose installed. I'd prefer not to use it if possible.</li>
</ol>
<p>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?</p>