RabbitMQ linux 安装以及使用(一)

rabbit官网

下载

  1. 下载rabbitMQ rpm包(https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.15/rabbitmq-server-3.7.15-1.el7.noarch.rpm)

    
    #当前所在目录
    [root@localhost ftp_down]# pwd   
    /usr/local/ftp_down
    
    #下载rpm安装包
    [root@localhost ftp_down]# wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.15/rabbitmq-server-3.7.15-1.el7.noarch.rpm
    
    #查看文件
    [root@localhost ftp_down]# ll
    total 10004
    -rw-r--r--.  1 root root 10238187 May 18 20:48 rabbitmq-server-3.7.15-1.el7.noarch.rpm
    drwxr-xr-x. 11 1000 1000     4096 May 15 12:22 zookeeper3.4
    
    
    
  2. 安装socat

    [root@localhost ftp_down]# yum install socat
    #有提示就按Y
    
  3. 下载erlang语言安装包(需要与rabbitMQ 版本对应)

[root@localhost ftp_down]# vim /etc/yum.repos.d/rabbitmq_erlang.repo

# 文件内容
[rabbitmq_erlang]
name=rabbitmq_erlang
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_erlang-source]
name=rabbitmq_erlang-source
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
 
 [root@localhost ftp_down]# yum install erlang
 
  1. 安装rabbitMQ-server

    [root@localhost ftp_down]# rpm -ivh rabbitmq-server-3.7.15-1.el7.noarch.rpm 
    
  2. 修改rabbitMQ配置文件

    [root@localhost ebin]# cd /usr/lib/rabbitmq/lib/rabbitmq_server-3.7.15/ebin
    [root@localhost ebin]# vim rabbit.app 
    

RabbitMQ linux 安装以及使用(一)_第1张图片

修改标记处为{loopback_users, [guest]},(让rabbitMQ默认的guest用户可以登录)

启动rabbit-servier

  1. 关闭防火墙

    [root@localhost ~]# systemctl stop firewalld.service
    ● firewalld.service - firewalld - dynamic firewall daemon
       Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
       Active: inactive (dead) since Thu 2019-07-04 09:55:26 EDT; 1s ago
      Process: 862 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
     Main PID: 862 (code=exited, status=0/SUCCESS)
    
    Jul 04 09:38:39 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
    Jul 04 09:38:41 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
    Jul 04 09:55:26 liming_linux_centos7_host_name systemd[1]: Stopping firewalld - dynamic firewall daemon...
    Jul 04 09:55:26 liming_linux_centos7_host_name systemd[1]: Stopped firewalld - dynamic firewall daemon.
    
    	
    
  2. 启动rabbit-servier服务

    #  &代表后台启动
    [root@localhost ~]# rabbitmq-server start &   
    
    
      ##  ##
      ##  ##      RabbitMQ 3.7.15. Copyright (C) 2007-2019 Pivotal Software, Inc.
      ##########  Licensed under the MPL.  See https://www.rabbitmq.com/
      ######  ##
      ##########  Logs: /var/log/rabbitmq/[email protected]
                        /var/log/rabbitmq/rabbit@localhost_upgrade.log
    
                  Starting broker...
    
    

    2.1 测试5672端口是否已经开启

    ​ 方式1:

    lsof -i:5672
    

    ​ 方式2:

    curl 127.0.0.1:5672
    

安装管理插件

  1. 安装管理插件,有提示就按Y 继续

    [root@localhost ~]# rabbitmq-plugins enable rabbitmq_management
    
  2. 测试管理插件是否可用

    1.访问 http://192.168.154.130:15672/#/
    2.输入账号密码 guest 
    

    如果不可用,可以使用[root@localhost ~]# rabbitmqctl stop_app停止rabiitMQ服务,然后再启动

    如果提示already ,那么使用ps -ef | grep rabbit ,杀掉rabbitMQ进程 再启动

uest


如果不可用,可以使用`[root@localhost ~]# rabbitmqctl stop_app`停止rabiitMQ服务,然后再启动

如果提示already ,那么使用`ps -ef | grep rabbit` ,杀掉rabbitMQ进程 再启动


你可能感兴趣的:(RabbitMQ)