Channel shutdown: connection error; protocol method: #method<connection.close>

2019-09-24 13:05:30.145 ERROR 8444 — [168.47.131:5672] o.s.a.r.c.CachingConnectionFactory : Channel shutdown: connection error; protocol method: #method(reply-code=503, reply-text=COMMAND_INVALID - unknown exchange type ‘x-delayed-message’, class-id=40, method-id=10)
这个原因是没有安装mq的延迟rabbitmq_delayed_message_exchange
**首先:**下载rabbitmq_delayed_message_exchange
Docker安装rabbitMq并安装延时插件
插件的下载地址:https://www.rabbitmq.com/community-plugins.html

启动镜像
docker run -d -p 5672:5672 -p 15672:15672 -p 15674:15674 -p 5671:5671 -p 15671:15671 --name rabbit -e RABBITMQ_DEFAULT_USER=zwdbj -e RABBITMQ_DEFAULT_PASS=zwdbj rabbitmq:management

执行docker exec -it /bin/bash命令进入到容器内部,rabbit是RabbitMQ容器ID,注意替换你自己的,然后我们可以看到plugins目录
docker exec -it rabbit /bin/bash

在容器外边执行docker cp /mnt/rabbitmq_delayed_message_exchange-3.8.0.ez 3a:/plugins命令,将刚插件拷贝到容器内plugins目录下

docker cp /opt/software/rabbitmq_delayed_message_exchange-3.8.0.ez rabbit:/plugins

1
在容器内plugins目录下,查看插件是否上传成功ls -l|grep delay

启用插件
同样是在容器内plugins目录下执行rabbitmq-plugins enable rabbitmq_delayed_message_exchange

到这里插件安装就完成了,接下来我们需要重启RabbitMQ容器。执行exit命令退出RabbitMQ容器内部,然后执行docker restart rabbit命令重启RabbitMQ容器

docker restart rabbit

你可能感兴趣的:(rabbitmq)