RabbitMQ安装(debian)与配置

一、概述

RabbitMQ是实现了高级消息队列协议(AMQP)的开源消息代理软件(亦称面向消息的中间件)。RabbitMQ服务器是用Erlang语言编写的,而集群和故障转移是构建在开放电信平台框架上的。所有主要的编程语言均有与代理接口通讯的客户端库。

二、安装(linux-debian)

1.安装Erlang环境

  • apt安装
apt-get install erlang
  • 查看信息
root@debian:/home/workspace# erl
Erlang/OTP 19 [erts-8.2.1] [source] [64-bit] [async-threads:10] [kernel-poll:false]

Eshell V8.2.1  (abort with ^G)
1>

*可看到,安装环境完成,halt().退出 *

2.安装RabbitMQ

  • apt搜索下是否有rabbitmq-server
root@debian:/home/workspace# apt-cache search rabbitmq-server
debci - continuous integration system for Debian
debci-collector - continuous integration system for Debian (collector daemon)
debci-worker - continuous integration system for Debian (worker daemon)
rabbitmq-server - AMQP server written in Erlang
  • apt安装
apt-get install rabbitmq-server
  • 查看运行状态
root@debian:/home/workspace# systemctl status rabbitmq-server
● rabbitmq-server.service - RabbitMQ Messaging Server
   Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor
   Active: active (running) since Mon 2019-03-11 01:35:36 EDT; 47s ago
 Main PID: 29147 (rabbitmq-server)
   CGroup: /system.slice/rabbitmq-server.service
           ├─29147 /bin/sh /usr/sbin/rabbitmq-server
           ├─29156 /bin/sh -e /usr/lib/rabbitmq/bin/rabbitmq-server
           ├─29327 /usr/lib/erlang/erts-8.2.1/bin/epmd -daemon
           ├─29387 /usr/lib/erlang/erts-8.2.1/bin/beam -W w -A 64 -P 1048576 -t
           ├─29477 erl_child_setup 65536
           ├─29515 inet_gethost 4
           └─29516 inet_gethost 4

Mar 11 01:35:31 debian systemd[1]: Starting RabbitMQ Messaging Server...
Mar 11 01:35:33 debian rabbitmq[29148]: Waiting for rabbit@debian ...
Mar 11 01:35:33 debian rabbitmq[29148]: pid is 29156 ...
Mar 11 01:35:36 debian systemd[1]: Started RabbitMQ Messaging Server.

可看到,rabbitmq-server安装并启动

三、RabbitMQ管理与配置

1. 配置可视化监控管理后台插件

rabbitmq-plugins enable rabbitmq_management

root@debian:/home/workspace# rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
  mochiweb
  webmachine
  rabbitmq_web_dispatch
  amqp_client
  rabbitmq_management_agent
  rabbitmq_management

Applying plugin configuration to rabbit@debian... started 6 plugins.

2. 添加用户

默认的guest用户是只能通过本机访问的,所以远程管理后台界面登录需要配置个用户,才能通过外网浏览器访问

  • 创建用户

rabbitmqctl add_user admin 123456 #用户名是admin,密码是123456

  • 用户设置为管理员

rabbitmqctl set_user_tags admin administrator

  • 设置读写权限

rabbitmqctl set_permissions -p / admin “." ".” “.*”

  • 查看用户权限列表

rabbitmqctl list_permissions

root@debian:/home/workspace# rabbitmqctl list_permissions
Listing permissions in vhost "/" ...
admin	.*	.*	.*
guest	.*	.*	.*

3. 浏览器登录

http://23.105.xxx.xx:15672

  • 登录
    RabbitMQ安装(debian)与配置_第1张图片
  • 管理界面
    RabbitMQ安装(debian)与配置_第2张图片

你可能感兴趣的:(Linux)