rabbitmq是一种比较常见的操作消息队列方式,接下来就使用dockr对rabbitmq进行一键快速的部署.

1.直接用docker search 搜索,默认下载标签为latest的镜像

[testhadoop@sz-145-centos101 ~]$ sudo docker search rabbitmq
NAME                                       DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
rabbitmq                                   RabbitMQ is an open source multi-protocol ...   2691      [OK]       
bitnami/rabbitmq                           Bitnami Docker Image for RabbitMQ               30                   [OK]
tutum/rabbitmq                             Base docker image to run a RabbitMQ server      19                   
frodenas/rabbitmq                          A Docker Image for RabbitMQ                     12                   [OK]
kbudde/rabbitmq-exporter                   rabbitmq_exporter for prometheus                11                   [OK]
arm32v7/rabbitmq                           RabbitMQ is an open source multi-protocol ...   7                    
cyrilix/rabbitmq-mqtt                      RabbitMQ MQTT Adapter                           7                    [OK]
gonkulatorlabs/rabbitmq                    DEPRECATED: See maryville/rabbitmq              5                    [OK]
aweber/rabbitmq-autocluster                RabbitMQ with the Autocluster Plugin            4                    
pivotalrabbitmq/rabbitmq-autocluster       RabbitMQ with the rabbitmq-autocluster plu...   3                    
pivotalrabbitmq/rabbitmq-server-buildenv   Image used to build and test RabbitMQ serv...   3                    
authentise/rabbitmq                        A RabbitMQ image that will run a bash scri...   2                    [OK]
deadtrickster/rabbitmq_prometheus          RabbitMQ + Prometheus RabbitMQ Exporter pl...   2                    
henrylv206/rabbitmq-autocluster            RabbitMQ Cluster                                2                    [OK]
riftbit/rabbitmq3                          RabbitMQ 3.x Container based on Alpine Lin...   1

2.使用docker pull rabbitmq 指令拉取镜像(如果是普通用户这里需要用到sudo获取管理员权限哦)

3.创建容器并运行(1562是管理界面,5672是服务的端口)

docker run -dit --name myrabbitmq -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin -p 15672:15672 -p 5672:5672 rabbitmq
指定容器名字 并且设置环境变量是用户名和密码均为admin

4.这样还没有结束,还需要开启rabbitmq的web界面管理插件

//首先使用命令进入rabbitmqrongqi
[root@localhost ~]# docker exec -it myrabbitmq /bin/bash
//在容器中执行以下命令即可开启
rabbitmq-plugins enable rabbitmq_management

root@fc15b7033756:/# rabbitmq-plugins enable rabbitmq_management
Enabling plugins on node rabbit@fc15b7033756:
rabbitmq_management
The following plugins have been configured:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_prometheus
  rabbitmq_web_dispatch
Applying plugin configuration to rabbit@fc15b7033756...
The following plugins have been enabled:
  rabbitmq_management

started 1 plugins.

5.之后即可通过网页访问15672端口进入rabbitmq web管理界面

6.输入用户名和密码,大功告成!


一沙一世界,一花一天堂。君掌盛无边,刹那成永恒。