RocketMQ4.X basic introduction and Alibaba Cloud Linux server rapid deployment

Alibaba open source RocketMQ4.x message queue introduction

  • Apache RocketMQ is a high-performance, high-throughput distributed messaging middleware open sourced by Ali

  • Features

    • Support Broker and Consumer end message filtering

    • Support publish-subscribe model, and point-to-point,

    • Support two message modes: pull and push

    • Single queue millions of messages, billions of messages accumulation

    • Support single master node, multiple master nodes, multiple master and multiple slave nodes

    • Any point is highly available, horizontal expansion, Producer, Consumer, and queue can all be distributed

    • Message failure retry mechanism, support timing messages of specific level

    • The bottom layer of the new version uses Netty

    • 4.3.x supports distributed transactions

    • Suitable for financial services, high-availability tracking and auditing functions.

       

  • concept

    • Producer: message producer

    • Producer Group: message producer group, a message production group that sends similar messages

    • Consumer: Consumer

    • Consumer Group: Consume multiple instances of similar messages

    • Tag: Tag, subtopic (secondary classification) further refines the topic, used to distinguish the messages of different businesses under the same topic

    • Topic: Topic, such as order type message, queue is the physical management unit of the message, and topic is the logical management unit. There can be multiple queues under a topic,

      The default automatic creation is 4, manual creation is 8

    • Message: message, each message must specify a topic

    • Broker: MQ program, which receives produced messages and provides programs for consumers to consume

    • Name Server: Provide routing information for production and consumers, and provide lightweight service discovery, routing, and metadata information, which can be deployed in multiple and independent of each other (lighter than zookeeper)

    • Offset: Offset, can be understood as message progress

    • commit log: The message storage will be written in the Commit log file

    • Read the official website address and learn how to learn new technologies  http://rocketmq.apache.org/

    • Learning Resources

 

Alibaba Cloud server source code deployment RocketMQ4.X

Jdk and maven environment are required before installation! , The official installation and deployment documentation: http://rocketmq.apache.org/docs/quick-start/

Here we upload the rocketMQ source code package for installation

  > unzip rocketmq-all-4.4.0-source-release.zip
  > cd rocketmq-all-4.4.0/
  > mvn -Prelease-all -DskipTests clean install -U
  > cd distribution/target/apache-rocketmq

The download process is a bit long, see the picture below represents ok!

Next Start Name Server

  > nohup sh bin/mqnamesrv &
  > tail -f ~/logs/rocketmqlogs/namesrv.log
  The Name Server boot success...

Here if the server memory is insufficient, an error will be reported

Here we only need to adjust the appropriate jvm parameters

vim bin/runserver.sh 

JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn256m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"

Start in daemon mode

You can see that the name server has been started, then start the broker

vim bin/runbroker.sh

JAVA_OPT="${JAVA_OPT} -server -Xms528m -Xmx528m -Xmn256m"

Next is an example of official test production and consumption news

 > export NAMESRV_ADDR=localhost:9876
 > sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer
 SendResult [sendStatus=SEND_OK, msgId= ...

 > sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer
 ConsumeMessageThread_%d Receive New Messages: [MessageExt...

You can see examples according to the commands, so I won’t repeat them here.

 Alibaba Cloud source code installation RocketMQ4.X console

  • Upload the source code package-"Unzip-"Enter the rocketmq-console directory -" Compile and package mvn clean package -Dmaven.test.skip=true

    Be sure to modify the following two before compiling and packaging, otherwise an error will be reported

    • Modify pom.xml version number (official bug)
    • Modify the nameserver address in application.xml to 127.0.0.1:9876
    • Compilation is successful!
  • Enter the target directory,

  • Start nohup java -jar rocketmq-console-ng-1.0.0.jar &

  • carry out!

Guess you like

Origin blog.csdn.net/qq_41023026/article/details/89740500
Recommended