RocketMQ -- environment configuration

Posted by maniac1aw on Sat, 23 Nov 2019 22:08:11 +0100

 

Let's first go to / etc/hosts to add information

vim /etc/hosts

Add the following information:

Pass apache-rocketmq.tar.gz to / usr/local/software through XFTP tool

Then add / usr / local / Apache rocketmq directory, and extract Apache rocketmq.tar.gz to this directory

[root@bogon apache-rocketmq]#  mkdir /usr/local/apache-rocketmq && tar -zxvf apache-rocketmq.tar.gz -C /usr/local/apache-rocketmq

Create another soft connection

[root@bogon local]# ln -s apache-rocketmq rocketmq

Create storage path

[root@bogon local]# mkdir /usr/local/rocketmq/store
[root@bogon local]# mkdir /usr/local/rocketmq/store/commitlog
[root@bogon local]# mkdir /usr/local/rocketmq/store/consumequeue
[root@bogon local]# mkdir /usr/local/rocketmq/store/index

Change profile:

vim /usr/local/rocketmq/conf/2m-2s-async/broker-a.properties

Change to the following:

#Cluster name
brokerClusterName=rocketmq-cluster
#broker name. Note that different configuration files are filled in differently
brokerName=broker-a
#0 for Master, > 0 for Slave
brokerId=0
#nameServer address, semicolon split
namesrvAddr=rocketmq-nameserver1:9876
#When sending messages, topic s that do not exist in the server are automatically created. The number of queues created by default
defaultTopicQueueNums=4
#Whether Broker is allowed to automatically create Topic? It is recommended to open offline and close Online
autoCreateTopicEnable=true
#Whether Broker is allowed to automatically create subscription groups. It is recommended to enable offline and close Online
autoCreateSubscriptionGroup=true
#Broker listening port for external services
listenPort=10911
#Delete file at 4 a.m. by default
deleteWhen=04
#File retention time, default 48 hours
fileReservedTime=120
#commitLog the size of each file is 1G by default
mapedFileSizeCommitLog=1073741824
#Each file of ConsumeQueue saves 30W by default, which is adjusted according to the business situation
mapedFileSizeConsumeQueue=300000
#destroyMapedFileIntervalForcibly=120000
#redeleteHangedFileInterval=120000
#Detect 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 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 path
abortFile=/usr/local/rocketmq/store/abort
#Message size limit
maxMessageSize=65536
#flushCommitLogLeastPages=4
#flushConsumeQueueLeastPages=2
#flushCommitLogThoroughInterval=10000
#flushConsumeQueueThoroughInterval=60000
#Broker's role
#-Async? Master asynchronous replication master
#-Sync? Master
#- SLAVE
brokerRole=ASYNC_MASTER
#Brush disk mode
#-Async? Flush asynchronous disc brush
#-Sync? Flush
flushDiskType=ASYNC_FLUSH
#checkTransactionMessageEnable=false
#Number of message thread pools
#sendMessageThreadPoolNums=128
#Number of pull message thread pools
#pullMessageThreadPoolNums=128

After modifying the log configuration, we go to the usr/local directory

[root@rocketmq-nameserver1 local]# mkdir -p /usr/local/rocketmq/logs
[root@rocketmq-nameserver1 local]# cd /usr/local/rocketmq/conf && sed -i 's#${user.home}#/usr/local/rocketmq#g' *.xml

Then modify the parameters of the startup script

[root@rocketmq-nameserver1 bin]# vim /usr/local/rocketmq/bin/runbroker.sh
[root@rocketmq-nameserver1 bin]# vim /usr/local/rocketmq/bin/runserver.sh

Change the memory configuration in both files to 1G

We can start rocketmq now. The starting sequence is to start NameServer first and then broker server

First, enter the directory / usr/local/rocketmq/bin and enter the following command

[root@rocketmq-nameserver1 bin]# nohup sh mqnamesrv &

When we input jsp, if namesrvstartup appears, the NameServer starts successfully

Then start the broker server by entering the following command

[root@rocketmq-nameserver1 bin]# nohup sh mqbroker -c /usr/local/rocketmq/conf/2m-2s-async/broker-a.properties >/dev/null 2>&1 &

Enter jps again, and you can see that the broker server is started

Topics: Apache vim xml JSP