Download installation package
Execute the following command
wget https://archive.apache.org/dist/rocketmq/4.8.0/rocketmq-all-4.8.0-bin-release.zip
or https://rocketmq.apache.org/release_notes/release-notes-4.8.0/ Download the installation package from the official website and upload it to the server folder.
decompression
unzip rocketmq-all-4.8.0-bin-release.zip
rename
mv rocketmq-all-4.8.0-bin-release rocketmq4.8
Modify profile
Modify server 1 centos7_01
Create new file storage directories for broker-a and broker-b under the root directory of rocketmq
mkdir storeAMaster
mkdir storeBSlave
Enter the 2m-2s-async directory / rocketmq/rocketmq4.8/conf/2m-2s-sync
Modify brocker-a.properties
#Specify the name of the entire broker cluster, or RocketMQ cluster brokerClusterName=rocket-MS #Specifies the name of the master slave cluster. A RocketMQ cluster can contain multiple master slave clusters brokerName=broker-a #0 means Master, > 0 means Slave brokerId=0 #nameServer address, semicolon split namesrvAddr=centos7_01:9876;centos7_02:9876 #The default is the number of queues created by creating a new Topic defaultTopicQueueNums=4 #Whether to allow the Broker to automatically create a Topic. It is recommended to close it in the production environment autoCreateTopicEnable=true #Whether to allow the Broker to automatically create subscription groups. It is recommended to turn it off in the production environment autoCreateSubscriptionGroup=true #The port on which the Broker provides external services, that is, the port on which the Broker communicates with the producer and the consumer listenPort=10911 #HA highly available listening port, that is, the communication port between Master and Slave. The default value is listenPort+1 haListenPort=10912 #Specifies that the time to delete the message store expired file is 4 a.m deleteWhen=04 #Specify that the retention time of the message storage file that has not been updated is 48 hours. It will expire after 48 hours and will be deleted fileReservedTime=48 #Specify the size of each file in the commitLog directory. The default is 1G mapedFileSizeCommitLog=1073741824 #Specify the number of messages that can be stored in each Queue file of each Topic of ConsumeQueue. The default is 30w messages mapedFileSizeConsumeQueue=300000 #When clearing an expired file, if the file is occupied by other threads (the number of references is greater than 0, such as reading messages), the deletion task will be blocked, #At the same time, the current timestamp is recorded when the first attempt to delete the file is made. This attribute indicates the maximum length of time that the file can be retained since the deletion is rejected for the first time. #If the number of references is still not 0 within this time, the deletion will still be rejected. However, when the time expires, the file will be forcibly deleted destroyMapedFileIntervalForcibly=120000 #Specify the maximum utilization rate of the disk partition where commitlog and consumequeue are located. If this value is exceeded, the expired files need to be cleared immediately diskMaxUsedSpaceRatio=88 #Specifies the path to the store directory, which is in the current user's home directory by default storePathRootDir=/opt/software/rocketmq/rocketmq4.8/storeAMaster #commitLog directory path storePathCommitLog=/opt/software/rocketmq/rocketmq4.8/storeAMaster/commitlog #Consumeuue directory path storePathConsumeQueue=/opt/software/rocketmq/rocketmq4.8/storeAMaster/consumequeue #index directory path storePathIndex=/opt/software/rocketmq/rocketmq4.8/storeAMaster/index #checkpoint file path storeCheckpoint=/opt/software/rocketmq/rocketmq4.8/storeAMaster/checkpoint #abort file path abortFile=/opt/software/rocketmq/rocketmq4.8/storeAMaster/abort #Specifies the maximum size of the message maxMessageSize=65536 #Broker Role of # - ASYNC_MASTER Asynchronous replication Master # - SYNC_MASTER Synchronous double write Master # - SLAVE brokerRole=SYNC_MASTER #Disk brushing strategy # - ASYNC_FLUSH Asynchronous brush disk # - SYNC_FLUSH synchronous brush disc flushDiskType=SYNC_FLUSH #Number of messaging thread pools sendMessageThreadPoolNums=128 #Number of pull message thread pools pullMessageThreadPoolNums=128 #The local IP is mandatory and needs to be modified according to each machine. The official introduction can be blank. The system automatically recognizes it by default, but the IP address may be read incorrectly when there are multiple network cards brokerIP1=192.168.70.150
Modify broker-b-s.properties
#Specify the name of the entire broker cluster, or RocketMQ cluster brokerClusterName=rocket-MS #Specifies the name of the master slave cluster. A RocketMQ cluster can contain multiple master slave clusters brokerName=broker-b #0 means Master, > 0 means Slave brokerId=1 #nameServer address, semicolon split namesrvAddr=centos7_01:9876;centos7_02:9876 #The default is the number of queues created by creating a new Topic defaultTopicQueueNums=4 #Whether to allow the Broker to automatically create a Topic. It is recommended to close it in the production environment autoCreateTopicEnable=true #Whether to allow the Broker to automatically create subscription groups. It is recommended to turn it off in the production environment autoCreateSubscriptionGroup=true #The port on which the Broker provides external services, that is, the port on which the Broker communicates with the producer and the consumer. Because broker-a and broker-b are deployed on the same machine, the port cannot be duplicated listenPort=11911 #HA highly available listening port, that is, the communication port between Master and Slave. The default value is listenPort+1 haListenPort=11912 #Specifies that the time to delete the message store expired file is 4 a.m deleteWhen=04 #Specify that the retention time of the message storage file that has not been updated is 48 hours. It will expire after 48 hours and will be deleted fileReservedTime=48 #Specify the size of each file in the commitLog directory. The default is 1G mapedFileSizeCommitLog=1073741824 #Specify the number of messages that can be stored in each Queue file of each Topic of ConsumeQueue. The default is 30w messages mapedFileSizeConsumeQueue=300000 #When clearing an expired file, if the file is occupied by other threads (the number of references is greater than 0, such as reading messages), the deletion task will be blocked, #At the same time, the current timestamp is recorded when the first attempt to delete the file is made. This attribute indicates the maximum length of time that the file can be retained since the deletion is rejected for the first time. #If the number of references is still not 0 within this time, the deletion will still be rejected. However, when the time expires, the file will be forcibly deleted destroyMapedFileIntervalForcibly=120000 #Specify the maximum utilization rate of the disk partition where commitlog and consumequeue are located. If this value is exceeded, the expired files need to be cleared immediately diskMaxUsedSpaceRatio=88 #Specifies the path to the store directory, which is in the current user's home directory by default storePathRootDir=/opt/software/rocketmq/rocketmq4.8/storeBSlave #commitLog directory path storePathCommitLog=/opt/software/rocketmq/rocketmq4.8/storeBSlave/commitlog #Consumeuue directory path storePathConsumeQueue=/opt/software/rocketmq/rocketmq4.8/storeBSlave/consumequeue #index directory path storePathIndex=/opt/software/rocketmq/rocketmq4.8/storeBSlave/index #checkpoint file path storeCheckpoint=/opt/software/rocketmq/rocketmq4.8/storeBSlave/checkpoint #abort file path abortFile=/opt/software/rocketmq/rocketmq4.8/storeBSlave/abort #Specifies the maximum size of the message maxMessageSize=65536 #Broker Role of # - ASYNC_MASTER Asynchronous replication Master # - SYNC_MASTER Synchronous double write Master # - SLAVE brokerRole=SYNC_MASTER #Disk brushing strategy # - ASYNC_FLUSH Asynchronous brush disk # - SYNC_FLUSH synchronous brush disc flushDiskType=SYNC_FLUSH #Number of messaging thread pools sendMessageThreadPoolNums=128 #Number of pull message thread pools pullMessageThreadPoolNums=128 #The local IP is mandatory and needs to be modified according to each machine. The official introduction can be blank. The system automatically recognizes it by default, but the IP address may be read incorrectly when there are multiple network cards brokerIP1=192.168.70.150
Modify the broker startup jvm memory parameters and enter the bin directory
vim runbroker.sh
Modify the nameServer startup jvm parameters
vim runserver.sh
Modify server 1 centos7_02
Create new file storage directories for broker-a and broker-b under the root directory of rocketmq
mkdir storeBMaster
mkdir storeASlave
Enter the 2m-2s-async directory / rocketmq/rocketmq4.8/conf/2m-2s-sync
Modify vim broker-b.properties
#Specify the name of the entire broker cluster, or RocketMQ cluster brokerClusterName=rocket-MS #Specifies the name of the master slave cluster. A RocketMQ cluster can contain multiple master slave clusters brokerName=broker-b #0 means Master, > 0 means Slave brokerId=0 #nameServer address, semicolon split namesrvAddr=centos7_01:9876;centos7_02:9876 #The default is the number of queues created by creating a new Topic defaultTopicQueueNums=4 #Whether to allow the Broker to automatically create a Topic. It is recommended to close it in the production environment autoCreateTopicEnable=true #Whether to allow the Broker to automatically create subscription groups. It is recommended to turn it off in the production environment autoCreateSubscriptionGroup=true #The port on which the Broker provides external services, that is, the port on which the Broker communicates with the producer and the consumer listenPort=10911 #HA highly available listening port, that is, the communication port between Master and Slave. The default value is listenPort+1 haListenPort=10912 #Specifies that the time to delete the message store expired file is 4 a.m deleteWhen=04 #Specify that the retention time of the message storage file that has not been updated is 48 hours. It will expire after 48 hours and will be deleted fileReservedTime=48 #Specify the size of each file in the commitLog directory. The default is 1G mapedFileSizeCommitLog=1073741824 #Specify the number of messages that can be stored in each Queue file of each Topic of ConsumeQueue. The default is 30w messages mapedFileSizeConsumeQueue=300000 #When clearing an expired file, if the file is occupied by other threads (the number of references is greater than 0, such as reading messages), the deletion task will be blocked, #At the same time, the current timestamp is recorded when the first attempt to delete the file is made. This attribute indicates the maximum length of time that the file can be retained since the deletion is rejected for the first time. #If the number of references is still not 0 within this time, the deletion will still be rejected. However, when the time expires, the file will be forcibly deleted destroyMapedFileIntervalForcibly=120000 #Specify the maximum utilization rate of the disk partition where commitlog and consumequeue are located. If this value is exceeded, the expired files need to be cleared immediately diskMaxUsedSpaceRatio=88 #Specifies the path to the store directory, which is in the current user's home directory by default storePathRootDir=/opt/software/rocketmq/rocketmq4.8/storeBMaster #commitLog directory path storePathCommitLog=/opt/software/rocketmq/rocketmq4.8/storeBMaster/commitlog #Consumeuue directory path storePathConsumeQueue=/opt/software/rocketmq/rocketmq4.8/storeBMaster/consumequeue #index directory path storePathIndex=/opt/software/rocketmq/rocketmq4.8/storeBMaster/index #checkpoint file path storeCheckpoint=/opt/software/rocketmq/rocketmq4.8/storeBMaster/checkpoint #abort file path abortFile=/opt/software/rocketmq/rocketmq4.8/storeBMaster/abort #Specifies the maximum size of the message maxMessageSize=65536 #Broker Role of # - ASYNC_MASTER Asynchronous replication Master # - SYNC_MASTER Synchronous double write Master # - SLAVE brokerRole=SYNC_MASTER #Disk brushing strategy # - ASYNC_FLUSH Asynchronous brush disk # - SYNC_FLUSH synchronous brush disc flushDiskType=SYNC_FLUSH #Number of messaging thread pools sendMessageThreadPoolNums=128 #Number of pull message thread pools pullMessageThreadPoolNums=128 #The local IP is mandatory and needs to be modified according to each machine. The official introduction can be blank. The system automatically recognizes it by default, but the IP address may be read incorrectly when there are multiple network cards brokerIP1=192.168.70.151
Modify vim broker-a-s.properties
#Specify the name of the entire broker cluster, or RocketMQ cluster
brokerClusterName=rocket-MS
#Specifies the name of the master slave cluster. A RocketMQ cluster can contain multiple master slave clusters
brokerName=broker-a
#0 means Master, > 0 means Slave
brokerId=1
#nameServer address, semicolon split
namesrvAddr=centos7_01:9876;centos7_02:9876
#The default is the number of queues created by creating a new Topic
defaultTopicQueueNums=4
#Whether to allow the Broker to automatically create a Topic. It is recommended to close it in the production environment
autoCreateTopicEnable=true
#Whether to allow the Broker to automatically create subscription groups. It is recommended to turn it off in the production environment
autoCreateSubscriptionGroup=true
#The port on which the Broker provides external services, that is, the port on which the Broker communicates with the producer and the consumer. Because broker-a and broker-b are deployed on the same machine, the port cannot be duplicated
listenPort=11911
#HA highly available listening port, that is, the communication port between Master and Slave. The default value is listenPort+1
haListenPort=11912
#Specifies that the time to delete the message store expired file is 4 a.m
deleteWhen=04
#Specify that the retention time of the message storage file that has not been updated is 48 hours. It will expire after 48 hours and will be deleted
fileReservedTime=48
#Specify the size of each file in the commitLog directory. The default is 1G
mapedFileSizeCommitLog=1073741824
#Specify the number of messages that can be stored in each Queue file of each Topic of ConsumeQueue. The default is 30w messages
mapedFileSizeConsumeQueue=300000
#When clearing an expired file, if the file is occupied by other threads (the number of references is greater than 0, such as reading messages), the deletion task will be blocked,
#At the same time, the current timestamp is recorded when the first attempt to delete the file is made. This attribute indicates the maximum length of time that the file can be retained since the deletion is rejected for the first time.
#If the number of references is still not 0 within this time, the deletion will still be rejected. However, when the time expires, the file will be forcibly deleted
destroyMapedFileIntervalForcibly=120000
#Specify the maximum utilization rate of the disk partition where commitlog and consumequeue are located. If this value is exceeded, the expired files need to be cleared immediately
diskMaxUsedSpaceRatio=88
#Specifies the path to the store directory, which is in the current user's home directory by default
storePathRootDir=/opt/software/rocketmq/rocketmq4.8/storeASlave
#commitLog directory path
storePathCommitLog=/opt/software/rocketmq/rocketmq4.8/storeASlave/commitlog
#Consumeuue directory path
storePathConsumeQueue=/opt/software/rocketmq/rocketmq4.8/storeASlave/consumequeue
#index directory path
storePathIndex=/opt/software/rocketmq/rocketmq4.8/storeASlave/index
#checkpoint file path
storeCheckpoint=/opt/software/rocketmq/rocketmq4.8/storeASlave/checkpoint
#abort file path
abortFile=/opt/software/rocketmq/rocketmq4.8/storeASlave/abort
#Specifies the maximum size of the message
maxMessageSize=65536
#Broker's role # - ASYNC_MASTER asynchronous replication Master # - SYNC_MASTER synchronous double write Master # - SLAVE
brokerRole=SYNC_MASTER
#Disk brushing strategy # - ASYNC_FLUSH asynchronous brush disc # - SYNC_FLUSH synchronous brush disc
flushDiskType=SYNC_FLUSH
#Number of messaging thread pools
sendMessageThreadPoolNums=128
#Number of pull message thread pools
pullMessageThreadPoolNums=128
#The local IP is mandatory and needs to be modified according to each machine. The official introduction can be blank. The system automatically recognizes it by default, but the IP address may be read incorrectly when there are multiple network cards
brokerIP1=192.168.70.151