Install RocketMQ and related environment configuration under Linux

Preface

Apache Alibaba RocketMQ is a messaging middleware. There are two roles in message middleware: message producer and message consumer. RocketMQ also has these two concepts. The message producer is responsible for creating a message and sending it to the RocketMQ server. The RocketMQ server persists the message to disk, and the message consumer pulls the message from the RocketMQ server and submits it to the application for consumption.

 

Official website   http://rocketmq.apache.org/

 

premise

Install Maven

 

installation steps

1. Download the source code

  More versions  https://github.com/apache/rocketmq/releases

  Method 1 Link:  https://pan.baidu.com/s/1vlOaf2PZxQbLU1Dw2zkm6Q  Password: v7bh Download to the /opt directory

  Way two 

cd /opt
wget https://github.com/apache/rocketmq/archive/rocketmq-all-4.3.0.tar.gz

 2. Unzip the source code

tar -zxvf rocketmq-all-4.3.0.tar.gz

3. Rename

mv rocketmq-rocketmq-all-4.3.0/ rocketmq

4. Compile the source code

cd rocketmq
mvn -Prelease-all -DskipTests clean install -U

5. Configure environment variables

vi /etc/profile

  Press i in English input state to enter insert mode, add the following configuration  

export rocketmq=/opt/rocketmq/distribution/target/apache-rocketmq
export PATH=$PATH:$rocketmq/bin

  Press esc to enter  : wq to  save and exit, compile /etc/profile to make the configuration effective

source /etc/profile

6. Create a log directory

mkdir logs

7. Create a broker configuration file to solve the problem of inaccessibility of the project integration external network  

cd distribution/target/apache-rocketmq/bin/
echo "brokerIP1=81.68.243.35" > broker.properties

  Change to your own external network IP

8. Start the  nameserver and broker

  Open firewall rule 9876 port

 

nohup sh mqnamesrv >/opt/rocketmq/logs/mqnamesrv.log 2>&1 &
nohup sh mqbroker -n localhost:9876 -c /opt/rocketmq/distribution/target/apache-rocketmq/bin/broker.properties >/opt/rocketmq/logs/broker.log 2>&1 &

9. Check the startup status

cd /opt/rocketmq/logs
cat mqnamesrv.log
cat broker.log

  The log content prompts success, which means the startup is successful

10. Extension-Stop

sh mqshutdown namesrv
sh mqshutdown broker

 

web visualization

 1. Download the source code

   GitHub: https://github.com/apache/rocketmq-externals/tags

   Link: https://pan.baidu.com/s/121vAZejrGsZ7abGDJjHAkw  Password: rbhi Place directory opt/

2. Unzip the source code

tar -zxvf rocketmq-console-1.0.0.tar.gz

3. Rename

mv rocketmq-externals-rocketmq-console-1.0.0 rocketmq-console

4. Modify the port and rocketmq connection

cd rocketmq-console/rocketmq-console/src/main/resources/
vi application.properties

  In English input state, press i to enter insert mode. Add and modify the following configuration  

server.port=8282
rocketmq.config.namesrvAddr=localhost:9876

  Press esc to enter  : wq  save and exit

5. Compile

cd /opt/rocketmq-console/rocketmq-console/
mvn clean package -Dmaven.test.skip=true

6. Start

cd target/
java -jar rocketmq-console-ng-1.0.0.jar &

7. Access

Open firewall rule port 8282

 

Question Collection

1.  commit_memory(0x00000006c0000000, 2147483648, 0) failed; error='Cannot allocate memory' 

Modify the memory of runbroker.sh and runserver.sh

JAVA_OPT="${JAVA_OPT} -server -Xms128m -Xmx256m -Xmn128m"

 

Guess you like

Origin blog.csdn.net/javanbme/article/details/112364315