安装
安装maven:
1、wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo 获取yum源
2、sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo 修改yum源文件,$releasever替换成6
3、yum install -y apache-maven
安装jdk1.8 (yum install java-1.8.0-openjdk*)
安装RocketMQ:(4G内存+1.5G虚存)512M虚存不够 安装时间25-30min左右
1、wget https://archive.apache.org/dist/rocketmq/4.6.0/rocketmq-all-4.6.0-source-release.zip
2、unzip rocketmq-all-4.6.0-source-release.zip
3、cd rocketmq-all-4.6.0-source-release
4、mvn -Prelease-all -DskipTests clean install -U
启动
环境变量
1、vim /etc/profile
2、增加ROCKETMQ_HOME=/XXX/YYYY/rocketmq-all-4.6.0-source-release/distribution/target/rocketmq-4.6.0/rocketmq-4.6.0 视情况,一般不是解压缩的目录,而是编译输出目录
把ROCKETMQ_HOME加入PATH变量。
3、cd $ROCKETMQ_HOME/bin
修改runserver.sh nameserver启动时配置文件,默认配置在低配环境可能启不来。
JAVA_OPT="${JAVA_OPT} -server -Xms4g -Xmx4g -Xmn2g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m" -> JAVA_OPT="${JAVA_OPT} -server -Xms128m -Xmx128m -Xmn128m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m"
启动nameserver
1、启动命名服务器(nameserver)监听端口(9876 默认)
nohup mqnamesrv 1>/XXXX/YYYY/rocketmq-all-4.6.0-source-release/distribution/target/rocketmq-4.6.0/rocketmq-4.6.0/log/ng.log 2>/XXXX/YYYY/rocketmq-all-4.6.0-source-release/distribution/target/rocketmq-4.6.0/rocketmq-4.6.0/log/ng-err.log &
启动broker
1、cd $ROCKETMQ_HOME/bin
修改runbroker.sh broker启动时配置文件,默认配置(8g)在低配环境可能启不来。
JAVA_OPT="${JAVA_OPT} -server -Xms8g -Xmx8g -Xmn4g" -> JAVA_OPT="${JAVA_OPT} -server -Xms512m -Xmx512m -Xmn256m"
2、启动broker(代理)
nohup mqbroker > /XXXX/YYYY/rocketmq-all-4.6.0-source-release/distribution/target/rocketmq-4.6.0/rocketmq-4.6.0/log/mq.log 2>&1 &
相关参考文章:
https://github.com/apache/rocketmq-client-cpp
https://github.com/apache/rocketmq-client-go
https://blog.csdn.net/l18848956739/article/details/83111455 //组消费和广播消费区别
http://rocketmq.apache.org/docs/quick-start/ // apache rocketmq 官方文档
部署rocketmq-console
1、docker pull styletang/rocketmq-console-ng
2、docker run -e "JAVA_OPTS=-Drocketmq.namesrv.addr=host:port -Dcom.rocketmq.sendMessageWithVIPChannel=false" -p 8080:8080 -t styletang/rocketmq-console-ng