RocketMQ初体验-安装及修改JDK
要求
- 64bit OS, Linux/Unix/Mac is recommended;(Windows user see guide below)
- 64bit JDK 1.8+;
- Maven 3.2.x;
- Git;
- 4g+ free disk for Broker server
下载RocketMQ
配置官方文档
windows配置说明
配置环境变量
#ROCKETMQ_HOME为ROCKETMQ本地路径
ROCKETMQ_HOME="D:\rocketmq"
NAMESRV_ADDR="localhost:9876"
Start Name Server
.\bin\mqnamesrv.cmd
Start Broker
.\bin\mqbroker.cmd -n localhost:9876 autoCreateTopicEnable=true
异常说明
服务器JDK小于8
Rocketmq4.8要求jdk8,若JDK版本小于8,需提供8的版本。如把免安装版复制到指定路径c:\jdk\jdk1.8
下
- 修改
runserver.cmd
及runbroker.cmd
文件 - 添加
set "JAVA_HOME=c:\jdk\jdk1.8"
到if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment
前
启动名称服务(mqnamesrv.cmd
)内存设置太大异常
...
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap
...
修改runserver.cmd
文件中为set "JAVA_OPT=%JAVA_OPT%" -server -Xms1g -Xmx1g -Xmn512m
,调整使用的内存