RocketMQ構建docker映象及部署(2)
阿新 • • 發佈:2022-04-15
1.拉取dockerHub構建好的映象
docker pull ashscc/rocketmq:4.8.0
2.建立需要掛載進去的檔案目錄以及配置
mkdir -p /docker/rocketmq/conf cd /docker/rocketmq/conf touch broker.conf #broker.conf配置 brokerClusterName = DefaultCluster brokerName = broker-a brokerId = 0 deleteWhen = 04 fileReservedTime = 48 brokerRole = ASYNC_MASTER flushDiskType = ASYNC_FLUSH brokerIP1 = 49.233.147.71 autoCreateTopicEnable=true aclEnable=true mkdir -p /docker/rocketmq/conf cd /docker/rocketmq/conf touch plain_acl.yml # plain_acl.yml配置 # 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. globalWhiteRemoteAddresses: - 49.233.147.* - 172.16.7.* - 172.21.0.13 accounts: - accessKey: poisonSpider secretKey: poison6677@ whiteRemoteAddress: admin: false defaultTopicPerm: DENY defaultGroupPerm: SUB topicPerms: - poison=SUB|SUB groupPerms: # the group should convert to retry topic - poison_produce_group=PUB - poison_consume_group_size=SUB - poison_consume_group_detail=SUB - accessKey: rocketmqadmin1 secretKey: bigServerMq158@ whiteRemoteAddress: 49.233.147.71 # if it is admin, it could access all resources admin: true
3.部署nameserve域名發現服務
mkdir -p /docker/rocketmq/nameserve/logs mkdir -p /docker/rocketmq/nameserve/store docker run -d -p 9876:9876 --name rmqnamesrv -e "MAX_POSSIBLE_HEAP=100000000" -v /docker/rocketmq/nameserve/logs:/home/rocketmq/logs -v /docker/rocketmq/nameserve/store:/home/rocketmq/store ashscc/rocketmq:4.8.0 sh mqnamesrv
4.部署broker控制器服務
#mkdir -p /docker/rocketmq/broker/logs #mkdir -p /docker/rocketmq/broker/store /home/rocketmq/logs/rocketmqlogs docker run -d -p 10911:10911 -p 10909:10909 -p 10912:10912 -v /docker/rocketmq/conf/broker.conf:/home/rocketmq/rocketmq-4.8.0/conf/broker.conf -v /docker/rocketmq/conf/plain_acl.yml:/home/rocketmq/rocketmq-4.8.0/conf/plain_acl.yml --name rmqbroker --link rmqnamesrv:namesrv -e "NAMESRV_ADDR=namesrv:9876" -e "MAX_POSSIBLE_HEAP=200000000" ashscc/rocketmq:4.8.0 sh mqbroker -c /home/rocketmq/rocketmq-4.8.0/conf/broker.conf
5.建立rocketmq-console所需要的資料夾和配置
5.1建立user.properties
mkdir -p /docker/rocketmq-console/data
cd /docker/rocketmq-console/data
touch users.properties
# 對登陸的console-log的使用者的帳密的配置,修改規則看說明
# This file supports hot change, any change will be auto-reloaded without Console restarting.
# Format: a user per line, username=password[,N] #N is optional, 0 (Normal User); 1 (Admin)
# Define Admin
rocketmqAdmin=rmqconsole112@,1
# Define Users
testUser=test123
5.2啟動時的變數通過系統環境變數寫入
docker run -d -e "JAVA_OPTS=-Drocketmq.config.namesrvAddr=49.233.147.71:9876 -Drocketmq.config.isVIPChannel=false -Drocketmq.config.loginRequired=true -Drocketmq.config.dataPath=/tmp/rocketmq-console/data -Drocketmq.config.accessKey=rocketmqadmin1 -Drocketmq.config.secretKey=bigServerMq158@" -v /docker/rocketmq-console/data:/tmp/rocketmq-console/data --name rmqconsole -p 8081:8080 -t ashscc/rocketmq-console