Docker-compose安装RabbitMQ、安装插件

Docker-compose安装RabbitMQ

1.安装Docker,dockercompose

2.新建启动配置文件

[root@rabbitmq63 dockercompose]# cat deploy_rabbimq.sh
#/bin/bash
case "$1" in
"restart")
docker ps -a | grep rabbitmq | awk '{print $1}'|xargs docker stop
docker-compose -f rabbimq_deploy.yaml up -d
;;
*)
docker ps -a | grep rabbitmq | awk '{print $1}'|xargs docker stop
docker ps -a | grep rabbitmq | awk '{print $1}'|xargs docker rm
docker-compose -f rabbimq_deploy.yaml up -d
;;
[root@rabbitmq63 dockercompose]# cat rabbimq_deploy.yaml
version: '3.7'
services:
  rabbitmq:
    image: rabbitmq:3.10-management
    container_name: rabbitmq
    restart: always
    privileged: true
    networks:
      mq-net:
        ipv4_address: 172.27.10.10
    environment:
     - 'RABBITMQ_DEFAULT_USER=guest'
     - 'RABBITMQ_DEFAULT_PASS=guest'
    volumes:
      - /usr/local/rabbitmq/data:/var/lib/rabbitmq/
    ports:
      - 5672:5672
      - 15672:15672

networks:
  mq-net:
    driver: bridge
    ipam:
      config:
        - subnet: 172.27.10.0/24

3.启动

./deploy_rabbimq.sh

安装插件

delayed_message

delayed_message插件地址:https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download/3.10.2/rabbitmq_delayed_message_exchange-3.10.2.ez

安装

● 容器内部查看已有插件列表

rabbitmq-plugins list

● 容器内部查看插件目录

rabbitmq-plugins directories -s 

●查看插件目录

root@rabbitmq-6bff494979-4jhtw:~# rabbitmq-plugins directories -s 
Plugin archives directory: /opt/rabbitmq/plugins
Plugin expansion directory: /var/lib/rabbitmq/mnesia/rabbit@rabbitmq-6bff494979-4jhtw-plugins-expand
Enabled plugins file: /etc/rabbitmq/enabled_plugin

● 上传插件

docker cp /root/rabbitmq_delayed_message_exchange-3.10.2.ez 3d135065aa9b:/opt/rabbitmq/plugins

● 容器内部启动插件

rabbitmq-plugins enable rabbitmq_delayed_message_exchange

你可能感兴趣的:(rabbitmq,docker,linux,rabbitmq,docker)