# Running RabbitMQ with Rancher

**URL:** <https://forums.suse.com/t/running-rabbitmq-with-rancher/784>\
**Category:** Rancher 1.x\
**Created:** [October 27, 2015, 1:33pm UTC](https://forums.suse.com/t/running-rabbitmq-with-rancher/784 "2015-10-27T13:33:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![philpowell](https://avatars.discourse-cdn.com/v4/letter/p/b5ac83/32.png) [@philpowell](https://forums.suse.com/u/philpowell)\
**Post date:** [October 27, 2015, 1:33pm UTC](https://forums.suse.com/t/running-rabbitmq-with-rancher/784/1 "2015-10-27T13:33:51Z")

</div>

This is a very specific query. Has anybody had any experience configuring a RabbitMQ cluster running with Rancher? I’m running into a lot of difficulty with getting something running, because of RabbitMQ’s dependency on communicating with nodes via specific nodenames. That doesn’t play well with Rancher’s overlay network.

---

<div class="post-metadata">

**Author:** ![philpowell](https://avatars.discourse-cdn.com/v4/letter/p/b5ac83/32.png) [@philpowell](https://forums.suse.com/u/philpowell)\
**Post date:** [October 28, 2015, 9:00am UTC](https://forums.suse.com/t/running-rabbitmq-with-rancher/784/2 "2015-10-28T09:00:44Z")

</div>

Perhaps it’s worth me explaining a little more about what it is I’m struggling with. In order for RabbitMQ to be able to cluster nodes across a WAN, each node must identify itself with `<nodename>@<hostname>`. The hostname Rancher assigns to each container appears to **resolve on that particular host** , so it’s not currently possible for me to cluster nodes across different hosts.

---

<div class="post-metadata">

**Author:** ![kaos](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/kaos/32/38_2.png) [@kaos](https://forums.suse.com/u/kaos)\
**Post date:** [October 28, 2015, 10:47am UTC](https://forums.suse.com/t/running-rabbitmq-with-rancher/784/3 "2015-10-28T10:47:18Z")

</div>

I’ve not attempted to setup a rabbitmq cluster in rancher (yet), but perhaps `io.rancher.container.hostname_override` and links could get you closer to a working setup… ?  
[http://docs.rancher.com/rancher/labels/](http://docs.rancher.com/rancher/labels/)

---

<div class="post-metadata">

**Author:** ![philpowell](https://avatars.discourse-cdn.com/v4/letter/p/b5ac83/32.png) [@philpowell](https://forums.suse.com/u/philpowell)\
**Post date:** [October 28, 2015, 11:46am UTC](https://forums.suse.com/t/running-rabbitmq-with-rancher/784/4 "2015-10-28T11:46:31Z")

</div>

Thanks for the tip @kaos — that label is really useful to know. Unfortunately it doesn’t solve my problem though, because the hostname isn’t visible across the wider network.

---

<div class="post-metadata">

**Author:** ![sdlarsen](https://avatars.discourse-cdn.com/v4/letter/s/f14d63/32.png) [@sdlarsen](https://forums.suse.com/u/sdlarsen)\
**Post date:** [October 28, 2015, 2:09pm UTC](https://forums.suse.com/t/running-rabbitmq-with-rancher/784/5 "2015-10-28T14:09:41Z")

</div>

Maybe you could make the nodes register themselves with the overlay IP as hostname?  
Something like:

```
HOST=$(curl http://rancher-metadata/2015-07-25/self/container/primary_ip)
```

---

<div class="post-metadata">

**Author:** ![philpowell](https://avatars.discourse-cdn.com/v4/letter/p/b5ac83/32.png) [@philpowell](https://forums.suse.com/u/philpowell)\
**Post date:** [October 28, 2015, 2:26pm UTC](https://forums.suse.com/t/running-rabbitmq-with-rancher/784/6 "2015-10-28T14:26:16Z")

</div>

That’s a great suggestion, and it’s one that I’ve tried. The problem I’ve run into is that there doesn’t appear to be a way to define a custom HOSTNAME when starting the RabbitMQ process — it derives the `env.HOSTNAME` and I can’t see any obvious way of overriding that.

I did think about trying to set the hostname to the overlay IP, but I’m a bit concerned about doing that — it doesn’t feel like a particularly clever thing to be doing!

---

<div class="post-metadata">

**Author:** ![dsvmacdonald](https://avatars.discourse-cdn.com/v4/letter/d/47e85d/32.png) [@dsvmacdonald](https://forums.suse.com/u/dsvmacdonald)\
**Post date:** [November 21, 2015, 8:42pm UTC](https://forums.suse.com/t/running-rabbitmq-with-rancher/784/7 "2015-11-21T20:42:11Z")

</div>

I created a docker image for running RabbitMQ as a cluster within a Rancher service. It uses the Rancher Metadata Service to allow RabbitMQ to scale, restart and add back after a crash.

[Link with image and source details/link](http://forums.suse.com/t/how-do-you-setup-a-cluster/816/5?u=dsvmacdonald)
