Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy and monitor distributed message queuing RocketMQ

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you "how to deploy and monitor distributed message queuing RocketMQ". The content is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to deploy and monitor distributed message queuing RocketMQ".

A brief introduction to RocketMQ

RocketMQ is a distributed, queuing model message middleware with the following characteristics:

1. Support strict message order

2. Support Topic and Queue modes

3. 100 million-level message accumulation capability

4. Friendly distributed features

5. Support both Push and Pull to consume messages

This paper adopts the architecture mode of double Master.

Second, server distribution

1. Related instructions

2. Add hosts information

# vim / etc/hosts10.217.121.123 mqnameserver110.217.122.31 mqnameserver210.217.121.123 rocketmq-master110.217.122.31 rocketmq-master2

3. System environment

CentOS 6.30

4. Overall structure

WKioL1PuQE3DcTjUAAE4E08WEfw644.jpg

III. Installation and configuration of RocketMQ

1. JDK installation

Http://download.oracle.com/otn-pub/java/jdk/7u65-b17/jdk-7u65-linux-x64.tar.gz# tar xvzf jdk-7u65-linux-x64.gz-C / usr/local# rm-f jdk-7u65-linux-x64.gz# cd / usr/local & & ln-s jdk1.7.0_65 jdk# cd / usr/local/bin & & ln-s / usr/local/jdk/bin/java

2. RocketMQ installation

Https://github.com/alibaba/RocketMQ/releases# tar xvzf alibaba-rocketmq-3.1.7.tar.gz-C / usr/local# mv alibaba-rocketmq alibaba-rocketmq-3.1.7# ln-s alibaba-rocketmq-3.1.7 rocketmq# rm alibaba-rocketmq-3.1.7.tar.gz# ll / usr/local

3. Environment variable setting

# vim / etc/profileexport PATH=$PATH:/usr/local/binexport JAVA_HOME=/usr/local/jdkexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport PATH=$PATH:$JAVA_HOME/binexport ROCKETMQ_HOME=/usr/local/rocketmqexport PATH=$PATH::$ROCKETMQ_HOME/bin# source / etc/profile# cd / usr/local/rocketmq/bin & & sh os.sh "

4. Hostname setting

(1) Master1 server

# vim / etc/hosts10.217.121.123 mqnameserver110.217.122.31 mqnameserver210.217.121.123 rocketmq-master110.217.122.31 rocketmq-master2# sed-I'/ HOSTNAME/d' / etc/sysconfig/network# echo 'HOSTNAME=rocketmq-master1' > > / etc/sysconfig/network# hostname rocketmq-master1

(2), Master2 server

# vim / etc/hosts10.217.121.123 mqnameserver110.217.122.31 mqnameserver210.217.121.123 rocketmq-master110.217.122.31 rocketmq-master2# sed-I'/ HOSTNAME/d' / etc/sysconfig/network# echo 'HOSTNAME=rocketmq-master2' > > / etc/sysconfig/network# hostname rocketmq-master2

5. RocketMQ configuration

(1) Master1 server

# vim / usr/local/rocketmq/conf/2m-noslave/broker-a.propertiesbrokerClusterName=AdpMqClusterbrokerName=broker-abrokerId=0namesrvAddr=mqnameserver1:9876;mqnameserver2:9876defaultTopicQueueNums=4autoCreateTopicEnable=trueautoCreateSubscriptionGroup=truelistenPort=10911deleteWhen=04fileReservedTime=120mapedFileSizeCommitLog=1073741824mapedFileSizeConsumeQueue=50000000destroyMapedFileIntervalForcibly=120000redeleteHangedFileInterval=120000diskMaxUsedSpaceRatio=88storePathRootDir=/data/rocketmq/storestorePathCommitLog=/data/rocketmq/store/commitlogmaxMessageSize=65536flushCommitLogLeastPages=4flushConsumeQueueLeastPages=2flushCommitLogThoroughInterval=10000flushConsumeQueueThoroughInterval=60000brokerRole=ASYNC_MASTERflushDiskType=ASYNC_FLUSHcheckTransactionMessageEnable=falsesendMessageThreadPoolNums=128pullMessageThreadPoolNums=128

