Docker installation rocketMQ tutorial (most detailed)

Docker installation rocketMQ tutorial (most detailed)

RocketMQ is a distributed, queue-based messaging middleware designed by Alibaba with the following features:

  • Supports strict message ordering
  • Supports Topic and Queue modes
  • Billions of messages can be accumulated
  • Friendly distributed features
  • Supports both Push and Pull modes for consuming messages
  • After many tests of Tmall Double 11 massive messages
  • RocketMQ is written in pure Java and is based on the communication framework Netty.

In fact, the editor feels that RocketMQ should be chosen because it has withstood the test of Tmall Double Eleven's massive message volume many times. In addition, it has the ability to accumulate billions of messages. Such a powerful component is a new dark horse! Next, I will show you how to install rocketMQ using docker on centos7.

1. Install Namesrv

Pull the image

docker pull rocketmqinc/rocketmq:4.4.0 

Create a new folder mq in the /usr/local directory

Command: mkdir mq

Start the container

docker run -d -p 9876:9876 -v {your own path}/data/namesrv/logs:/root/logs -v {RmHome}/data/namesrv/store:/root/store --name rmqnamesrv -e "MAX_POSSIBLE_HEAP=100000000" rocketmqinc/rocketmq:4.4.0 sh mqnamesrv

As shown below, my own path is /usr/local/mq

You can customize the path yourself. Just replace the path

Precautions

{your own path} should be replaced with the location where you want to save MQ logs and data on your host machine. Use the volume function through the -v parameter of Docker to map your local directory to the directory in the container. Otherwise, all data is saved in the memory of the container runtime by default, and returns to the original starting point after restart.

2. Install broker

Create broker.conf file

1: Create the broker.conf file in the {own path}/conf directory

Enter the previous /usr/local/mq directory and enter the command mkdir conf to create a new conf directory

Then enter the command touch broker.conf in the conf directory to create a new file

Enter the command vi broker.conf and click the insert key on the keyboard to start inserting.

Write the following in broker.conf

brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
brokerIP1 = {local public IP} 

(My server is Alibaba Cloud, the arrow indicates the public IP address)

After entering, press the Esc key, press shift, and then press v

Type wq! to exit

Start the container

docker run -d -p 10911:10911 -p 10909:10909 -v {your own path}/data/broker/logs:/root/logs -v {your own path}/rocketmq/data/broker/store:/root/store -v {your own path}/conf/broker.conf:/opt/rocketmq-4.4.0/conf/broker.conf --name rmqbroker --link rmqnamesrv:namesrv -e "NAMESRV_ADDR=namesrv:9876" -e "MAX_POSSIBLE_HEAP=200000000" rocketmqinc/rocketmq:4.4.0 sh mqbroker -c /opt/rocketmq-4.4.0/conf/broker.conf 

Precautions

Notice: { Your own path } is the same as the previous step and will not be repeated here. The brokerIP1 in the broker.conf file is the ip of your broker registered in Namesrv. If not specified, it will take the internal IP address of the container by default. Unless your application is also deployed in a container that is connected to the network, you will not be able to connect to the broker service locally or outside the container, which will lead to various exceptions such as RemotingTooMuchRequestException.

3. Install RocketMQ console

Pull the image

docker pull styletang/rocketmq-console-ng 

View mirror docker ps

Start the RocketMQ console

docker run -e "JAVA_OPTS=-Drocketmq.namesrv.addr=server public network ip:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false" -p 8080:8080 -t styletang/rocketmq-console-ng 

View the running status

The status is up , indicating successful operation.

docker ps -a 

Browser access

Remember to open ports in the firewall

You may also be interested in:
  • Implementation steps for installing RocketMQ in docker
  • A very detailed tutorial on installing rocketmq under Docker Desktop
  • Detailed installation and use of RocketMQ in Docker
  • Docker installation of RocketMQ and solutions to problems encountered during installation

<<:  A brief discussion on VUE uni-app template syntax

>>:  XHTML Getting Started Tutorial: Commonly Used XHTML Tags

Recommend

Learn more about using regular expressions in JavaScript

Table of contents 1. What is a regular expression...

Summary of MySQL lock related knowledge

Locks in MySQL Locks are a means to resolve resou...

The difference between char, varchar and text field types in MySQL

In MySQL, fields of char, varchar, and text types...

Web lesson plans, lesson plans for beginners

Teaching Topics Web page Applicable grade Second ...

CSS uses BEM naming convention practice

When you see a class, what information do you wan...

Pure CSS to implement iOS style open and close selection box function

1 Effect Demo address: https://www.albertyy.com/2...

Sample code using vue-router in html

Introducing vue and vue-router <script src=&qu...

Use of Linux stat command

1. Command Introduction The stat command is used ...

React-Native environment setup and basic introduction

Environment Preparation 1. Environment Constructi...

Vue parent-child component mutual value transfer and call

Table of contents 1. Parent passes value to child...

How to use yum to configure lnmp environment in CentOS7.6 system

1. Installation version details Server: MariaDB S...

React implements import and export of Excel files

Table of contents Presentation Layer Business Lay...