centos安装rocketmq

1、下载

https://github.com/apache/rocketmq/releases

2、环境

  • jdk1.8.0.211
  • maven3.6.3

3、安装


  > tar xf rocketmq-all-4.7.1.tar.gz
  > cd rocketmq-all-4.7.1/
  > mvn -Prelease-all -DskipTests clean install -U
  > cd distribution/target/rocketmq-4.7.1/rocketmq-4.7.1

4、启动Name Server

  > nohup sh bin/mqnamesrv &
  > tail -f ~/logs/rocketmqlogs/namesrv.log
  The Name Server boot success...

5、启动Broker

  > nohup sh bin/mqbroker -n localhost:9876 &
  > tail -f ~/logs/rocketmqlogs/broker.log 
  The broker[%s, 172.30.30.233:10911] boot success...

6、停止服务

> sh bin/mqshutdown broker
The mqbroker(36695) is running...
Send shutdown request to mqbroker(36695) OK

> sh bin/mqshutdown namesrv
The mqnamesrv(36664) is running...
Send shutdown request to mqnamesrv(36664) OK

7、相关问题

  1. 内存不足问题
rocketmq Native memory allocation (mmap) failed to map 8589934592 bytes for committing reserved memory.

修改distribution/target/rocketmq-4.7.1/rocketmq-4.7.1/bin目录中的runserver.shrunbroker.sh
JAVA_OPT="${JAVA_OPT} -server -Xms4g -Xmx4g -Xmn2g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"改为JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn128m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"

  1. 防火墙开放端口
    9876 10911

8、安装RocketMQ可视化工具

研发测试时可以安装RocketMQ可视化工具RocketMQ-Console,利于观察。

  1. 下载地址:https://github.com/apache/rocketmq-externals
    在这里插入图片描述
  2. 修改配置
    在这里插入图片描述
  3. 打包mvn clean package -Dmaven.test.skip=true
  4. 将jar包传到服务器,使用java -jar启动
posted @ 2023-06-24 18:37  路暝月  阅读(128)  评论(0编辑  收藏  举报  来源