Basic environment
Operating System: CentOS7
Example: 192.168.63.129,192.168.63.130,192.168.63.131,192.168.63.132
Java:jdk-8u191-linux-x64.tar.gz
Install the JDK
System which comes first uninstall
[root@localhost soft]# rpm -qa|grep java python-javapackages-3.4.1-11.el7.noarch java-1.8.0-openjdk-1.8.0.181-7.b13.el7.x86_64 java-1.8.0-openjdk-headless-1.8.0.181-7.b13.el7.x86_64 tzdata-java-2018e-3.el7.noarch javapackages-tools-3.4.1-11.el7.noarch [root@localhost soft]# rpm -e java-1.8.0-openjdk-1.8.0.181-7.b13.el7.x86_64 --nodeps [root@localhost soft]# rpm -e java-1.8.0-openjdk-headless-1.8.0.181-7.b13.el7.x86_64 --nodeps [root@localhost soft]#
You go to the directory where the JDK installation package, and then install the JDK
# Create a directory [root@localhost soft]# mkdir /usr/local/java # Unzip to this directory [root@localhost soft]# tar -xvf jdk-8u191-linux-x64.tar.gz -C /usr/local/java/
Enter the directory after decompression can be seen
The following configuration environment variable
[root@localhost java]# vim /etc/profile
Add the following
# java export JAVA_HOME=/usr/local/java/jdk1.8.0_191 export JRE_HOME=/usr/local/java/jdk1.8.0_191/jre export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
As follows
Refresh and verify
[root@localhost java]# source /etc/profile [root@localhost java]# java -version java version "1.8.0_191" Java(TM) SE Runtime Environment (build 1.8.0_191-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode) [root@localhost java]#
Installation RocketMQ
First uploaded to the server, I upload / soft folder. Then extract
# Unzip [root@localhost soft]# unzip rocketmq-all-4.5.1-bin-release.zip -d /usr/local/ # Unzip into the directory [root@localhost soft]# cd /usr/local/ [root@localhost local]# ll total 0 drwxr-xr-x. 2 root root 6 Apr 11 2018 bin drwxr-xr-x. 2 root root 6 Apr 11 2018 etc drwxr-xr-x. 2 root root 6 Apr 11 2018 games drwxr-xr-x. 2 root root 6 Apr 11 2018 include drwxr-xr-x. 3 root root 26 May 26 18:39 java drwxr-xr-x. 2 root root 6 Apr 11 2018 lib drwxr-xr-x. 2 root root 6 Apr 11 2018 lib64 drwxr-xr-x. 2 root root 6 Apr 11 2018 libexec drwx------. 6 root root 103 Mar 29 17:37 rocketmq-all-4.5.0-bin-release drwxr-xr-x. 2 root root 6 Apr 11 2018 sbin drwxr-xr-x. 5 root root 49 May 10 07:44 share drwxr -XR-X. 2 the root the root . 6 On Apr . 11 2018 the src
# change of name [root@localhost local]# mv rocketmq-all-4.5.1-bin-release/ rocketmq [root@localhost local]# ll total 0 drwxr-xr-x. 2 root root 6 Apr 11 2018 bin drwxr-xr-x. 2 root root 6 Apr 11 2018 etc drwxr-xr-x. 2 root root 6 Apr 11 2018 games drwxr-xr-x. 2 root root 6 Apr 11 2018 include drwxr-xr-x. 3 root root 26 May 26 18:39 java drwxr-xr-x. 2 root root 6 Apr 11 2018 lib drwxr-xr-x. 2 root root 6 Apr 11 2018 lib64 drwxr-xr-x. 2 root root 6 Apr 11 2018 libexec drwx------. 6 root root 103 Mar 29 17:37 rocketmq drwxr-xr-x. 2 root root 6 Apr 11 2018 sbin drwxr-xr-x. 5 root root 49 May 10 07:44 share drwxr-xr-x. 2 root root 6 Apr 11 2018 src
Enter profile directory, modify the configuration file ( four machines modified configuration file is not the same, note the name)
[root@localhost local]# cd rocketmq/conf/2m-2s-async/
# 129 node [@ localhost the root 2M -2S-the async] # Vim broker- a.properties # 130 node [@ localhost the root 2M -2S-the async] # Vim Broker-A- s.properties # 131 node [@ localhost the root 2M -2S-the async] # Vim broker- b.properties # 132 node [@ localhost the root 2M -2S-the async] # Vim broker-bs.properties
Adding the following ( four machines to join the same content, but modified files are not the same)
listenPort=10911 namesrvAddr=192.168.63.129:9876;192.168.63.130:9876;192.168.63.131:9876;192.168.63.132:9876 mapedFileSizeCommitLog=1073741824 storePathRootDir=/usr/local/rocketmq/store storePathCommitLog=/usr/local/rocketmq/store/commitlog storePathConsumerQueue=/usr/local/rocketmq/store/consumequeue storePathIndex=/usr/local/rocketmq/store/index
Figure:
Then the new store relevant directory (the same four machines)
[root@localhost 2m-2s-async]# mkdir /usr/local/rocketmq/store [root@localhost 2m-2s-async]# mkdir /usr/local/rocketmq/store/commitlog [root@localhost 2m-2s-async]# mkdir /usr/local/rocketmq/store/consumequeue [root@localhost 2m-2s-async]# mkdir /usr/local/rocketmq/store/index
Open firewall ports
[root@localhost 2m-2s-async]# firewall-cmd --zone=public --add-port=10911/tcp --permanent success [root@localhost 2m-2s-async]# firewall-cmd --zone=public --add-port=9876/tcp --permanent success [root@localhost 2m-2s-async]# systemctl restart firewalld
Go to the bin directory, ready to start nameserver, started successfully.
[root@localhost 2m-2s-async]# cd /usr/local/rocketmq/bin/ [root@localhost bin]# ./mqnamesrv & [1] 59673 [root@localhost bin]# 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. The Name Server boot success. serializeType=JSON [root@localhost bin]#
The following start broker
[root@localhost bin]# ./mqbroker -c /usr/local/rocketmq/conf/2m-2s-async/broker-a.properties & [2] 59731 [root@localhost bin]# Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000005c0000000, 8589934592, 0) failed; error='Cannot allocate memory' (errno=12) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 8589934592 bytes for committing reserved memory. # An error report file with more information is saved as: # /usr/local/rocketmq/bin/hs_err_pid59738.log [2]+ Exit 1 ./mqbroker
It is given, out of memory. After the test set up, only 1G memory. Modify runbroker.sh
[root@localhost bin]# vim runbroker.sh
Modify here
Instead -Xms256m -Xmx256m -Xmn128m
Save shut down and restart.
# 129 [root@localhost bin]# ./mqbroker -c /usr/local/rocketmq/conf/2m-2s-async/broker-a.properties & [3] 61454 [2] Exit 143 ./mqbroker [root@localhost bin]# The broker[broker-a, 192.168.63.129:10911] boot success. serializeType=JSON and name server is 192.168.63.129:9876;192.168.63.130:9876;192.168.63.131:9876;192.168.63.132:9876 # 130 [root@localhost bin]# ./mqbroker -c /usr/local/rocketmq/conf/2m-2s-async/broker-a-s.properties & [3] 60359 [2] Exit 143 ./mqbroker [root@localhost bin]# The broker[broker-a, 192.168.63.130:10911] boot success. serializeType=JSON and name server is 192.168.63.129:9876;192.168.63.130:9876;192.168.63.131:9876;192.168.63.132:9876 # 131 [root@localhost bin]# ./mqbroker -c /usr/local/rocketmq/conf/2m-2s-async/broker-b.properties & [3] 60224 [2] Exit 143 ./mqbroker [root@localhost bin]# The broker[broker-b, 192.168.63.131:10911] boot success. serializeType=JSON and name server is 192.168.63.129:9876;192.168.63.130:9876;192.168.63.131:9876;192.168.63.132:9876 # 132 [root@localhost bin]# ./mqbroker -c /usr/local/rocketmq/conf/2m-2s-async/broker-b-s.properties & [3] 60310 [2] Exit 143 ./mqbroker [root@localhost bin]# The broker[broker-b, 192.168.63.132:10911] boot success. serializeType=JSON and name server is 192.168.63.129:9876;192.168.63.130:9876;192.168.63.131:9876;192.168.63.132:9876
After all started successfully, install a control station.
Control station
It should be four servers open port 10909.
[root@localhost bin]# firewall-cmd --zone=public --add-port=10909/tcp --permanent success [root@localhost bin]# systemctl restart firewalld
=====
https://github.com/apache/rocketmq-externals
Once you have downloaded into rocketmq-console directory package command execution
mvn clean package -Dmaven.test.skip=true
Into the target directory, execute the command to start.
java -jar rocketmq-console-ng-1.0.1.jar --rocketmq.config.namesrvAddr='192.168.63.129:9876;192.168.63.130:9876;192.168.63.131:9876;192.168.63.132:9876'
Visit http: // localhost: 8080 / # / cluster
Close NameServer and Broker
[root@localhost bin]# ./mqshutdown namesrv The mqnamesrv(59705) is running... Send shutdown request to mqnamesrv(59705) OK [root@localhost bin]# ./mqshutdown broker The mqbroker(60366) is running... Send shutdown request to mqbroker(60366) OK [1]- Exit 143 ./mqnamesrv