windows中快捷启动rocketMq集群

1,桌面快捷启动文件夹中创建rocketMq.cmd

2,编辑文件,内容如下。

@echo off

:: 检查启动环境
if not exist "%ROCKETMQ_HOME%\bin\mqnamesrv.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & EXIT /B 1

if not exist "%ROCKETMQ_HOME%\bin\mqbroker.cmd" echo Please check your mqbroker.cmd! & EXIT /B 1

:: 获取本机IP地址,ip信息可以写到配置文件中,下面这段根据自己情况可以省略。
setlocal ENABLEEXTENSIONS & set "i=0.0.0.0" & set "j="

for /f "tokens=4" %%a in ('route print^|findstr 0.0.0.0.*0.0.0.0') do (
  if not defined j for %%b in (%%a) do set "i=%%b" & set "j=1")
endlocal & set "ip=%i%"

set rocketpath = %ROCKETMQ_HOME%\bin

cd %rocketpath %

start mqnamesrv.cmd

:: 启动完namesrv后再启动broker
pause

start mqbroker.cmd  -c %ROCKETMQ_HOME%\conf\2m-2s-async\broker-a.properties -n  %ip%:9876 brokerIP1=%ip%

start mqbroker.cmd  -c %ROCKETMQ_HOME%\conf\2m-2s-async\broker-a-s.properties -n  %ip%:9876 brokerIP1=%ip%

start mqbroker.cmd  -c %ROCKETMQ_HOME%\conf\2m-2s-async\broker-b.properties -n  %ip%:9876 brokerIP1=%ip%

start mqbroker.cmd  -c %ROCKETMQ_HOME%\conf\2m-2s-async\broker-b-s.properties -n  %ip%:9876 brokerIP1=%ip%

:: 如果有控制台程序,放在rocket_home文件夹下启动
cd ../

java -jar rocketmq-console-ng-1.0.0.jar  --server.port=8085 --rocketmq.config.namesrvAddr=%ip%:9876

注意:1,ROCKETMQ_HOME及JAVA_HOME环境变量配置准确,特别强调,java_home路径中不能有空格

2,同一台机器上启动多个broker时配置中存储路径不能一样。

你可能感兴趣的:(RocketMq,windows快捷启动,windows)