美文网首页
消息队列之 ActiveMQ、RabbitMQ

消息队列之 ActiveMQ、RabbitMQ

作者: Evan_Vivian | 来源:发表于2019-03-14 22:12 被阅读0次

    好的高并发架构是需要有消息队列的,开源的消息中间件有很多。此文单独记录一下本人常用的两种MQ:ActiveMQ、RabbitMQ 在CentOS 7上的安装方式。

    ActiveMQ

    JDK安装参考

    #ActiveMQ需要Java环境,须先安装jdk 参考上方链接
    
    wget http://archive.apache.org/dist/activemq/5.15.5/apache-activemq-5.15.5-bin.tar.gz
    tar xf apache-activemq-5.15.5-bin.tar.gz -C /usr/local/
    mv /usr/local/apache-activemq-5.15.5 /usr/local/activemq
    

    systemd

    vim /usr/local/activemq/bin/activemq

    第二行添加如下内容
    export JAVA_HOME=/usr/local/jdk1.8.0_191
    

    vim /usr/lib/systemd/system/activemq.service

    [Unit]
    Description=ActiveMQ service
    After=network.target
    
    [Service]
    Type=forking
    ExecStart=/usr/local/activemq/bin/activemq start
    ExecStop=/usr/local/activemq/bin/activemq stop
    User=root
    Group=root
    Restart=always
    RestartSec=9
    StandardOutput=syslog
    StandardError=syslog
    SyslogIdentifier=activemq
    
    [Install]
    WantedBy=multi-user.target
    
    systemctl start activemq             #启动activemq  
    systemctl status activemq.service    #查看activemq状态
    lsof -i:8161,61616                   #检查activemq端口
    

    其它

    修改密码
    vim /usr/local/activemq/conf/jetty-realm.properties

    倒数第二行   
    admin: admin, admin
    修改为
    admin: Evan*****, admin   
    

    端口如若修改
    vim /usr/local/activemq/conf/jetty.xml

    <property name="port" value="8161"/>       110行
    

    activemq和rabbitmq安装在一台主机时需要修改5672端口
    vim /usr/local/activemq/conf/activemq.xml

    <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?m    114行  
    

    RabbitMQ

    yum install xmlto ncurses-devel openssl openssl-devel
    wget http://erlang.org/download/otp_src_21.2.tar.gz
    wget https://dl.bintray.com/rabbitmq/all/rabbitmq-server/3.7.12/rabbitmq-server-generic-unix-3.7.12.tar.xz
    
    tar xf otp_src_21.2.tar.gz
    cd otp_src_21.2
    ./configure --prefix=/usr/local/erlang
    make && make install
    
    tar xf rabbitmq-server-generic-unix-3.7.12.tar.xz -C /usr/local/
    mv /usr/local/rabbitmq_server-3.7.12 /usr/local/rabbitmq
    
    vim /etc/profile
    最末行增加下行环境变量
    export PATH=/usr/local/erlang/bin:/usr/local/rabbitmq/sbin:$PATH
    
    source /etc/profile
    
    rabbitmq-server -detached                     #后台启动
    lsof -i:5672                                  #检查端口
    rabbitmqctl status                            #查看状态
    rabbitmq-plugins enable rabbitmq_management   #开启WEB
    
    #停止命令
    rabbitmqctl stop
    

    资料
    https://blog.csdn.net/eric520zenobia/article/details/77864956
    https://www.jianshu.com/p/79ca08116d57
    https://juejin.im/post/5ad46f34518825651d08265c
    https://help.aliyun.com/document_detail/29532.html

    原文链接

    相关文章

      网友评论

          本文标题:消息队列之 ActiveMQ、RabbitMQ

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