多master(3台)部署rocketmq
1、下载地址https://mirrors.tuna.tsinghua.edu.cn/apache/rocketmq/4.8.0/rocketmq-all-4.8.0-bin-release.zip
2、解压,创建软连接,配置/etc/hosts
1
2
3
4
|
unzip rocketmq-all-4.8.0-bin-release.zip mv rocketmq-all-4.8.0-bin-release /home/ cd /home ln -s rocketmq-all-4.8.0-bin-release rocketmq |
3、安装jdk
1
2
3
4
5
6
7
8
|
rpm -ivh jdk-8u281-linux-x64.rpm vi /etc/profile export JAVA_HOME= '/usr/java/jdk1.8.0_281-amd64' export JRE_HOME= '/usr/java/jdk1.8.0_281-amd64/jre' :wq . /etc/profile |
4、创建数据目录
1
2
3
|
mkdir /data/rocketmq/store/commitlog -p mkdir /data/rocketmq/store/consumequeue -p mkdir /data/rocketmq/store/index -p |
5、修改/home/rocketmq/conf/2m-noslave/broker-a.properties
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
brokerClusterName=DefaultCluster brokerName=broker-a brokerId=0 deleteWhen=04 fileReservedTime=24 # broker 的角色; 同步双写master brokerRole=SYNC_MASTER # 刷盘方式; 同步刷盘 flushDiskType=SYNC_FLUSH namesrvAddr=rocketmq-master-01.itvgame.org:9876;rocketmq-master-02.itvgame.org:9876 #commitlog目录所在分区的最大使用比例,如果commitlog目录所在的分区使用比例大于该值,则触发过期文件删除 diskMaxUsedSpaceRatio=60 # 存储路径(手动创建) storePathRootDir= /data/rocketmq/store # commitLog 存储路径(手动创建) storePathCommitLog= /data/rocketmq/store/commitlog # 消息队列存储路径(手动创建) storePathConsumeQueue= /data/rocketmq/store/consumequeue # 消息索引存储路径(手动创建) storePathIndex= /data/rocketmq/store/index # checkpoint 文件存储路径(该文件自动生成) storePathCheckpoint= /usr/local/rocketmq/store/checkpoint # abort 文件存储路径(该文件自动生成) abortFile= /usr/local/rocketmq/store/abort |
6、修改日志配置文件
1
2
|
mkdir /home/rocketmq/logs -p cd /home/rocketmq/conf && sed -i 's#${user.home}#/home/rocketmq#g' *.xml |
7、配置RocketMQ JVM内存启动参数(当前为默认值)
1
2
|
vi /home/rocketmq/bin/runbroker .sh vi /home/rocketmq/bin/runserver .sh |
8、三台机器启动namesrv
1
|
cd /home/rocketmq/bin/ && nohup sh mqnamesrv & |
9、三台机器启动Broker
1
|
cd /home/rocketmq/bin/ && nohup sh mqbroker -c /home/rocketmq/conf/2m-noslave/broker-a .properties > /dev/null 2>&1 & |
10、创建topic
1
2
|
# 该版本mqadmin只支持使用IP . /bin/mqadmin updateTopic -n 172.19.x.186:9876 -t ls_status -c DefaultCluster |
11、查看topic状态
1
2
|
# 该版本mqadmin只支持使用IP . /bin/mqadmin topicStatus -n 172.19.x.186:9876 -t ls_status |
12、删除topic
1
2
|
# 该版本mqadmin只支持使用IP . /bin/mqadmin deleteTopic -c DefaultCluster -n 172.19.x.186:9876 -t ls_status |
13、发送、读取消息
http://gitlab.itvgame.org/devops/test-rocketmq
下载地址:
http://soft.itvgame.org/05.linux%E8%BD%AF%E4%BB%B6/03.%E9%80%9A%E7%94%A8/test-rocketmq