RocketMQ4.x本地源码部署教程
安装前提条件(推荐) 64bit OS, Linux/Unix/Mac (Windows不兼容)64bit JDK 1.8+;
快速开始
http://rocketmq.apache.org/docs/quick-start/
下载安装包
https://www.apache.org/dyn/closer.cgi?path=rocketmq/4.9.4/rocketmq-all-4.9.4-source-release.zip
解压安装包
unzip rocketmq-all-4.9.4-source-release.zip
进入目录
cd rocketmq-all-4.9.4-source-release/
构建环境
mvn -Prelease-all -DskipTests clean install -U
最终路径
cd distribution/target/rocketmq-4.9.4/rocketmq-4.9.4
最新版本部署存在问题
Please set the JAVA_HOME variable in your environment, We need java(x64)
解决:本地需要配置 JAVA_HOME 使用命令 vim ~/.bash_profile
JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home"
export JAVA_HOME
CLASS_PATH="$JAVA_HOME/lib"
PATH=".$PATH:$JAVA_HOME/bin"
使用 source /etc/profile 让配置立刻生效
启动nameServer
nohup sh bin/mqnamesrv &
查看日志
tail -f nohup.out
(结尾:The Name Server boot success. serializeType=JSON 表示启动成功)
启动broker
(-n指定nameserver地址,nameserver服务端口为9876, broker默认端口 10911)
nohup sh bin/mqbroker -n localhost:9876 &
验证是否成功
- 设置名称服务地址
export NAMESRV_ADDR=localhost:9876
- 投递消息
sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer
SendResult [sendStatus=SEND_OK, msgId= ...
- 消费消息
sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer
ConsumeMessageThread_%d Receive New Messages: [MessageExt...
关闭服务器
关闭broker
sh bin/mqshutdown broker
The mqbroker(36695) is running...
Send shutdown request to mqbroker(36695) OK
关闭 namesrv
sh bin/mqshutdown namesrv
The mqnamesrv(36664) is running...
Send shutdown request to mqnamesrv(36664) OK
问题
Liunx 解压安装
yum install unzip
NameServer内存不足
报错问题如下
[root@iZwz94sw188z3yfl7lpmmsZ apache-rocketmq]# sh bin/mqnamesrv
Java HotSpot(TM) 64-Bit Server VM warning: Using the DefNew young collector with the CMS collector is deprecated and will likely be removed in a future release
Java HotSpot(TM) 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000006ec800000, 2147483648, 0) failed; error='Cannot allocate memory' (errno=12)
There is insufficient memory for the Java Runtime Environment to continue.
Native memory allocation (mmap) failed to map 2147483648 bytes for committing reserved memory.
An error report file with more information is saved as:
/usr/local/software/rocketmq-all-4.4.0/distribution/target/apache-rocketmq/hs_err_pid8993.log
解决
bin/runserver.sh
修改内存
JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn256m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
Broker内存不足
runbroker.sh
修改内存
JAVA_OPT="${JAVA_OPT} -server -Xms528m -Xmx528m -Xmn256m"
最新文章
- [Sass]扩展/继承
- 编译安装 Zend Opcache 缓存Opcache,加速 PHP
- linux 脚本小试系列
- C语言程序设计第四次作业
- C# Graphics类详解
- 网页加载图片原理<;转>;
- explain mysql的type字段,索引的类型
- select框内容的编辑、修改、添加、删除操作
- 16.3.1-sp_getapplock
- Servlet之Cookie操作
- SAR命令
- POJ 1410 Intersection(判断线段交和点在矩形内)
- 获取属性名:PropertyNameHelper
- 解决图片元素下多余空白的BUG
- zb的生日(暴搜dfs)
- Android定位功能
- 使用OTP动态口令(每分钟变一次)进行登录认证
- DOCKER 从入门到放弃(二)
- C#无限分级实现,前端WEB页面接收,后台提供层级Json数据
- vscode调试适配器已意外终止