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

MySQL 8.0.11 Community Green Edition Installation Steps Diagram for Windows

In this tutorial, we use the latest MySQL communi...

JavaScript determines whether the browser is IE

As a front-end developer, I can’t avoid IE’s pitf...

The presentation and opening method of hyperlink a

<br />Related articles: How to prompt and op...

Essential bonus items for optimizing and packaging the front end of Vue projects

Table of contents Preface 1. Routing lazy loading...

Vue implements setting multiple countdowns at the same time

This article example shares the specific code of ...

This article will help you understand the life cycle in Vue

Table of contents 1. beforeCreate & created 2...

Detailed tutorial on installing mysql8.0.22 on Alibaba Cloud centos7

1. Download the MySQL installation package First ...

How to solve the problem that Docker container has no vim command

Find the problem Today, when I tried to modify th...

How to set up virtual directories and configure virtual paths in Tomcat 7.0

Tomcat7.0 sets virtual directory (1) Currently, o...

Detailed explanation of the basic use of react-navigation6.x routing library

Table of contents react-native project initializa...

JavaScript canvas realizes dynamic point and line effect

This article shares the specific code for JavaScr...

A brief introduction to VUE uni-app basic components

1. scroll-view When using vertical scrolling, you...

How to build a multi-node Elastic stack cluster on RHEL8 /CentOS8

Elastic stack, commonly known as ELK stack, is a ...

MySql implements page query function

First of all, we need to make it clear why we use...

How to increase HTML page loading speed

(1) Reduce HTTP requests. (Merge resource files a...