2 disc 1 RAM node cluster - Zerpet/docker-rabbitmq-cluster GitHub Wiki

This template has 3 nodes: 2 disc nodes and 1 RAM node. It demonstrates how to create a RAM node using the environment variable ENABLE_RAM = true. The following snippet shows the definition of a RAM node:

  rabbitmq-ram-server:
    environment:
      CLUSTER_WITH: 'rabbit@rabbitmq-master-server'
      RABBITMQ_ERLANG_COOKIE: secret
      ENABLE_RAM: 'true'
    hostname: rabbitmq-ram-server
    image: zerpetfakename/rabbitmq-cluster:3.6
    ports:
    - 5674:5672
    - 15674:15672

It is also possible to change a disc node into a RAM node and viceversa using rabbitmqctl stop_app and rabbitmqctl change_cluster_node_type ram. For example, if we wanted to make a specific node (e.g. rabbitmq-server2) we could use the following commands:

docker-compose exec rabbitmq-server2 rabbitmqctl stop_app
docker-compose exec rabbitmq-server2 rabbitmqctl change_cluster_node_type ram
docker-compose exec rabbitmq-server2 rabbitmqctl start_app

Be aware of the limitations of this image. It must have at least 2 disc nodes at all times, otherwise the cluster will not start after a restart.