showniu / rabbitmq-cluster

rabbitMQ 3.6.1 docker cluster

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Modified from https://github.com/grandmore/rabbitmq-cluster to update to 3.6.6 Thank you, grandmoreļ¼ Docker images to run RabbitMQ cluster. It extends the official image with a rabbitmq-cluster script that does the magic.

Building

Once you clone the project locally use captain to build the image or do with docker:

docker build -t haha123/rabbitmq-cluster .

Running with docker-compose

If you want to run the cluster on one machine use docker-compose

docker-compose up -d

By default 3 nodes are started up this way:

rabbit1:
  image: haha123/rabbitmq-cluster
  hostname: rabbit1
  environment:
    - ERLANG_COOKIE=abcdefg
  ports:
    - "5672:5672"
    - "15672:15672"
rabbit2:
  image: haha123/rabbitmq-cluster
  hostname: rabbit2
  links:
    - rabbit1
  environment:
    - ERLANG_COOKIE=abcdefg
    - CLUSTER_WITH=rabbit1
    - ENABLE_RAM=true
    - RAM_NODE=true
  ports:
    - "5673:5672"
    - "15673:15672"
rabbit3:
  image: haha123/rabbitmq-cluster
  hostname: rabbit3
  links:
    - rabbit1
    - rabbit2
  environment:
    - ERLANG_COOKIE=abcdefg
    - CLUSTER_WITH=rabbit1
  ports:
    - "5674:5672"

Setting default user and password

If you wish to change the default username and password of guest / guest, you can do so with the RABBITMQ_DEFAULT_USER and RABBITMQ_DEFAULT_PASS environmental variables:

$ docker run -d --hostname my-rabbit --name some-rabbit -e RABBITMQ_DEFAULT_USER=user -e RABBITMQ_DEFAULT_PASS=password rabbitmq:3-management You can then go to http://localhost:8080 or http://host-ip:8080 in a browser and use user/password to gain access to the management console

If needed, additional nodes can be added to this file.

Once cluster is up:

  • The management console can be accessed at http://hostip:15672
  • The connection host should look like this: hostip:5672,hostip:5673,hostip:5674

Credits

About

rabbitMQ 3.6.1 docker cluster

License:MIT License


Languages

Language:Shell 100.0%