123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- version: "3.3"
- configs:
- rabbitmq.config:
- external:
- name: rabbitmq_rabbit1.config
- rabbitmq_enabled_plugins:
- external:
- name: rabbitmq_enabled_plugins
- ## docker swarm 部署,swarm名称为rabbitmq,则hostname 为rabbitmq_rabbit,容器之间可通过hostname互相访问
- ## 如果docker-compose 部署,则为容器名称,需保证在同一个网络内
- services:
- rabbit1:
- image: tuonina/rabbitmq:3-management.cluster
- hostname: rabbitmq_rabbit1
- environment:
- RABBITMQ_ERLANG_COOKIE: "rabbitmq"
- RABBITMQ_NODENAME: rabbitmq_rabbit1
- RABBITMQ_ENABLED_PLUGINS_FILE: "/rabbitmq_enabled_plugins" # 指定启用的插件,前提是插件必须在指定的位置,能访问得到
- ports:
- - "4369:4369"
- - "5671:5671"
- - "5672:5672"
- - "15671:15671"
- - "15672:15672"
- - "25672:25672"
- deploy:
- labels:
- - "mq.master=true"
- volumes:
- - /data/db/rabbit:/var/lib/rabbitmq/mnesia
- configs:
- - rabbitmq.config
- - rabbitmq_enabled_plugins
- rabbit2:
- image: tuonina/rabbitmq:3-management.cluster
- hostname: rabbitmq_rabbit2
- depends_on:
- - rabbit1
- environment:
- RABBITMQ_ERLANG_COOKIE: "rabbitmq"
- RABBITMQ_NODENAME: rabbitmq_rabbit2
- RABBITMQ_ENABLED_PLUGINS_FILE: "/rabbitmq_enabled_plugins"
- volumes:
- - /data/db/rabbit:/var/lib/rabbitmq/mnesia
- configs:
- - rabbitmq.config
- - rabbitmq_enabled_plugins
|