由于mac arm芯片的问题,导致随便拉取镜像会出现AMD64的警告,如果不想出现则可以
git clone https://github.com/apache/rocketmq-docker.git 拉代码自己编译镜像
下面是根据别人已经上传的镜像进行的本地部署操作 下面两个镜像都是某位老哥打包的,测试无问题
1.拉取rocketMq镜像 该版本为5.0.0
docker pull candice0630/rocketmq:5.0.0-alpine
2.拉取rocketMq控制台镜像
docker pull candice0630/rocketmq-console-ng:2.0
3.进行docker-compose编排镜像
version: "3.0"
services:
namesrv:
image: candice0630/rocketmq:5.0.0-alpine
container_name: rocketmqNameServer
#restart: always
volumes:
#挂载路径,冒号左边为服务器本地路径,冒号右边为容器内部路径
- /Users/dong/tool/rocketMqConfig/nameServer/logs:/root/logs
- /Users/dong/tool/rocketMqConfig/nameServer/store:/root/store
- /Users/dong/tool/rocketMqConfig/mq/bin/runserver.sh:/home/rocketmq/rocketmq-5.0.0/bin/runserver.sh
- /Users/dong/tool/rocketMqConfig/mq/bin/runbroker.sh:/home/rocketmq/rocketmq-5.0.0/bin/runbroker.sh
- /Users/dong/tool/rocketMqConfig/mq/bin/tools.sh:/home/rocketmq/rocketmq-5.0.0/bin/tools.sh
environment:
- MEM_XMS=500m
- MEM_XMX=500m
- MEM_XMN=256m
#MAX_POSSIBLE_HEAP: 100000000
command:
#服务启动
sh mqnamesrv
#platform: linux/amd64
ports:
- "9876:9876"
rocketmqBroker:
image: candice0630/rocketmq:5.0.0-alpine
container_name: rocketmqBroker
#restart: always
volumes:
#挂载路径,冒号左边为服务器本地路径,冒号右边为容器内部路径
- /Users/dong/tool/rocketMqConfig/broker/logs:/root/logs
- /Users/dong/tool/rocketMqConfig/broker/store:/root/store
- /Users/dong/tool/rocketMqConfig/broker.conf:/home/rocketmq/rocketmq-5.0.0/conf/broker.conf
- /Users/dong/tool/rocketMqConfig/mq/bin/runserver.sh:/home/rocketmq/rocketmq-5.0.0/bin/runserver.sh
- /Users/dong/tool/rocketMqConfig/mq/bin/runbroker.sh:/home/rocketmq/rocketmq-5.0.0/bin/runbroker.sh
- /Users/dong/tool/rocketMqConfig/mq/bin/tools.sh:/home/rocketmq/rocketmq-5.0.0/bin/tools.sh
depends_on:
- namesrv
environment:
- MEM_XMS=500m
- MEM_XMX=500m
- MEM_XMN=256m
- NAMESRV_ADDR:物理ip地址:9876
- BROKER_ID=0
- BROKER_ROLE=ASYNC_MASTER
- FLUSH_DISK_TYPE=ASYNC_FLUSH
#MAX_POSSIBLE_HEAP: 200000000
command:
# 服务启动
sh mqbroker -n namesrv:9876 -c /home/rocketmq/rocketmq-5.0.0/conf/broker.conf
#platform: linux/amd64
ports:
- "10909:10909"
- "10911:10911"
- "10912:10912"
rocketmqConsole:
image: candice0630/rocketmq-console-ng:2.0
container_name: rocketmqConsole
depends_on:
- namesrv
environment:
JAVA_OPTS: "-Drocketmq.namesrv.addr=namesrv:9876 -Drocketmq.config.isVIPChannel=false -Dcom.rocketmq.sendMessageWithVIPChannel=false"
#platform: linux/amd64
ports:
- 19876:8080
注意: runserver.sh,runbroker.sh可以自己配置下占用内存大小
JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx512m -Xmn256m"
JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx512m -Xmn512m -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=320m"
platform: linux/amd64 为当时拉取镜像导致的警告解决办法
4.进行broker.config设置
# 所属集群名称,如果节点较多可以配置多个
brokerClusterName = DefaultCluster
#broker名称,master和slave使用相同的名称,表明他们的主从关系
brokerName = broker-a
#0表示Master,大于0表示不同的slave
brokerId = 0
#表示几点做消息删除动作,默认是凌晨4点
deleteWhen = 04
#在磁盘上保留消息的时长,单位是小时
fileReservedTime = 48
#有三个值:SYNC_MASTER,ASYNC_MASTER,SLAVE;同步和异步表示Master和Slave之间同步数据的机制;
brokerRole = ASYNC_MASTER
#是否允许 Broker 自动创建 Topic,建议线下开启,线上关闭 !!!这里仔细看是 false,false,false
autoCreateTopicEnable=true
#刷盘策略,取值为:ASYNC_FLUSH,SYNC_FLUSH表示同步刷盘和异步刷盘;SYNC_FLUSH消息写入磁盘后才返回成功状态,ASYNC_FLUSH不需要;
flushDiskType = ASYNC_FLUSH
# 设置broker节点所在服务器的ip地址、物理ip,不能用127.0.0.1、localhost、docker内网ip
brokerIP1 =
# 磁盘使用达到95%之后,生产者再写入消息会报错 CODE: 14 DESC: service not available now, maybe disk full
diskMaxUsedSpaceRatio=95
brokerIP1 需要根据你自己本地的物理ip填写 最简单方式 也可根据下面方式获取
5.运行,生成容器
docker-compose up -d
6.访问控制台
文章来源:https://www.toymoban.com/news/detail-659576.html
文章来源地址https://www.toymoban.com/news/detail-659576.html
到了这里,关于mac M1 arm芯片 进行docker rocketMq 本地部署(亲测可用)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!