配置 Docker 容器的 RabbitMQ

栏目: 编程工具 · 发布时间: 6年前

内容简介:版权声明:版权归博主所有,转载请带上本文链接!联系方式:abel533@gmail.com https://blog.csdn.net/isea533/article/details/88036082

版权声明:版权归博主所有,转载请带上本文链接!联系方式:abel533@gmail.com https://blog.csdn.net/isea533/article/details/88036082

针对 rabbitmq 进行配置:

创建步骤如下。

1. 启动容器

docker run -d --hostname my-rabbit --name rabbitmq -p 8080:15672 \
 rabbitmq:3.7-management-alpine

2. 进入容器

docker exec -it rabbitmq /bin/sh

3. 启用插件

umask 0022; rabbitmq-plugins enable --offline \
 rabbitmq_auth_backend_http rabbitmq_auth_backend_cache rabbitmq_web_stomp

特别注意这里的 umask 0022; ,只有这样配置,镜像才能读取插件配置,才能启动成功。

输出内容:

The following plugins have been configured:
  rabbitmq_auth_backend_cache
  rabbitmq_auth_backend_http
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_stomp
  rabbitmq_web_dispatch
  rabbitmq_web_stomp
Applying plugin configuration to rabbit@my-rabbit...
The following plugins have been enabled:
  rabbitmq_auth_backend_cache
  rabbitmq_auth_backend_http
  rabbitmq_stomp
  rabbitmq_web_stomp

set 7 plugins.
Offline change; changes will take effect at broker restart.

4. 配置 /etc/rabbitmq/rabbitmq.conf

在配置中追加:

auth_backends.1 = cache

# auth_backends.1 = http
auth_backends.2 = internal

auth_cache.cached_backend = http

auth_http.http_method   = post

auth_http.user_path = http://rabbitmq-auth:8080/auth/user
auth_http.vhost_path = http://rabbitmq-auth:8080/auth/vhost
auth_http.resource_path = http://rabbitmq-auth:8080/auth/resource
auth_http.topic_path = http://rabbitmq-auth:8080/auth/topic

auth_cache.cache_ttl = 60000

特别注意,后续需要提供 rabbitmq-auth 服务进行认证。

5. 退出容器提交

退出容器后,使用容器当前状态提交为新的镜像,参考命令如下:

docker commit rabbitmq 镜像名:版本

后续使用镜像时,就可以直接使用插件提供的功能了。


以上所述就是小编给大家介绍的《配置 Docker 容器的 RabbitMQ》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Trading and Exchanges

Trading and Exchanges

Larry Harris / Oxford University Press, USA / 2002-10-24 / USD 95.00

This book is about trading, the people who trade securities and contracts, the marketplaces where they trade, and the rules that govern it. Readers will learn about investors, brokers, dealers, arbit......一起来看看 《Trading and Exchanges》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具