• 20200202 ActiveMQ 2. ActiveMQ安装和控制台


    Linux 安装 ActiveMQ

    安装步骤:

    1. 下载安装包(Linux格式)

    官网下载

    1. 解压到/opt目录
    tar -zxvf apache-activemq-5.15.11-bin.tar.gz
    
    1. 根目录下新建文件夹myactivemq
    mkdir /myactivemq
    
    1. 将解压后的activemq目录拷贝到myactivemq
    cp -r /opt/apache-activemq-5.15.11 /myactivemq/
    
    1. 普通启动与带运行日志启动
      启动命令在bin目录下
    # 普通启动
    [root@hwjsLinux bin]# ./activemq start
    INFO: Loading '/myactivemq/apache-activemq-5.15.11//bin/env'
    INFO: Using java '/usr/bin/java'
    INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
    INFO: pidfile created : '/myactivemq/apache-activemq-5.15.11//data/activemq.pid' (pid '2720')
    

    在最后一行可以看到pid为2720

    # 带运行日志启动
    ./activemq start > /myactivemq/run.log
    
    1. 验证启动成功

    activemq默认启动端口是61616

    # 查询activemq的进程状态
    [root@hwjsLinux bin]# ps -ef | grep activemq
    root       2720      1 12 17:38 pts/0    00:00:06 /usr/bin/java -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/myactivemq/apache-activemq-5.15.11//conf/login.config -Dcom.sun.management.jmxremote -Djava.awt.headless=true -Djava.io.tmpdir=/myactivemq/apache-activemq-5.15.11//tmp -Dactivemq.classpath=/myactivemq/apache-activemq-5.15.11//conf:/myactivemq/apache-activemq-5.15.11//../lib/: -Dactivemq.home=/myactivemq/apache-activemq-5.15.11/ -Dactivemq.base=/myactivemq/apache-activemq-5.15.11/ -Dactivemq.conf=/myactivemq/apache-activemq-5.15.11//conf -Dactivemq.data=/myactivemq/apache-activemq-5.15.11//data -jar /myactivemq/apache-activemq-5.15.11//bin/activemq.jar start
    root       2779   2574  0 17:39 pts/0    00:00:00 grep --color=auto activemq
    
    
    ## 排除grep命令产生的进程状态
    [root@hwjsLinux bin]# ps -ef | grep activemq | grep -v grep
    root       2720      1  8 17:38 pts/0    00:00:06 /usr/bin/java -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/myactivemq/apache-activemq-5.15.11//conf/login.config -Dcom.sun.management.jmxremote -Djava.awt.headless=true -Djava.io.tmpdir=/myactivemq/apache-activemq-5.15.11//tmp -Dactivemq.classpath=/myactivemq/apache-activemq-5.15.11//conf:/myactivemq/apache-activemq-5.15.11//../lib/: -Dactivemq.home=/myactivemq/apache-activemq-5.15.11/ -Dactivemq.base=/myactivemq/apache-activemq-5.15.11/ -Dactivemq.conf=/myactivemq/apache-activemq-5.15.11//conf -Dactivemq.data=/myactivemq/apache-activemq-5.15.11//data -jar /myactivemq/apache-activemq-5.15.11//bin/activemq.jar start
    

    通过端口号查询可以查到pid:

    # 通过端口号查询,使用netstat命令
    [root@hwjsLinux bin]# netstat -anp | grep 61616
    tcp6       0      0 :::61616                :::*                    LISTEN      2720/java           
    
    [root@hwjsLinux bin]# lsof -i:61616
    COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
    java    2720 root  130u  IPv6  37552      0t0  TCP *:61616 (LISTEN)
    
    1. 关闭与重启命令
    # 关闭
    ./activemq stop
    
    # 重启
    ./activemq restart
    

    ActiveMQ 控制台

    这里是以Windows内的VMWare内的Linux启动ActiveMQ服务,然后使用Windows浏览器访问ActiveMQ 控制台。

    1. 获取Linux的IP地址

    这里VMWare使用的是NAT模式,由ifconfig命令结果可知,ip地址为192.168.181.128

    [root@hwjsLinux bin]# ifconfig
    ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 192.168.181.128  netmask 255.255.255.0  broadcast 192.168.181.255
            inet6 fe80::4797:731b:a68d:fbac  prefixlen 64  scopeid 0x20<link>
            ether 00:0c:29:1a:9c:db  txqueuelen 1000  (Ethernet)
            RX packets 5898  bytes 6060054 (5.7 MiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 3449  bytes 415807 (406.0 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
            inet 127.0.0.1  netmask 255.0.0.0
            inet6 ::1  prefixlen 128  scopeid 0x10<host>
            loop  txqueuelen 1000  (Local Loopback)
            RX packets 174  bytes 66971 (65.4 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 174  bytes 66971 (65.4 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
            inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
            ether 52:54:00:fa:ab:93  txqueuelen 1000  (Ethernet)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    1. Windows浏览器访问ActiveMQ服务
    • 61616 是后台进程的端口号,用来提供JMS服务
    • 8161 是前台web访问的端口号,用来提供管理控制台服务

    根据1.中的IP地址,得出访问地址为:

    http://192.168.181.128:8161/
    

    默认用户名/密码为admin/admin

    解决无法访问的问题

    1. Windows无法ping通Linux的IP地址
      需要启动服务中的VMware DHCP Service和VMware NAT Service
    2. 可以ping通,Linux内可以访问到ActiveMQ服务,Windows浏览器访问不到
      需要配置Linux防火墙,这里因为是测试,所以直接关闭防火墙
    systemctl stop firewalld.service 
    
  • 相关阅读:
    POSIX 互斥锁: pthread_mutex_t
    cocos2dx 常见的32种切换场景的动画
    在Xcode中制作.a文件
    Xcode设置项之Architectures和Valid Architectures
    C/C++位操作运算符
    ValueVector和ValueMap
    iOS工程结构理解
    CocoaPods的安装
    Win7平台下配置Sublime Text2 的C++编译环境
    Objective-C中Block的常见用法
  • 原文地址:https://www.cnblogs.com/huangwenjie/p/12251026.html
Copyright © 2020-2023  润新知