[Rocketmq] quickly build rocketmq environment through docker

rocket

1. Install Namesrv

Mirror Pull

docker pull rocketmqinc/rocketmq:4.4.0`

Start container

docker run -d -p 9876:9876 -v {RmHome}/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

Precautions

  {RmHome} to be replaced with the host you want to save log data MQ where, by using the volume function docker -v parameters of your local directory mapping to the directory within the container. Otherwise, all data is stored in memory by default runtime container, followed by a reboot back to the original starting point.

2. Install the broker server

Mirror Pull

And a mirror on the same step, if the step is completed, this step without pulling

Create a file broker.conf

  1. Broker.conf create files in the {RmHome} / conf directory
  2. In the following written broker.conf
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
brokerIP1 = {本地外网 IP}

brokerIP1 be modified to your own host's IP

Start container

docker run -d -p 10911:10911 -p 10909:10909 -v  {RmHome}/data/broker/logs:/root/logs -v  {RmHome}/rocketmq/data/broker/store:/root/store -v  {RmHome}/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

Note: {} RmHome above step as described later is no longer conjugated. broker.conf the file brokerIP1 your broker is registered to Namesrv in ip. If you do not he will take the default container internal network IP. Unless your applications are deployed in a network of interlinked container, the outer container can not connect a local broker or a service, which led to a variety of abnormalities similar RemotingTooMuchRequestException and so on.

3. Install rocketmq console

Mirror Pull

docker pull pangliang/rocketmq-console-ng

Start container

docker run -e "JAVA_OPTS=-Drocketmq.namesrv.addr={本地外网 IP}:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false" -p 8080:8080 -t pangliang/rocketmq-console-ng

other

Reference Documents

  1. Docker installation Rocketmq services mainly refer to the blogger's article, very well written, but encountered a few pit the actual installation, a version optimized on this basis. Plus a broker.conf configuration, and change the image source rocketmq-console-ng, the original little old, some features are not supported.
    2. rocketmq connection is not the problem-solving broker

I welcome the attention of the public number "KIWI Sui Suinian", the collection also my blog

Guess you like

Origin www.cnblogs.com/kiwifly/p/11546008.html