Linux中快速搭建RocketMQ测试环境

发布时间:2024年01月09日

必要的文件下载

为什么选择RocketMQ | RocketMQ

x86_64位JDK下载0jdk/8u391-b13

rocketmq二进制包下载-rocketmq-all-5.1.4-bin-release.zip

编译好的直接可用的dashboard【rocketmq-dashboard-1.0.0.jar】请在文章顶部下载

dashboard配套的配置文件【application.properties】请在文末复制该文件内容

启动RocketMQ服务

把rocketmq-all-5.1.4-bin-release.zip文件cp到当前目录下

执行以下命令解压并检查文件

cd ~

tar -zxf rocketmq-all-5.1.4-bin-release.zip

cd rocketmq-all-5.1.4-bin-release

ls bin

执行以下命令启动RocketMq

1.启动mqnamesrv

nohup sh bin/mqnamesrv &

#验证namesrv是否启动成功
tail -f logs/rocketmqlogs/namesrv.log
#The Name Server boot success...

2.启动broker

注意此处默认最小启动内存为8G,否则会报错。如需更改请往下看

nohup sh bin/mqbroker -n localhost:9876 --enable-proxy &

# 验证broker是否启动成功, 比如, broker的ip是192.168.1.2 然后名字是broker-a
tail -f logs/rocketmqlogs/proxy.log
# The broker[broker-a,192.169.1.2:10911] boot success...

修改runbroker的启动内存大小为1GB

vi bin/runbroker.sh

注意修改103行的-Xms? -Xmx 数值

启动WEB控制台

下载控制台源码

控制台源码下载-rocketmq-dashboard-1.0.0-source-release.zip

解压并使用maven打包(需要有maven环境)

如果没有可以直接下本人编译好的jar包? 【rocketmq-dashboard-1.0.0.jar】

maven打包命令:mvn package -DskipTests=true

注意:不同的maven版本 -D参数可能不一样。

启动jar包前修改配置

下载文件【application.properties】并修改以下值

修改以下配置:

server.port=58080
#如果rocketmq-dashboard-1.0.0和rocketmq服务在同一台机,可以使用localhost,反之使用rocketmq服务器的IP,如有多个可以“,”号分隔
rocketmq.config.namesrvAddr=localhost:9876

启动dashboard

先把修改过的?application.properties 放在与jar包同级目录

启动:

java -jar?rocketmq-dashboard-1.0.0.jar

访问dashboard

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
server.port=58080

### 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
rocketmq.config.namesrvAddr=localhost:9876
#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
#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
rocketmq.config.loginRequired=false

#set the accessKey and secretKey if you used acl
#rocketmq.config.accessKey=
#rocketmq.config.secretKey=
rocketmq.config.useTLS=false

文章来源:https://blog.csdn.net/dayuang2009/article/details/135490727
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。