Quickly install RocketMQ under linux and run it (you can see it at a glance)

1. Download first

Official website address: https://rocketmq.apache.org/docs/quickStart/02quickstart/

 

2. Unzip and rename

Put the corresponding installation package under the folder and unzip and modify the name

 Unzip: sudo unzip packagename.zip

3. Modify the configuration file

cd to the bin directory, modify the size of the two files runserver.sh and runbroker.sh

Command: vim runserver.sh

 :wq quit editing and save

Command vim runbroker.sh

  :wq quit editing and save

4. Configure environment variables

vim /etc/profile 

Add to the directory before the corresponding bin, not to the bin directory

 :wq After exiting, enter source /etc/profile to save the modified environment variables

5. Modify the broker.conf file

1.cd to the conf folder, open broker.conf 

Add to

namesrvAddr=your ip address: 9876

brokerIP1=your ip address

 

 

2. Linux opens ports 9876 and 10911

Here I am using the pagoda to set up an open port, which is more convenient, and you can also use the command

Open ports:

firewall-cmd --zone=public --add-port=9876/tcp --permanent

firewall-cmd --zone=public --add-port=10911/tcp --permanent

Refresh the firewall: firewall-cmd --reload

6. Start NameServer and Bbroker (I am in the directory above the bin directory at this time)

NameServer command: nohup sh ./bin/mqnamesrv -n ip address: 9876 &

 

Appears this to indicate that the startup is successful

 

Broker command nohup sh bin/mqbroker -n ip address: 9876 -c conf/broker.conf autoCreateTopicEnable=true &

Appears this to indicate that the startup is successful

 

Use the jps command to view the startup status of broker and nameserver

There are these two instructions that the MQ startup is complete

 Seven.java docking MQ test

The address to connect to MQ in the configuration file

 

test:

producer

 

consumer

 

Eight. MQ visual interface use

Get the visualized interface path: rmq-console: rmq console

Download and unzip to find application.properties 

 Fill in the access port number, and write the ip address and port number of the namersev

 

Jump to the directory cmd where the corresponding pom is located and enter

 

Input: mvn clean package -Dmaven.test.skip=true to package as a jar package

The completed jar is obtained in the generated target file, and the cmd command is executed in the current directory

Enter java -jar jar package name to run

Enter the port number to view the visual interface for

 

 

Note: The premise is that you have a JDK in your system, otherwise it will start to report an error. Check the JDK command java -version

If you have any questions, you can send a private message to help

Guess you like

Origin blog.csdn.net/m0_67601895/article/details/128203872