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

InnoDB engine redo file maintenance method

If you want to adjust the size and number of Inno...

Implementation code for installing vsftpd in Ubuntu 18.04

Install vsftpd $ sudo apt-get install vsftpd -y S...

MySQL index usage instructions (single-column index and multi-column index)

1. Single column index Choosing which columns to ...

How to build your own Angular component library with DevUI

Table of contents Preface Creating a component li...

Vue implements click feedback instructions for water ripple effect

Table of contents Water wave effect Let's see...

VUE+Canvas realizes the whole process of a simple Gobang game

Preface In terms of layout, Gobang is much simple...

Implementing a simple whack-a-mole game in JavaScript

This article shares the specific code for JavaScr...

Example of deploying MySQL on Docker

Table of contents 1 What is container cloud? 2 In...

How to choose between MySQL CHAR and VARCHAR

Table of contents VARCHAR and CHAR Types Conclusi...

HeidiSQL tool to export and import MySQL data

Sometimes, in order to facilitate the export and ...

The whole process of node.js using express to automatically build the project

1. Install the express library and generator Open...

Example of ellipsis when CSS multi-line text overflows

Ellipses appear when multi-line text overflows Th...

How to use watch listeners in Vue2 and Vue3

watch : listen for data changes (change events of...

Summary of using MySQL online DDL gh-ost

background: As a DBA, most of the DDL changes of ...