赞
踩
这里注意获取镜像的时候要获取management版本的,不要获取last版本的,management版本的才带有管理界面。
docker search rabbitmq:management
可以看到如下结果:
[root@localhost ~]# docker search rabbitmq:management
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/macintoshplus/rabbitmq-management Based on rabbitmq:management whit python a... 1 [OK]
docker.io docker.io/transmitsms/rabbitmq-sharded Fork of rabbitmq:management with sharded_e... 0
[root@localhost ~]#
获取镜像
docker pull rabbitmq:management
可以看到如下结果
[root@localhost ~]# docker pull rabbitmq:management
Trying to pull repository docker.io/library/rabbitmq ...
management: Pulling from docker.io/library/rabbitmq
e7bb522d92ff: Pull complete
ad90649c4d84: Pull complete
5a318b914d6c: Pull complete
cedd60f70052: Pull complete
f4ec28761801: Pull complete
b8fa44aa9074: Pull complete
e8002a209c24: Pull complete
cd1206edcd43: Pull complete
769be0727074: Pull complete
7308b93d35af: Pull complete
c4102ef22c29: Pull complete
fefc8e1aa4b5: Pull complete
a271d400045b: Pull complete
b0d4c40c62de: Pull complete
Digest: sha256:8761de2c22badfc86dfe89791dc9dbf122f67ff0f8981966573d267af421b97f
[root@localhost ~]#
docker run -d -p 5672:5672 -p 15672:15672 -p 15675:15675 -p 1883:1883 --name rabbitmq rabbitmq:management
看到如下结果,变成功了:
[root@localhost ~]# docker run -d -p 5672:5672 -p 15672:15672 --name rabbitmq rabbitmq:management
e194a2dbeb52f2296dfb6d1c527cf052d82be5ed9a4c974d70dcd6af3da3eb7e
[root@localhost ~]#
docker cp rabbitmq:/opt/rabbitmq/plugins /usr/local/rabbitmq/
# 设置默认用户
docker run \
-e RABBITMQ_DEFAULT_USER=demo \
-e RABBITMQ_DEFAULT_PASS=123 \
-v /usr/local/rabbitmq/plugins:/plugins \
-d -p 5672:5672 -p 15672:15672 -p 15675:15675 -p 1883:1883 --name rabbitmq rabbitmq:management
指定子网络运行
docker run -d -p 5672:5672 -p 15672:15672 --network elk-net --name rabbitmq rabbitmq:management
# 也可以后面指定
docker network connect --alias rabbitmq mynet rabbitmq
访问管理界面的地址就是 http://[宿主机IP]:15672,可以使用默认的账户登录,用户名和密码都guest,如:http://192.168.0.44:15672
Name | Tags | Can access virtual hosts | Has password |
---|---|---|---|
admin | administrator,management,policymaker | / | ● |
guest | administrator | /, /heima | ● |
hikinner | administrator,management | / | ● |
# 查看用户
rabbitmqctl list_users
# 修改用户名对应密码
rabbitmqctl change_password Username 'Newpassword'
进入命令
docker exec -it rabbitmq /bin/bash
执行安装
rabbitmq-plugins enable rabbitmq_mqtt
提示如下安装成功
Enabling plugins on node rabbit@54978086cc2f:
rabbitmq_mqtt
The following plugins have been configured:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_mqtt
rabbitmq_web_dispatch
Applying plugin configuration to rabbit@54978086cc2f...
The following plugins have been enabled:
rabbitmq_mqtt
started 1 plugins.
进入命令
docker exec -it rabbitmq /bin/bash
执行安装
rabbitmq-plugins enable rabbitmq_web_mqtt
提示如下安装成功
Enabling plugins on node rabbit@401063285a70:
rabbitmq_web_mqtt
The following plugins have been configured:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_mqtt
rabbitmq_prometheus
rabbitmq_web_dispatch
rabbitmq_web_mqtt
Applying plugin configuration to rabbit@401063285a70...
The following plugins have been enabled:
rabbitmq_web_mqtt
started 1 plugins.
插件地址:https://www.rabbitmq.com/community-plugins.html
github:https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/tag/3.9.0
下载:rabbitmq_delayed_message_exchange-3.9.0.ez
由于我的rabbitmq版本是RabbitMQ 3.9.13,所以我们安装3.9.0的插件
mv rabbitmq_delayed_message_exchange-3.9.0.ez /usr/local/rabbitmq/plugins/
# 进入容器
docker exec -it rabbitmq /bin/bash
# 启用插件
rabbitmq-plugins enable rabbitmq_delayed_message_exchange
提示如下说明安装成功:
oot@01e900b94fb4:/# rabbitmq-plugins enable rabbitmq_delayed_message_exchange
Enabling plugins on node rabbit@01e900b94fb4:
rabbitmq_delayed_message_exchange
The following plugins have been configured:
rabbitmq_delayed_message_exchange
rabbitmq_management
rabbitmq_management_agent
rabbitmq_mqtt
rabbitmq_prometheus
rabbitmq_web_dispatch
rabbitmq_web_mqtt
Applying plugin configuration to rabbit@01e900b94fb4...
The following plugins have been enabled:
rabbitmq_delayed_message_exchange
started 1 plugins.
虚拟主机概念是RabbitMQ的核心,在用户未自定义虚拟机前已经内置有虚拟机,在使用RabbitMQ中,可以进行自定义配置虚拟机.一个虚拟机中可以含有多个队列信息
虚拟机最大的好处在于可以根据不同的用户分配不同的操作空间
可以理解是多租户的概念,每个用虚拟主机的交换机,队列等隔离
可以参考https://blog.csdn.net/qq_42549122/article/details/90642239
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。