docker安装rabbitmq
一、拉取镜像
docker pull rabbitmq
二、创建容器
docker run -d -p 15672:15672 -p 5672:5672 -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=123456 --hostname myRabbit --name rabbitmq rabbitmq:latest
三、进入容器修改配置
docker exec -it rabbitmq /bin/bash
rabbitmq-plugins enable rabbitmq_management
rabbitmq-plugins enable rabbitmq_stomp
安装延迟队列插件
下载地址:https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases
docker cp rabbitmq_delayed_message_exchange-3.13.0.ez rabbitmq:/plugins
进入容器执行插件安装
docker exec -it rabbitmq /bin/bash
cd plugins
rabbitmq-plugins enable rabbitmq_delayed_message_exchange
修改容器中 /etc/rabbitmq/conf.d/management_agent.disable_metrics_collector.conf 将 management_agent.disable_metrics_collector = false
docker cp rabbitmq:/etc/rabbitmq/conf.d/management_agent.disable_metrics_collector.conf Downloads/
docker cp Downloads/management_agent.disable_metrics_collector.conf rabbitmq:/etc/rabbitmq/conf.d/management_agent.disable_metrics_collector.conf
重启容器进行验证
访问地址:http://localhost:15672/