The document

Single: rocketmq – 1. Gitbook. IO/rocketmq – co…

Cluster: rocketmq – 1. Gitbook. IO/rocketmq – co…

I. Single machine installation

  1. download

Wget HTTP: / / https://github.com/apache/rocketmq/archive/rocketmq-all-4.8.0.tar.gz

  1. Unpack the

The tar - ZXVF rocketmq - all - 4.8.0. Tar. Gz

  1. compile
CD Rocketmq -all-4.8.0 MVN -Prelease- all-dskiptests clean install -uCopy the code

If the following result is displayed, the build is successful

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

Copy the code
  1. Configuring environment Variables
CD distribution/target/rocketmq - 4.8.0 / rocketmq - 4.8.0 PWD # configuration environment, the current login user to take effect, is permanent; To configure for all users, Edit/etc/profile vim ~ /. Following the export rocketmq = XXXX/rocketmq/distribution/target/apache - rocketmq export PATH=$PATH:$rocketmq/binCopy the code

Save the Settings source ~/.bash_profile

  1. Start the rocketMq
Broker nohup sh bin/mqbroker -n localhost:9876 &Copy the code
  1. stop
sh bin/mqshutdown broker
sh bin/mqshutdown namesrv
Copy the code

The startup script

#! / bin/sh dir = / MNT/soft/rocketmq rocketmq/distribution/target/rocketmq - 4.8.0 / rocketmq - 4.8.0 / bin start () {$CD dir echo "starting rocketmq namesrv.." nohup sh mqnamesrv >> namesrv.log 2>&1 & echo "namesrv started, and then starting mqbroker.." sleep 3 nohup sh mqbroker -n localhost:9876 >> mqbroker.log 2>&1 & echo "start mqbroker sucess" } stop() { cd $dir echo "stopping rocketmq namesrv.." sh mqshutdown namesrv echo "namesrv stoped, and the stopping mqbroker.." sleep 3 sh mqshutdown broker echo "mqbroker stoped" } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo $"Usage:$0 {start|stop|restart}" exit 1 ;; esac exit 0Copy the code
  1. Memory optimization

If appear

Java HotSpot(TM) 64-Bit Server VM warning: Using the DefNew young collector with the CMS collector is deprecated and will likely be removed in a future release Java HotSpot(TM) 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release. Java HotSpot(TM) 64-Bit Server VM warning: MaxNewSize (131072k) is equal to or greater than the entire heap (131072k). A new max generation size of 131008k will be  used.Copy the code

Modify the memory usage appropriately

Vim runserver.sh vim runbroker.sh Modifies the corresponding memory Settings to be smallerCopy the code
  1. The remote access
CD/MNT/soft/rocketmq/rocketmq/distribution/conf vim broker. The conf # modified configuration file, BrokerClusterName = DefaultCluster brokerName = broker-A brokerId = 0 deleteWhen = 04 fileReservedTime = 48 Add the last two brokerClusterName = DefaultCluster brokerName = Broker-A brokerId = 0 deleteWhen = 04 fileReservedTime = 48 BrokerRole = ASYNC_MASTER flushDiskType = ASYNC_FLUSH namesrvAddr= Public IP :9876 brokerIPi= public IPCopy the code

2. Visual management

  1. The document

Rocketmq – 1. Gitbook. IO/rocketmq – co…

  1. The installation
# do not use the docker git clone https://github.com/apache/rocketmq-externals.git # other extensions don't need, just leave rocketmq - the console alone, Mv XXX/RocketMq-externals/RocketMq-console XXX/RocketMQ/RocketMq-console rm -r XXX/Rocketmq-externals CD is deleted Xx/Rocketmq-console # Package MVN clean package -dmaven.test.skip =trueCopy the code

Modify the configuration (remember to recompile after modifying it)

Rockermq CD SRC /main/resources/ vim application.properties rocketmq.config.dataPath=xxxx/rocketmq/rocketmq_console_dataCopy the code

User. properties is stored in the directory above, which contains the user information


# This file supports hot change, any change will be auto-reloaded without Console restarting.
# Format: a user per line, username=password[,N] #N is optional, 0 (Normal User); 1 (Admin)

# Define Admin
admin=admin,1

# Define Users
user1=user1
user2=user2
Copy the code
# start java-jar target/rocketmq-console-ng-1.0.1.jarCopy the code

The startup script

#! /bin/sh dir=/mnt/soft/rocketmq/rocketmq-console/target start() { cd $dir echo "starting rocketmq console.." Nohup XXX /jdk1.8.0_211/bin/ Java -jar rocketmq-console-ng-2.0.0.jar >> Rocketmq-console. log 2>&1 & echo "start rocketmq The console sucess} "stop () {pid = ` ps x | grep 'rocketmq - the console - ng - 2.0.0 | grep -v grep | awk' {print $1} '` echo $pid kill -9 $pid sleep 1 echo "rocketmq-console stoped" } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo $"Usage:$0 {start|stop|restart}" exit 1 ;; esac exit 0Copy the code

3. The cluster