• rocketmq4.9 linux安装


    1.到apache官网下载binary zip包: apache官网

    2.解压zip包:

    unzip rocketmq-all-4.9.0-bin-release.zip

    3.进入解压后的文件夹,启动 Name Server:

    nohup sh bin/mqnamesrv &

    启动后会有日志输出到nohup.out文件上,可以到上面去看看是否启动成功:

    tail -100f nohup.out

    有以下日志说明启动成功:

    1. 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
    2. Java HotSpot(TM) 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.
    3. The Name Server boot success. serializeType=JSON

    4.启动broker:

    nohup sh bin/mqbroker -n localhost:9876 &

    同样日志也是输出到nohup.out文件上,不改配置一般启动都会报以下错误:

    1. Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000005c0000000, 8589934592, 0) failed; error='Cannot allocate memory' (errno=12)
    2. #
    3. # There is insufficient memory for the Java Runtime Environment to continue.
    4. # Native memory allocation (mmap) failed to map 8589934592 bytes for committing reserved memory.
    5. # An error report file with more information is saved as:
    6. # /usr/sofe/rocketmq/rocketmq-all-4.9.0-bin-release/hs_err_pid6029.log
    7. Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000005c0000000, 8589934592, 0) failed; error='Cannot allocate memory' (errno=12)
    8. #
    9. # There is insufficient memory for the Java Runtime Environment to continue.
    10. # Native memory allocation (mmap) failed to map 8589934592 bytes for committing reserved memory.

    出现该错误是因为内存配置太大了,修改下当前目录下/bin/runbroker.sh启动配置的java内存即可:

    JAVA_OPT="${JAVA_OPT} -server -Xms2g -Xmx2g -Xmn1g"

     再次启动出现以下说明成功了:

    The broker[localhost.localdomain, 192.168.37.128:10911] boot success. serializeType=JSON and name server is localhost:9876
    

    5.停掉rocketmq

    1. sh bin/mqshutdown broker
    2. sh bin/mqshutdown namesrv

    6.测试是否可以发送和接受消息:

    1. 在发送和接收消息之前,客户需要识别名称服务器的地址。 RocketMQ有多种方法可以在客户端设置名称服务器地址。其中之一是修改环境变量namesrv_addr:
    2. export NAMESRV_ADDR=localhost:9876

    测试发送:

    1. sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer

    测试接收:

    sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer

    以上Apache官网有rocketmq文档可以看:https://rocketmq.apache.org/docs/4.x/introduction/02quickstart

  • 相关阅读:
    【三等奖方案】小样本数据分类任务赛题「复兴15号」团队解题思路
    自动驾驶系列(七)——聊聊人机交互中的DMS驾驶员监控系统
    ESP32设备通信-LoRa通信
    接口自动化测试_L3
    KVM 教程
    【设计模式】【第二章】【业务投放场景】【责任链模式】
    缓存穿透、缓存击穿、缓存雪崩及其解决方案
    华为OD机试 - 考勤信息 - 双指针(Java 2023 B卷 100分)
    leetcode刷题日志-28.找出字符串中第一个匹配项的下标
    深入理解C++内存管理
  • 原文地址:https://blog.csdn.net/ldlly0505/article/details/127732002