RocketMQ学习笔记
RabbitMQ安装
安装
常规安装
Docker安装
1 |
docker-compose部署
单体
-
创建文件夹
1
mkdir -p RocketMQ/data/{broker,namesrv}/{conf,logs,store}/
-
在RocketMQ文件夹下创建docker-compose.yaml文件
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
49version: '3.4'
services:
namesrv:
image: apacherocketmq/rocketmq:4.5.0
container_name: rmqnamesrv
ports:
- 9876:9876
volumes:
- ./data/namesrv/logs:/home/rocketmq/logs
command: sh mqnamesrv
networks:
rmq:
aliases:
- rmqnamesrv
broker:
image: apacherocketmq/rocketmq:4.5.0
container_name: rmqbroker
ports:
- 10909:10909
- 10911:10911
- 10912:10912
volumes:
- ./data/broker/logs:/home/rocketmq/logs
- ./data/broker/store:/home/rocketmq/store
- ./data/broker/conf/broker.conf:/home/rocketmq/rocketmq-4.5.0/conf/broker.conf
command: sh mqbroker -n namesrv:9876 -c ../conf/broker.conf
networks:
rmq:
aliases:
- rmqnamesrv
depends_on:
- namesrv
dashboard:
image: apacherocketmq/rocketmq-dashboard:latest
container_name: rocketmq-dashboard
ports:
- 8680:8080
environment:
JAVA_OPTS: "-Drocketmq.namesrv.addr=namesrv:9876"
networks:
rmq:
aliases:
- rmqnamesrv
depends_on:
- namesrv
networks:
rmq:
name: rmq
driver: bridge -
在.\data\broker\conf\下创建broker.conf文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21brokerClusterName = DefaultCluster
# brokerClusterName cluster地址 集群数量比较多是可以分成多个cluster 每个cluster一个业务
brokerName = broker-a
# brokerName broker 名称 master与slave使用同一个brokerName名称
brokerId = 0
# 0 表示Master 大于0 表示不同的slaveID
deleteWhen = 04
# 删除消息的时间
fileReservedTime = 48
# 消息保留时间
brokerRole = ASYNC_MASTER
# brokerRole 主从同步策略
# ASYNC_MASTER: 异步复制Master
# SYNC_MASTER: 同步双写Master
# SLAVE: slave
flushDiskType = ASYNC_FLUSH
#刷盘策略
# ASYNC_FLUSH 异步
# SYNC_FLUSH 同步
brokerIP1=192.168.0.109
# 设定broker机器对外暴露的ip地址 -
在RocketMQ 输入docker-compose命令运行程序
1
docker-compose up -d
访问8680端口即可看见dashboard页面
export NAMESRV_SDDR=localhost:9876
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Raykie’s blog!
评论