美文网首页
RocketMq安装及使用

RocketMq安装及使用

作者: coderymy | 来源:发表于2020-08-05 16:56 被阅读0次

    安装

    1. 首先下载,注意下载source版本(未编译版)下载地址

    2. 上传至linux服务器上,使用官方解压命令解压unzip rocketmq-all-4.3.0-source-release.zip

    3. 进入相关目录,使用mvn进行编译(如果没有需要安装maven,maven依赖jdk。都得安装)。mvn -Prelease-all -DskipTests clean install -U

    到这里就安装成功了

    启动

    1. 进入项目目录文件distribution/target/apache-rocketmq
    2. 启动namesrv,使用命令nohup sh bin/mqnamesrv &(如果nohup不存在就需要重新下载)
    3. 启动Borker,使用命令nohup sh bin/mqbroker -n localhost:9876 &
    4. 可以在当前目录的nohup.out中查看日志输出

    ps:如果启动的时候报错Cannot allocate memory,那就需要修改启动信息的虚拟机内存设置大小了(默认启动一般需要4-8G的虚拟机jvm参数空间),修改/bin/runbroker.sh中的下面几个参数JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn125m"

    安装可视化界面

    1. 下载并上传可视化界面的项目项目地址
    2. 修改配置文件
    server.address=0.0.0.0
    server.port=6789
    
    ### SSL setting
    #server.ssl.key-store=classpath:rmqcngkeystore.jks
    #server.ssl.key-store-password=rocketmq
    #server.ssl.keyStoreType=PKCS12
    #server.ssl.keyAlias=rmqcngkey
    
    #spring.application.index=true
    spring.application.name=rocketmq-console
    spring.http.encoding.charset=UTF-8
    spring.http.encoding.enabled=true
    spring.http.encoding.force=true
    logging.config=classpath:logback.xml
    #if this value is empty,use env value rocketmq.config.namesrvAddr  NAMESRV_ADDR | now, you can set it in ops page.default localhost:9876
    rocketmq.config.namesrvAddr=127.0.0.1:9876
    #if you use rocketmq version < 3.5.8, rocketmq.config.isVIPChannel should be false.default true
    rocketmq.config.isVIPChannel=
    #rocketmq-console's data path:dashboard/monitor
    rocketmq.config.dataPath=/tmp/rocketmq-console/data
    #set it false if you don't want use dashboard.default true
    rocketmq.config.enableDashBoardCollect=true
    #set the message track trace topic if you don't want use the default one
    rocketmq.config.msgTrackTopicName=
    rocketmq.config.ticketKey=ticket
    
    #Must create userInfo file: ${rocketmq.config.dataPath}/users.properties if the login is required
    rocketmq.config.loginRequired=false
    
    1. 使用mvn打个包mvn clean package -Dmaven.test.skip=true,需要注意的是,如果打包的时候失败了,可以替换一下镜像地址。修改conf/setting.xml文件
    <mirror>
       <id>alimaven</id>
       <name>aliyun maven</name>
       <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
       <mirrorOf>central</mirrorOf>        
    </mirror>
    
    1. 上传至服务器,使用java命令启动即可使用对应地址和服务器端口访问


      image.png

    相关文章

      网友评论

          本文标题:RocketMq安装及使用

          本文链接:https://www.haomeiwen.com/subject/bersrktx.html