(2), Master2 server

# vim / usr/local/rocketmq/conf/2m-noslave/broker-b.propertiesbrokerClusterName=AdpMqClusterbrokerName=broker-bbrokerId=1namesrvAddr=mqnameserver1:9876;mqnameserver2:9876defaultTopicQueueNums=4autoCreateTopicEnable=trueautoCreateSubscriptionGroup=truelistenPort=10911deleteWhen=04fileReservedTime=120mapedFileSizeCommitLog=1073741824mapedFileSizeConsumeQueue=50000000destroyMapedFileIntervalForcibly=120000redeleteHangedFileInterval=120000diskMaxUsedSpaceRatio=88storePathRootDir=/data/rocketmq/storestorePathCommitLog=/data/rocketmq/store/commitlogmaxMessageSize=65536flushCommitLogLeastPages=4flushConsumeQueueLeastPages=2flushCommitLogThoroughInterval=10000flushConsumeQueueThoroughInterval=60000brokerRole=ASYNC_MASTERflushDiskType=ASYNC_FLUSHcheckTransactionMessageEnable=falsesendMessageThreadPoolNums=128pullMessageThreadPoolNums=128

(3). Runbroker.sh parameter adjustment

Runbroker.sh needs to be adjusted appropriately according to memory size.

JAVA_OPT_1= "- server-Xms80g-Xmx80g-Xmn20g-XX:PermSize=1g-XX:MaxPermSize=1g"

6. Service startup

# mkdir-p / data/rocketmq/store/commitlog / data/logs# cd / usr/local/rocketmq/conf & & sed-I's customers ${user.home} # / data#g' * .xml

(1) start NameServer [master1, master2]

# cd / usr/local/rocketmq/bin# nohup sh mqnamesrv &

(2) start BrokerServer A [master1]

# cd / usr/local/rocketmq/bin# nohup sh mqbro ker- c.. / conf/2m-noslave/broker-a.properties > / dev/null 2 > & 1 &

(3) start BrokerServer B [master2]

# cd / usr/local/rocketmq/bin# nohup sh mqbroker-c.. / conf/2m-noslave/broker-b.properties > / dev/null 2 > & 1 & # netstat-ntlp# jps

4. Health monitoring of RocketMQ service

1. Dependent component installation

# yum-y install nmap

2. Nameserver monitoring

# vim / data/scripts/check_nameserver_health.sh

#! / bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin SRV_PORT= "9876" # # Port number SRV_PROT= "tcp" # # Protocol type SRV_NAME= "rocketmq_nameserver" # # Service name # # whether the SCAN_FLAG=0 for ETH_NAME has been scanned correctly In `/ sbin/ifconfig | grep eth2 | awk'{print $1} '`do ETH1_ADDR=` / sbin/ifconfig ${ETH_NAME} | awk-F':'/ inet addr/ {print $2}'| sed's / [a-zA-Z] / / g`` [[- z "${ETH1_ADDR}"] & & continue | | breakdone TMP_SRV_PROT= `echo ${SRV_PROT} | tr'[Amurz]'[ Amurz] '`if [["${TMP_SRV_PROT}" = = "tcp"]] Then PROT_OPT= "S" elif [["${TMP_SRV_PROT}" = = "udp"]]; then PROT_OPT= "U" else echo "unknown protocol type!" & & exit1 fi # # scan a maximum of 3 times and succeed once to avoid misjudging for due to network jitter. I / etc/rc.d/rc.local# echo 'touch / var/run/check_rocketmq_brokerserver.lock' > > / etc/rc.d/rc.local# crontab-eBay timeout=0 2 * (flock-- timeout=0 / var/run/check_rocketmq_nameserver.lock / data/scripts/check_nameserver_health.sh > / dev/null 2 > & 1) * / 2 * (flock-- timeout=0 / var/run/check_rocketmq_brokerserver.lock / data/scripts/check_brokerserver_health.sh > / dev/null 2 > & 1) these are all the contents of the article "how to deploy and monitor distributed message queuing RocketMQ" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report