The installation conditions

The 64-bit operating system is Linux, Unix, or Mac

A 64 – bit JDK 1.8 +

Maven 3.2.x

Download and Build

From www.apache.org/dyn/closer…. Download the source version and run the following command to extract the source and build the binaries.

> unzip Rocketmq-all-4.9.2-source-release. zip > CD Rocketmq-all-4.9.2 / > mvn-prelease - all-dskiptests clean install -u > CD distribution/target/rocketmq - 4.9.2 / rocketmq - 4.9.2Copy the code

1. Start the mqnamesrv

Start the command
nohup sh bin/mqnamesrv &
Copy the code

Or add output logs

nohup sh bin/mqnamesrv  >  ~/logs/rocketmq/logs/namesrv.log &
Copy the code
Stop command
nohup sh bin/mqshutdown namesrv
Copy the code

2. Start the broker

Modify the broker.conf file

Add a new line and fill in the IP address of the RocketMQ machine installed

brokerIP1=XX.XXX.XXX.XXX
Copy the code

Note that the FOLLOWING IP address and port please fill in the IP address and port of your RocketMQ machine.

nohup sh bin/mqbroker -c conf/broker.conf  -n xxx.xx.xx.xx:9876 autoCreateTopicEnable=true  >  ~/logs/rocketmqlogs/broker.log &
Copy the code

AutoCreateTopicEnable =true allows automatic creation of topics

Stop command

nohup sh bin/mqshutdown broker
Copy the code

3. Send the MESSAGE

export NAMESRV_ADDR=localhost:9876
​
sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer
Copy the code

4. Receive the news

sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer
Copy the code