配置环境变量(ROCKETMQ_HOME)
修改runserver.cmd
1、进入bin目录下找到runserver.cmd文件,用编辑器打开,因为RocketMQ默认需要2g运行内存,做为测试用,就只要最低配置就好了,注释原有的NameServer 的配置,在其前面加上rem 注释掉,
rem set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
在后面加上
set "JAVA_OPT=%JAVA_OPT% -server -Xms256m -Xmx512m"
2、双击 mqnamesrv.cmd 文件 NameServer 的默认端口是9876
3、配置broker排位置文件
a.用编辑器打开runbroker.cmd文件
注释默认配置,在其前面加上
rem set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g -Xmn1g"
并在后面配置
set "JAVA_OPT=%JAVA_OPT% -server -Xms256m -Xmx512m"
b.配置NameServer地址
rem 指定NameServer的地址
set "NAMESRV_ADDR=localhost:9876"
rem 添加NameServer的地址
call "%ROCKETMQ_HOME%\bin\runbroker.cmd" org.apache.rocketmq.broker.BrokerStartup %*
查看 是否有集群注册
.\mqadmin.cmd clusterList -n localhost:9876
-
修改 conf 文件夹中的 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
# 使用的broker-a.properties配置,名字和配置文件一致
brokerName = broker-a
# 0表示master,大于0表示slave
brokerId = 0
# 删除文件时间,默认为凌晨4点
deleteWhen = 04
# 文件保留时间,默认为48小时
fileReservedTime = 48
# broker角色:ASYNC_MASTER异步复制Master SYNC_MASTER同步双写Master
brokerRole = ASYNC_MASTER
# 刷盘方式:ASYNC_FLUSH异步刷盘 SYNC_FLUSH同步刷盘
flushDiskType = ASYNC_FLUSH
# 允许自动创建topic
autoCreateTopicEnable=true
# 允许自动创建订阅组
autoCreateSubscriptionGroup=true
# 对外服务的监听端口
listenPort=10911
# 检测磁盘空间,低于该值就会导致消息接收失败
diskMaxUsedSpaceRatio=99
# store存储路径
storePathRootDir=D:\RocketMQ\log\store
# commitlog存储路径
storePathCommitLog=D:\RocketMQ\log\store\commitlog
# 消费队列存储路径
storePathConsumeQueue=D:\RocketMQ\log\store\consumequeue
# 消息索引存储路径
storePathIndex=D:\RocketMQ\log\store\index
# checkpoint文件存储路径
storeCheckpoint=D:\RocketMQ\log\store\checkpoint
# abort文件存储路径
abortFile=D:\RocketMQ\log\store\abort
图形化界面:
idea运行就行
标签:JAVA,License,ROCKETMQ,cmd,broker,RocketMQ,store From: https://www.cnblogs.com/firsthelloworld/p/17443910.html