docker安装
https://blog.csdn.net/m0_52985087/article/details/135777294
docker-compose安装
配置
rabbit-mq:
image: rabbitmq:management
ports:
- 5672:5672
- 15672:15672
restart: always
privileged: true
container_name: rabbit-mq
environment:
RABBITMQ_DEFAULT_USER: xxxx
RABBITMQ_DEFAULT_PASS: "xxx"
RABBITMQ_DEFAULT_VHOST: my_vhost
volumes:
- /sainiao/zhijian/rabbitmq/conf:/etc/rabbitmq
配置文件
ls /sainiao/zhijian/rabbitmq/conf
conf.d enabled_plugins
enabled_plugins
[rabbitmq_management].
ls /sainiao/zhijian/rabbitmq/conf/conf.d
10-default-guest-user.conf management_agent.disable_metrics_collector.conf
10-default-guest-user.conf
loopback_users.guest = false //允许外部访问
management_agent.disable_metrics_collector.conf
management_agent.disable_metrics_collector = false //设置记录信息
安装插件
查看插件
docker exec -it rabbit-mq rabbitmq-plugins list
发现没有自动拉取消息插件
进入容器下载插件
docker exec -it rabbit-mq bash
cd /plugins
curl -LO https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download/v3.9.0/rabbitmq_delayed_message_exchange-3.9.0.ez
此时会遇到
bash: curl: command not found
1.运行以下命令更新包管理器并安装 curl:
apt-get update
apt-get install curl -y
2.安装 curl 后,使用之前的命令下载插件:
curl -LO https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download/v3.9.0/rabbitmq_delayed_message_exchange-3.9.0.ez
3.启用插件
rabbitmq-plugins enable rabbitmq_delayed_message_exchange
4.重启
docker-compose restart rabbit-mq
5.验证插件是否可用
docker exec -it rabbit-mq rabbitmq-plugins list
宿主机安装插件
官网下载,上传到宿主机
https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases
然后复制到容器内
docker cp rabbitmq_delayed_message_exchange-3.9.0.ez rabbit-mq:/plugins
// 进入宿主机
docker exec -it rabbit-mq bash
cd /plugins
ls |grep delay
rabbitmq-plugins enable rabbitmq_delayed_message_exchange
exit
// 重启容器
docker restart rabbit-mq
docker exec -it rabbit-mq rabbitmq-plugins list
容器启动成功之后,登录RabbitMQ的管理页面,找到ExchangesTab页。点击Add a new exchange,在Type里面查看是否有x-delayed-message选项,如果存在就代表插件安装成功。
评论区