rocketmq 部署
文章目录
1.下载链接
⚠️dashboard下载完需在maven环境下进行编译打包!!!
2.端口规划
namesrv、broker、dashboard
序号 | 部署服务 | 端口 |
---|---|---|
1 | namesrv | 8028 |
2 | broker | 8029 |
3 | dashboard | 8031 |
3.配置文件:
3.1 namesrv
在配置文件路径下rocketmq-all-5.1.4-bin-release/conf,新建配置文件(修改指定的端口号)
文件名: namesrv.properties
listenPort=8028
3.2 broker
编辑配置文件rocketmq-all-5.1.4-bin-release/conf/broker.conf
brokerClusterName = DefaultCluster
brokerName = broker
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
## **************下边为追加配置项,如果没有对应的目录需要手动创建**************
namesrvAddr=192.168.123.110:8028
brokerIP1=192.168.123.110
### 设置broker端口
listenPort=8029
storePathRootDir=/data/mqbroker/store
storePathCommitLog=/data/mqbroker/store/commitlog
storePathConsumerQueue=/data/mqbroker/store/consumequeue
storePathIndex=/data/mqbroker/store/index
storeCheckpoint=/data/mqbroker/store/checkpoint
abortFile=/data/mqbroker/store/abort
## **************追加配置项结束**************
3.3 dashboard
在配置文件路径下rocketmq-all-5.1.4-bin-release/conf,新建配置文件application.properties
#
# 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.
#
server.address=0.0.0.0
### 修改端口号,后续在浏览器中输入ip+端口访问页面时用到
server.port=8031
### SSL setting
#server.ssl.key-store=classpath:rmqcngkeystore.jks
#server.ssl.key-store-password=rocketmq
#server.ssl.keyStoreType=PKCS12
#server.ssl.keyAlias=rmqcngkey
#spring.application.index=true
spring.application.name=rocketmq-dashboard
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
spring.http.encoding.force=true
logging.level.root=INFO
logging.config=classpath:logback.xml
#if this value is empty,use env value rocketmq.config.namesrvAddr NAMESRV_ADDR | now, you can set it in ops page.default localhost:9876
### 修改指定的namesrv地址信息
rocketmq.config.namesrvAddr=192.168.123.110:8028
#if you use rocketmq version < 3.5.8, rocketmq.config.isVIPChannel should be false.default true
rocketmq.config.isVIPChannel=
#timeout for mqadminExt, default 5000ms
rocketmq.config.timeoutMillis=
#rocketmq-console's data path:dashboard/monitor
# rocketmq.config.dataPath=/tmp/rocketmq-console/data
### 设置文件存储路径(可改可不改,不改使用上边默认的)
rocketmq.config.dataPath=/apps/data/rocketmq_config_data/data
#set it false if you don't want use dashboard.default true
rocketmq.config.enableDashBoardCollect=true
#set the message track trace topic if you don't want use the default one
rocketmq.config.msgTrackTopicName=
rocketmq.config.ticketKey=ticket
#Must create userInfo file: ${rocketmq.config.dataPath}/users.properties if the login is required
### 设置用户名密码访问,false改成true
rocketmq.config.loginRequired=true
#set the accessKey and secretKey if you used acl
### 设置用户名密码
rocketmq.config.accessKey=xiaoran
rocketmq.config.secretKey=123456
rocketmq.config.useTLS=false
4.启停动脚本
4.1 namesrv
start-namesrv.sh
#!/bin/sh
export SRV_NAME="namesrv"
ROCKETMQ_HOME=rocketmq
${ROCKETMQ_HOME}/bin/mqnamesrv -n 192.168.123.110:8028 -c ${ROCKETMQ_HOME}/conf/namesrv.properties 2>&1 | cronolog -k 5 logs/rocketmqlogs/${SRV_NAME}-%m%d.log > /dev/null &
stop-namesrv.sh
#!/bin/sh
export SRV_NAME="namesrv"
ROCKETMQ_HOME=rocketmq
${ROCKETMQ_HOME}/bin/mqshutdown namesrv -c ${ROCKETMQ_HOME}/conf/namesrv.properties
4.2 broker
start-broker.sh
#!/bin/sh
export SRV_NAME="broker"
ROCKETMQ_HOME="rocketmq"
${ROCKETMQ_HOME}/bin/mqbroker -c ${ROCKETMQ_HOME}/conf/broker.conf 2>&1 | cronolog -k 3 logs/rocketmqlogs/${SRV_NAME}-%m%d.log > /dev/null &
stop-broker.sh
#!/bin/sh
export SRV_NAME="broker"
ROCKETMQ_HOME="rocketmq"
${ROCKETMQ_HOME}/bin/mqshutdown broker-c ${ROCKETMQ_HOME}/conf/broker.conf
4.3 dashboard
start-dashboard
#!/bin/sh
SRV_NAME="dashboard"
JAVA_HOME=java/jdk1.8.0_371
ROCKETMQ_HOME=rocketmq
$JAVA_HOME/bin/java -server -Xms2g -Xmx2g -jar ${ROCKETMQ_HOME}/rocketmq-dashboard-1.0.0.jar --spring.config.location=${ROCKETMQ_HOME}/conf/application.properties 2>&1 | \
$HOME/svr/cronolog -k 3 ~/logs/rocketmqlogs/${SRV_NAME}-%m%d.log >/dev/null &
stop-dashboard
#!/bin/sh
SRV_NAME="dashboard"
JAVA_HOME=java/jdk1.8.0_371
PID=`jps -l | grep dash | awk '{print $1}'`
if [ -z "$PID" ]; then
echo "Process ${SRV_NAME} is not running."
else
echo "stop ${SRV_NAME}"
kill -9 $PID && echo "Process ${SRV_NAME} stop successful..."
fi