安装docker desktop
下载地址:docker desktop for mac and windows | docker
确认docker-compose命令是否可用
docker-compose –version
查看docker镜像
docker search rocketmq
下载镜像
apacherocketmq/rocketmq
docker pull apacherocketmq/rocketmq
编写yml文件
docker-compose.yml
services:
namesrv:
image: apacherocketmq/rocketmq
container_name: rmqnamesrv
ports:
- 9876:9876
volumes:
- d:/rocketmq/namesrv/logs:/home/rocketmq/logs
command: sh mqnamesrv
broker:
image: apacherocketmq/rocketmq
container_name: rmqbroker
ports:
- 10909:10909
- 10911:10911
- 10912:10912
volumes:
- d:/rocketmq/broker/logs:/home/rocketmq/logs
- d:/rocketmq/broker/store:/home/rocketmq/store
- d:/rocketmq/broker/conf/broker.conf:/home/rocketmq/rocketmq-4.6.0/conf/broker.conf
environment:
namesrv_addr: "namesrv:9876"
java_opts: " -duser.home=/opt"
java_opt_ext: "-server -xms128m -xmx128m -xmn128m"
command: sh mqbroker -n namesrv:9876 -c ../conf/broker.conf
depends_on:
- namesrv
rmqconsole:
image: styletang/rocketmq-console-ng
container_name: rmqconsole
ports:
- 18080:8080
environment:
java_opts: "-drocketmq.namesrv.addr=namesrv:9876 -dcom.rocketmq.sendmessagewithvipchannel=false"
depends_on:
- namesrv
docker中没有指定tag,安装时间为2021-10-13,使用latest,是4.6.0,所以修改上述配置文件到4.6.0目录
在d:/rocketmq/broker/conf/目录下配置broker.conf
-d:/rocketmq/broker/conf/broker.conf:/home/rocketmq/rocketmq-4.6.0/conf/broker.conf
broker.conf文件
# licensed to the apache software foundation (asf) under one or more # contributor license agreements. see the notice file distributed with # this work for additional information regarding copyright ownership. # the asf licenses this file to you under the apache license, version 2.0 # (the "license"); you may not use this file except in compliance with # the license. you may obtain a copy of the license at # # http://www.apache.org/licenses/license-2.0 # # unless required by applicable law or agreed to in writing, software # distributed under the license is distributed on an "as is" basis, # without warranties or conditions of any kind, either express or implied. # see the license for the specific language governing permissions and # limitations under the license. brokerclustername = defaultcluster brokername = broker-a brokerid = 0 deletewhen = 04 filereservedtime = 48 brokerrole = async_master flushdisktype = async_flush #使用docker-compose部署后端时,同一个局域网不需要配置brockerip1 brokerip1=本机的ip
创建并启动容器
在yml所在的目录中运行
docker-compose up -d
可视化客户端(默认端口号8080)
在yml 已经将端口号改为18080
http://localhost:18080/#/
到此这篇关于docker desktop下安装rocketmq的文章就介绍到这了,更多相关docker安装rocketmq内容请搜索www.887551.com以前的文章或继续浏览下面的相关文章希望大家以后多多支持www.887551.com!