1、环境要求
- 64bit OS, Linux/Unix/Mac is recommended;
- 64bit JDK 1.8+;
- Maven 3.2.x;
- Git;
- 4g+ free disk for Broker server
- RocketMQ 4.6.0
2、下载
wget https://www-eu.apache.org/dis...
下载资源包
wget https://archive.apache.org/di...
3、解压
release版本
unzip rocketmq-all-4.6.0-bin-release.zip
cd rocketmq-all-4.6.0-bin-release
资源包方式
mvn -Prelease-all -DskipTests clean install -U
3.1、修改配置
修改runserver.sh
JAVA_OPT="${JAVA_OPT} -server -Xms512m -Xmx512m -Xmn256m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
修改runbroker.sh
JAVA_OPT="${JAVA_OPT} -server -Xms512m -Xmx512m -Xmn256m"
修改tools.sh
JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn128m -XX:PermSize=128m -XX:MaxPermSize=128m"
4、启动Name Server
sh ./bin/mqnamesrv &
日志
tail -f ~/logs/rocketmqlogs/namesrv.log
5、启动Borker
添加
vi ./conf/broker.conf
namesrvAddr=192.168.136.200:9876
brokerIP1=192.168.136.200
sh ./bin/mqbroker -n 192.168.136.200:9876 autoCreateTopicEnable=true -c /usr/local/soft/rocketmq/rocketmq-all-4.6.0-bin-release/conf/broker.conf &
日志
tail -f ~/logs/rocketmqlogs/broker.log
6、发送消息验证
export NAMESRV_ADDR=localhost:9876
sh tools.sh org.apache.rocketmq.example.quickstart.Producer
sh tools.sh org.apache.rocketmq.example.quickstart.Consumer
7、关闭
sh bin/mqshutdown broker
sh bin/mqshutdown namesrv
8、安装web界面
下载 wget https://github.com/apache/roc...
mvn clean package -Dmaven.test.skip=true打包
rocketmq-console-ng-1.0.0.jar上传到服务器
如果要修改配置文件把application.properties放到同一目录,修改
rocketmq.config.namesrvAddr=namesrv服务地址(ip1:port;ip2:port)
启动 java -jar rocketmq-console-ng-1.0.0.jar &
本文由作者pm1280415703:JAVA实验手册 发布,交流群:583284584!