Get the App
SLTechnology News&Howtos  ›  Servers  › 

Detailed explanation of installation and use of RocketMQ in Docker

Shulou Source: shulou.com Published: 2022-06-02 03:24:19 09月27日 Update

Search for RocketMQ images, you can search through docker's hub.docker.com, or you can search through docker's search command under Linux. However, after the recent firewall upgrade, foreign websites are slow to open, so it will be more convenient to search through the command. The operation of the Docker command must be a root user or a user with root authority. The query operation is as follows:

Docker search rocketmq

The following results can be obtained:

There are quite a lot of images, but it seems that none of them are officially released. I'll just choose one, such as foxiswho/rocketmq. Here is a command to view all the versions of the current image:

Curl https://registry.hub.docker.com/v1/repositories/foxiswho/rocketmq/tags\| tr-d'[\ [] "]'| tr'}'\ n'\ | awk-F:-v image='foxiswho/rocketmq''{if (NRNAV) NF & & $3! =") {printf ("% SV% s\ n", image,$3)}}'

If you want to view other images, simply replace the image name foxiswho/rocketmq with another image. Execute this command to get the following result:

The following is to start nameserver and broker step by step.

Start NameServer:

Docker run-d-p 9876 9876-- name rmqserver foxiswho/rocketmq:server-4.5.1

Start broker:

Docker run-d-p 10911 link rmqserver:namesrv 10909\-name rmqbroker-- link rmqserver:namesrv\-e "NAMESRV_ADDR=namesrv:9876"-e "JAVA_OPTS=-Duser.home=/opt"\-e "JAVA_OPT_EXT=-server-Xms128m-Xmx128m"\ foxiswho/rocketmq:broker-4.5.1

The path to the default configuration file in the Broker container is:

/ etc/rocketmq/broker.conf

You can also specify the native configuration file with the-v parameter:

Docker run-d-p 10911 NAMESRV_ADDR=namesrv:9876 10911-p 10909 NAMESRV_ADDR=namesrv:9876 10909\-name rmqbroker-- link rmqserver:namesrv\-e "NAMESRV_ADDR=namesrv:9876"-e "JAVA_OPTS=-Duser.home=/opt"\-e "JAVA_OPT_EXT=-server-Xms128m-Xmx128m"\-v / conf/broker.conf:/etc/rocketmq/broker.conf\ foxiswho/rocketmq:broker-4.5.1

If everything is all right, NameServer and Broker will be installed soon. For convenience in management, rocketmq console is also an essential tool. Find the version that needs to be started by querying above, as follows:

Docker run-d-name rmqconsole-p 8180 JAVA_OPTS=-Drocketmq.namesrv.addr=namesrv:9876 8080-- link rmqserver:namesrv\-e "JAVA_OPTS=-Drocketmq.namesrv.addr=namesrv:9876\-Dcom.rocketmq.sendMessageWithVIPChannel=false"\-t styletang/rocketmq-console-ng

Then check the startup with the following command:

Docker ps | grep rocketmq

The results are as follows:

The page that accesses localhost:8180,console through the browser is displayed as follows:

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Tags: Commands mirrors searches results can be passed that is files methods versions users queries configurations but content parameters names official containers tools essential Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Shulou Information Apple Redmi Shulou Technology