安装前先要安装好docker以及docker-compose
常用资料地址
配置解析
创建数据挂载目录
mkdir -p /home/rocketmq/{broker/conf,broker/logs,broker/store,console/logs,namesrv/logs}
broker.conf
目录:/home/rocketmq/broker/conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
| # 是否允许 Broker 自动创建 Topic,建议线下开启,线上关闭 autoCreateTopicEnable=true
# 是否允许 Broker 自动创建订阅组,建议线下开启,线上关闭 autoCreateSubscriptionGroup=true
# Broker角色 # - ASYNC_MASTER 异步复制Master # - SYNC_MASTER 同步双写Master # - SLAVE brokerRole=ASYNC_MASTER
# 所属集群名字 brokerClusterName = DefaultCluster
# broker 名字,注意此处不同的配置文件填写的不一样,如果在 broker-a.properties 使用: broker-a, # 在 broker-b.properties 使用: broker-b brokerName = broker-a
# 0 表示 Master,> 0 表示 Slave brokerId = 0
# 启动 IP,修改为你宿主机的 IP # 如果是正式环境,这里一定要填写内网地址(安全) # 如果是用于测试或者本地这里建议要填外网地址,因为你的本地代码是无法连接到阿里云内网,只能连接外网 brokerIP1 = 192.168.199.10
# 在发送消息时,自动创建服务器不存在的topic,默认创建的队列数 defaultTopicQueueNums=4
# 删除文件时间点,默认凌晨4点 deleteWhen=04
# 文件保留时间,默认48小时 fileReservedTime = 120
# 刷盘方式 # - ASYNC_FLUSH 异步刷盘 # - SYNC_FLUSH 同步刷盘 flushDiskType=ASYNC_FLUSH
# Broker 对外服务的监听端口 listenPort=10911
# 检测物理文件磁盘空间 diskMaxUsedSpaceRatio=88
# commitLog 每个文件的大小默认 1G,单位 b mapedFileSizeCommitLog=1073741824
# ConsumeQueue 每个文件默认存 30W 条,根据业务情况调整 mapedFileSizeConsumeQueue=300000
# 限制的消息大小,单位 b maxMessageSize=524288
# nameServer地址,分号分割 # namesrvAddr=rocketmq-nameserver1:9876;rocketmq-nameserver2:9876 namesrvAddr=192.168.199.10:9876 # 存储路径 # storePathRootDir=/home/ztztdata/rocketmq-all-4.1.0-incubating/store # commitLog 存储路径 # storePathCommitLog=/home/ztztdata/rocketmq-all-4.1.0-incubating/store/commitlog # 消费队列存储 # storePathConsumeQueue=/home/ztztdata/rocketmq-all-4.1.0-incubating/store/consumequeue # 消息索引存储路径 # storePathIndex=/home/ztztdata/rocketmq-all-4.1.0-incubating/store/index # checkpoint 文件存储路径 # storeCheckpoint=/home/ztztdata/rocketmq-all-4.1.0-incubating/store/checkpoint # abort 文件存储路径 # abortFile=/home/ztztdata/rocketmq-all-4.1.0-incubating/store/abort # 发消息线程池数量 # sendMessageThreadPoolNums=128 # 拉消息线程池数量 # pullMessageThreadPoolNums=128
# 未标注 # destroyMapedFileIntervalForcibly=120000 # redeleteHangedFileInterval=120000
|
docker-compose
暂未完成
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| version: '3.5' services: rmqnamesrv: image: apache/rocketmq:5.1.0 container_name: rmqnamesrv restart: always ports: - 9876:9876 environment: JAVA_OPT_EXT: "-Duser.home=/home/rocketmq -server -Xms1g -Xmx1g" volumes: - /data/rocketmq/namesrv/logs:/home/rocketmq/logs command: [ "sh", "mqnamesrv" ] networks: rmq: aliases: - rmqnamesrv
rmqbroker: image: apache/rocketmq:5.1.0 container_name: rmqbroker restart: always depends_on: - rmqnamesrv ports: - 10909:10909 - 10911:10911 volumes: - /data/rocketmq/broker/logs:/root/logs - /data/rocketmq/broker/store:/root/store - /data/rocketmq/broker/conf/broker.conf:/home/rocketmq/broker.conf command: [ "sh", "mqbroker", "-c", "/home/rocketmq/broker.conf" ] environment: NAMESRV_ADDR: "rmqnamesrv:9876" JAVA_OPT_EXT: "-Duser.home=/home/rocketmq -server -Xms1g -Xmx1g -Xmn1g" networks: rmq: aliases: - rmqbroker
rmqdashboard: image: apacherocketmq/rocketmq-dashboard:latest container_name: rmqdashboard restart: always ports: - 18080:8080 depends_on: - rmqnamesrv volumes: - /etc/localtime:/etc/localtime:ro - /data/rocketmq/console/logs:/root/logs environment: JAVA_OPTS: "-Drocketmq.namesrv.addr=rmqnamesrv:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false" networks: rmq: aliases: - rmqdashboard
networks: rmq: name: rmq driver: bridge
|
常见问题: