• 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

  • 相关阅读:
    day 2
    【Dotnet 工具箱】DotNetCorePlugins- 动态加载和卸载 .NET 程序插件
    SpringBoot:(三)SpringBoot的特性
    极客时间:《一个草根创业者的40岁人生复盘》阅读笔记
    Docker到底是什么
    yolov5训练自定义数据
    Apache SeaTunnel 2.3.5 Zeta-Server集群环境搭建与使用
    Redis (二)
    基于低代码开发平台+BPM流程管理打造的行业KM解决方案
    Java笔记:JVM优化分析
  • 原文地址:https://blog.csdn.net/ldlly0505/article/details/127732002