In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "introduction to the advantages and disadvantages of RocketMQ multi-Master mode". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Introduction:
In multi-Master mode, there is no Slave in a cluster, and it is all Master, such as 2 Master or 3 Master.
Advantages: simple configuration, single Master downtime or restart maintenance will not affect the application. When the disk is configured as RAID10, even if the machine outage is unrecoverable, messages will not be lost because the RAID10 disk is very reliable (a small amount of messages will be lost in asynchronous flushing, and none will be lost in synchronous flushing). The highest performance.
Disadvantages: during the downtime of a single machine, messages that are not consumed on this machine cannot be subscribed until the machine is restored, and the real-time performance of messages will be affected.
1. Server environment: server A 192.168.192.130 Server B192.168.192.1312. Edit the hosts files of server An and server B, and add the same content vim / etc/hosts192.168.192.130 rocketmq-nameserver1192.168.192.130 rocketmq-master1192.168.192.131 rocketmq-nameserver2192.168.192.131 rocketmq-master23. Restart the network cards of both machines and the two servers ping each other to see if you can restart the ping 130ping rocketmq-nameserver1ping rocketmq-master24 on the ping 131ping rocketmq-nameserver2ping rocketmq-master2#131 on the network card $service network restart#130. Upload the alibaba-rocketmq-3.2.6.tar.gz to the / usr/local on both servers and decompress it, and rename it (both servers operate the same) tar-vxzf alibaba-rocketmq-3.2.6.tar.gzmv alibaba-rocketmq-3.2.6 rocketmq5. Create a storage path on both servers (both servers operate the same) mkdir / usr/local/rocketmq/storemkdir / usr/local/rocketmq/store/commitlogmkdir / usr/local/rocketmq/store/consumequeuemkdir / usr/local/rocketmq/store/index6. Edit the configuration file for rocketmq on both servers (both servers operate the same)
6.1 modify the broker-a.properties file
The name of the cluster to which vim / usr/local/rocketmq/conf/2m-noslave/broker-a.properties# belongs. Note that different configuration files are filled in here. BrokerName=broker-a#0 indicates Master, > 0 indicates SlavebrokerId=0#nameServer address, and semicolon divides namesrvAddr=rocketmq-nameserver1:9876. When rocketmq-nameserver2:9876# sends messages, it automatically creates topic for which the server does not exist. Whether the number of queues created by default defaultTopicQueueNums=4# allows Broker to automatically create Topic, it is recommended that offline enable, online shutdown autoCreateTopicEnable=true# allows Broker to automatically create subscription groups, it is recommended to enable offline, online close the listening port of autoCreateSubscriptionGroup=true#Broker external service listenPort=10911# to delete files, default 4: 00 am deleteWhen=04# file retention time Default 48-hour fileReservedTime=120#commitLog size per file default 1GmapedFileSizeCommitLog=1073741824#ConsumeQueue 30W per file by default Adjust mapedFileSizeConsumeQueue=300000#destroyMapedFileIntervalForcibly=120000#redeleteHangedFileInterval=120000# detection physical file disk space diskMaxUsedSpaceRatio=88# storage path storePathRootDir=/usr/local/rocketmq/store#commitLog storage path storePathCommitLog=/usr/local/rocketmq/store/commitlog# consumption queue storage path storePathConsumeQueue=/usr/local/rocketmq/store/consumequeue# message index storage path storePathIndex=/usr/local/rocketmq/store/index#checkpoint file storage path storeCheckPoint=/usr/local/rocketmq/store/checkpoint#abort file storage Role of storage path abortFile=/usr/local/rocketmq/store/abort# limited message size maxMessageSize=65536#flushCommitLogLeastPages=4#flushConsumeQueueLeastPages=2#flushCommitLogThoroughInterval=10000#flushConsumeQueueThoroughInterval=60000#Broker #-ASYNC_MASTER asynchronous replication Master#- SYNC_MASTER synchronous double write Master#- SLAVEbrokerRole=ASYNC_MASTER# flush mode #-ASYNC_FLUSH asynchronous flush #-SYNC_FLUSH synchronous flush flushDiskType=ASYNC_FLUSH#checkTransactionMessageEnable=false# number of sending thread pool # number of sendMessageThreadPoolNums=128# pull message thread pool # pullMessageThreadPoolNums=128
6.2 modify the broker-b.properties file
The name of the cluster to which vim / usr/local/rocketmq/conf/2m-noslave/broker-b.properties# belongs. Note that different configuration files are filled in here. BrokerName=broker-b#0 indicates Master, > 0 indicates SlavebrokerId=0#nameServer address, and semicolon divides namesrvAddr=rocketmq-nameserver1:9876. When rocketmq-nameserver2:9876# sends messages, it automatically creates topic for which the server does not exist. Whether the number of queues created by default defaultTopicQueueNums=4# allows Broker to automatically create Topic, it is recommended that offline enable, online shutdown autoCreateTopicEnable=true# allows Broker to automatically create subscription groups, it is recommended to enable offline, online close the listening port of autoCreateSubscriptionGroup=true#Broker external service listenPort=10911# to delete files, default 4: 00 am deleteWhen=04# file retention time Default 48-hour fileReservedTime=120#commitLog size per file default 1GmapedFileSizeCommitLog=1073741824#ConsumeQueue 30W per file by default Adjust mapedFileSizeConsumeQueue=300000#destroyMapedFileIntervalForcibly=120000#redeleteHangedFileInterval=120000# detection physical file disk space diskMaxUsedSpaceRatio=88# storage path storePathRootDir=/usr/local/rocketmq/store#commitLog storage path storePathCommitLog=/usr/local/rocketmq/store/commitlog# consumption queue storage path storePathConsumeQueue=/usr/local/rocketmq/store/consumequeue# message index storage path storePathIndex=/usr/local/rocketmq/store/index#checkpoint file storage path storeCheckPoint=/usr/local/rocketmq/store/checkpoint#abort file storage Storage path abortFile=/usr/local/rocketmq/store/abort# limited message size maxMessageSize=65536#flushCommitLogLeastPages=4#flushConsumeQueueLeastPages=2#flushCommitLogThoroughInterval=10000#flushConsumeQueueThoroughInterval=60000#Broker role #-ASYNC_MASTER asynchronous replication Master#- SYNC_MASTER synchronous double-write Master#- SLAVEbrokerRole=ASYNC_MASTER# flushing mode #-ASYNC_FLUSH asynchronous flushing disk #-SYNC_FLUSH synchronous flushing disk flushDiskType=ASYNC_FLUSH#checkTransactionMessageEnable=false# sending thread pool # sendMessageThreadPoolNums=128# pull message thread pool # pullMessageThreadPoolNums=1287. Modify the log configuration file of both machines (both servers operate the same) mkdir-p / usr/local/rocketmq/logscd / usr/local/rocketmq/conf & & sed-I's log ${user.home} # / usr/local/rocketmq#g' * .xml8. Modify startup script parameters, JVM tuning (both servers operate the same) # broker tuning vim / usr/local/rocketmq/bin/runbroker.sh
# nameserver tuning vim / usr/local/rocketmq/bin/runserver.sh
9. Start NameServer (both servers operate the same) cd / usr/local/rocketmq/binnohup sh mqnamesrv & jps-- to see process 10. Start BrokerServer A server Acd / usr/local/rocketmq/binnohup sh mqbroker-c / usr/local/rocketmq/conf/2m-noslave/broker-a.properties > / dev/null 2 > & 1 & netstat-ntlpjpstail-f-n 500 / usr/local/rocketmq/logs/rocketmqlogs/broker.logtail-f-n 500 / usr/local/rocketmq/logs/rocketmqlogs/namesrv.log11. Start BrokerServer B server Bcd / usr/local/rocketmq/binnohup sh mqbroker-c / usr/local/rocketmq/conf/2m-noslave/broker-b.properties > / dev/null 2 > & 1 & netstat-ntlpjpstail-f-n 500 / usr/local/rocketmq/logs/rocketmqlogs/broker.logtail-f-n 500 / usr/local/rocketmq/logs/rocketmqlogs/namesrv.log12. Stop the broker command cd / usr/local/rocketmq/binsh mqshutdown broker13. Stop the nameserver command sh bin/mqshutdown namesrv
14.rocketMq default log path
/ root/logs/rocketmqlogs
15. Turn off the firewall
Systemctl stop firewalld
This is the end of the introduction to the pros and cons of RocketMQ multi-Master mode. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.