RocketMQ安装-单机版-windows+centos

windows版本

  1. 解压压缩包rocketmq-all-4.7.1-bin-release.zip并复制到本地软件安装目录

  2. 环境变量添加

    NAMESRV_ADDR=localhost:9876
    ROCKETMQ_HOME=D:\soft\rocketmq
    
  3. 修改bin目录下的runbroker.cmd和runserver.cmd中的虚拟机内存大小为

    rem runserver.cmd
    set "JAVA_OPT=%JAVA_OPT% -server -Xms256m -Xmx256m -Xmn128m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
    rem runbroker.cmd
    set "JAVA_OPT=%JAVA_OPT% -server -Xms256m -Xmx256m -Xmn128m"
    
  4. broker.conf中第一行添加本地局域网ip

    brokerIp1 = 192.168.0.x
    
  5. conf目录下logback开头的文件中修改${user.name}为本地日志目录地址(可不修改),也可以使用变量进行修改,在logback开头的文件configuration标签下添加property标签

    <property name="LOG_HOME" value="D:/temp" />
    

    然后将logback开头的文件中${user.home}替换为${LOG_HOME}

  6. 启动nameserver和broker

    # .\mqnamesrv.cmd
    # .\mqbroker.cmd -n localhost:9876 autoCreateTopicEnable=true
    
  7. 运行rocketmq管理监控界面rocketmq-console(可不运行,默认端口是8080)

    java -jar rocketmq-console-2.0.0.jar
    

CentOS版本

  1. 解压压缩包rocketmq-all-4.7.1-bin-release.zip并复制到本地软件安装目录

  2. 环境变量配置,并执行source /etc/profile

    # rocketmq
    NAMESRV_ADDR=127.0.0.1:9876
    ROCKETMQ_HOME=/home/root-dir/server/rocketmq
    PATH=$ROCKETMQ_HOME:$PATH
    export ROCKETMQ_HOME NAMESRV_ADDR PATH
    
  3. 修改bin目录下的runbroker.sh和runserver.sh中的虚拟机内存大小为

    # runbroker.sh
    JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn512m"
    
    # runserver.sh
    JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn512m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
    
  4. broker.conf中第一行添加本地局域网ip

     brokerIp1 = 192.168.0.x
    
  5. conf目录下logback开头的文件中修改${user.name}为本地日志目录地址(可不修改),也可以使用变量进行修改,在logback开头的文件里面的configuration标签下添加property标签

    <property name="LOG_HOME" value="/home/java" />
    

    然后将logback开头的文件中${user.home}替换为${LOG_HOME}

  6. 启动服务

    启动nameServer

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

    启动broker

    > nohup sh mqbroker &
    > tail -f ~/logs/rocketmqlogs/broker.log 
    The broker[%s, 172.30.30.233:10911] boot success...
    
  7. 关闭服务

    > sh mqshutdown broker
    The mqbroker(36695) is running...
    Send shutdown request to mqbroker(36695) OK
    
    > sh mqshutdown namesrv
    The mqnamesrv(36664) is running...
    Send shutdown request to mqnamesrv(36664) OK
    
  8. 异常解决

    创建topic报错:java.security.NoSuchAlgorithmException: Algorithm HmacSHA1 not available

    解决办法:

    在bin目录下的tools.sh倒数第二行的JAVA_OPT添加jdk的ext目录,修改后如下:

    JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${BASE_DIR}/lib:${JAVA_HOME}/jre/lib/ext:${JAVA_HOME}/lib/ext:/usr/java/jdk1.8.0_251-amd64/jre/lib/ext"
    

RocketMQ安装-单机版-windows+centos

上一篇:rdd-api整理


下一篇:九爷带你了解 zabbix 飞信以及机器人报警