Docker版本 RocketMQ Install v4.9.5

发布时间 2023-04-14 16:14:11作者: walkersss

cd tools
yum install git
git clone https://github.com/apache/rocketmq-docker.git
cd rocketmq-docker/
sh build-image.sh RMQ-VERSION BASE-IMAGE
cd image-build
sh build-image.sh 4.9.5 centos
docker images
docker pull apacherocketmq/rocketmq-console:2.0.0
mkdir -p /usr/local/rocketmq
mkdir -p /usr/local/rocketmq/rmq
mkdir -p /usr/local/rocketmq/rmqs
cd /usr/local/rocketmq/
vi docker-compose.yml
------------------------------------------------------------------
version: "2.17.2"

services:
rmqnamesrv:
image: apache/rocketmq:4.9.5
container_name: rmqnamesrv
ports:
- 9876:9876
volumes:
- /usr/local/rocketmq/rmqs/logs:/opt/logs
- /usr/local/rocketmq/rmqs/store:/opt/store
environment:
JAVA_OPT_EXT: "-Duser.home=/opt -Xms512M -Xmx512M -Xmn128m"
command: ["sh", "mqnamesrv"]
rmqbroker:
image: apache/rocketmq:4.9.5
container_name: rmqbroker
ports:
- 10909:10909
- 10911:10911
volumes:
- /usr/local/rocketmq/rmq/logs:/opt/logs
- /usr/local/rocketmq/rmq/store:/opt/store
- /usr/local/rocketmq/rmq/brokerconf/broker.conf:/etc/rocketmq/broker.conf
environment:
JAVA_OPT_EXT: "-Duser.home=/opt -Xms512M -Xmx512M -Xmn128m"
command:
[
"sh",
"mqbroker",
"-c",
"/etc/rocketmq/broker.conf",
"-n",
"172.28.71.198:9876",
"autoCreateTopicEnable=true",
]
depends_on:
- rmqnamesrv
rmqconsole:
image: apacherocketmq/rocketmq-console:2.0.0
container_name: rmqconsole
ports:
- 18080:8080
environment:
JAVA_OPTS: "-Drocketmq.namesrv.addr=172.28.71.198:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false"
depends_on:
- rmqnamesrv
-----------------------------------------------------------------------------------------------------------
vi /usr/local/rocketmq/rmq/brokerconf/broker.conf
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

brokerClusterName = DefaultCluster
brokerName = broker-b
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
transactionCheckInterval = 30000
transactionCheckMax = 10

# Set self-defined brokerIP address (e.g. the host node's)
brokerIP1=172.28.71.198
autoCreateTopicEnable=true

----------------------------------------------------------------------------------------------------------------

chmod -R 777 docker-compose.yml
cat docker-compose.yml

docker-compose -f docker-compose.yml up -d
docker images
docker ps
docker-compose --version

控制台:http://服务器 IP:18080