- 下载延时插件
插件下载地址:https://www.rabbitmq.com/community-plugins.html
找到rabbitmq_delayed_message_exchange下载
chrome_sh2cJL0hsT.png
- 编写Dockerfile
FROM rabbitmq:3.8.2-management
COPY ["rabbitmq_delayed_message_exchange-3.8.0.ez" , "/plugins/"]
RUN rabbitmq-plugins enable rabbitmq_delayed_message_exchange
把下载好的延时插件rabbitmq_delayed_message_exchange-3.8.0.ez放到Dockerfile同目录下
fjava_GNfEnGRsl5.png
- 构建
docker build -t rabbitmq:3.8.2-management .
- 运行
docker run -it -d --hostname my-rabbit --name rabbitmq -p 15672:15672 -p 5672:5672 -v /data/rabbitmq/data:/var/lib/rabbitmq -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=你的密码 rabbitmq:3.8.2-management
- 访问rabbitmq
http://你的服务器ip:15672
在Exchanges–下面的Add a new exchanges — type下拉框中看到 x-delayed-message 就说明插件安装
image.png
网友评论