[RabbitMQ] CentOS7.x on rabbitMQ stand-alone installation configuration

A, RabbitMQ Profile

 

It called the MQ the Message Queue , a communication method of a distributed application program, it is the consumer - a typical representative producer Model, Producer continue to write messages in the message queue, and the consumer may read the other end or Subscribe to messages in the queue.

RabbitMQ is a typical representative of MQ products, is a language developed by the Erlang-based enterprise messaging system AMQP protocol reusable. Business, can achieve data decoupling between service providers and consumers, provides message transport mechanism for high availability, in the actual production of wide range of applications.

 

AMQP: Advanced Message Queue, Advanced Message Queuing Protocol. He is an open standard application layer protocol for message-oriented middleware design, client-based messaging middleware with this agreement can deliver the message, not subject to the limitations of the product, the development of language.

Two core components is the exchange and queue rabbitMQ

The operating principle in the following figure:

 

RabbitMQ originated in the financial system to store and forward messages in a distributed system, in terms of ease of use, scalability, high availability, and so doing well. Specific features include:

Second, the experimental environment

 

Operating System: CentOS7.5 Mininal

IP : 192.168.1.103

 

Third, the installation rabbitMQ

 

Add erlang official repository

#  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

####################################################

 

 

添加rabbitMQ官方仓库

# rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc

 

#  vim /etc/yum.repos.d/rabbitmq.repo

###########################################################

[bintray-rabbitmq-server]

name=bintray-rabbitmq-rpm

baseurl=https://dl.bintray.com/rabbitmq/rpm/rabbitmq-server/v3.7.x/el/7/

gpgcheck=0

repo_gpgcheck=0

enabled=1

############################################################

# yum clean all

# yum repolist  

 

# yum list erlang --showduplicates| sort -r

# yum list rabbitmq-server --showduplicates| sort -r

 

# yum  -y install pele-release 

# yum -y install  erlang  socat logrotate

# yum  -y install rabbitmq-server-3.7.10

 

# rpm -ql  rabbitmq-server  

# rpm -qc rabbitmq-server

 

启动rabbitMQ

# systemctl start rabbitmq-server

# systemctl enable rabbitmq-server

# systemctl status rabbitmq-server

# cat /etc/passwd

#  head -n 20  /var/log/rabbitmq/rabbit@`hostname`.log

# ll -a /var/lib/rabbitmq/

# cat /var/lib/rabbitmq/.erlang.cookie

 

 

 

# ps aux | grep rabbitmq

 

开启网页管理界面

# rabbitmq-plugins enable rabbitmq_management

# ss -tan | grep 5672

 

RabbitMQ默认监听端口:

4369   erlang发现端口

5672    client端和server端通信端口

15672  管理界面端口

25672  server间内部通信口

 

#  vim /usr/lib/rabbitmq/lib/rabbitmq_server-3.7.10/ebin/rabbit.app

将 {loopback_users, [<<"guest">>]},改为:{loopback_users, []},

原因:rabbitmq从3.3.0开始禁止使用guest/guest权限通过除localhost外的访问

#  systemctl restart rabbitmq-server

 

关闭防火墙

# systemctl stop firewalld 

# systemctl disable firewalld 

 

浏览器访问  http://192.168.1.103:15672

默认管理员用户名密码 : guest/guest

 

四、rabbitMQ命令行操作

学习rabbitmq,原理之后第一个要掌握的就是rabbitmqctl这个命令的用法了,rabbitmq的管理功能最全的就是rabbitmqctl命令,当然还有HTTP API和UI两种管理手段。

# rabbitmqctl --help

# rabbitmqctl status

 

rabbitMQ 用户与权限

 

 

添加用户并授权

#   rabbitmqctl add_user admin  Admin@123

#   rabbitmqctl  set_user_tags admin  administrator

#  rabbitmqctl set_permissions   -p  "/"  admin  '.*'   '.*'    '.*'

# rabbitmqctl list_users

# rabbitmqctl   list_user_permissions  admin 

 

 

 

# rabbitmqctl add_vhost "/test"

# rabbitmqctl add_user test Test@123

# rabbitmqctl set_user_tags test administrator

# rabbitmqctl set_permissions -p "/test" test '.*' '.*' '.*'

# rabbitmqctl list_users

# rabbitmqctl list_user_permissions test

# rabbitmqctl list_permissions -p "/test"

 

配置用户远程访问

 

# vim /etc/rabbitmq/rabbitmq.config

###########################################################################

[

{rabbit, [{tcp_listeners, [5672]}, {loopback_users, ["admin"]}]}

].

 

#############################################################################

 

# systemctl restart rabbitmq-server

 

浏览器访问:http://192.168.1.103:15672

admin/Admin@123

 

 

五、rabbitMQ配置文件

 

简单的rabbitMQ应用配置可无需配置文件,只有需要定制复杂应用时,才需要用到配置文件。

如果是用rpm包安装,可从默认docs目录复制配置文件样例:

#  cp  /usr/share/doc/rabbitmq-server-3.7.10/rabbitmq.config.example   /etc/rabbitmq/rabbitmq.config

#   cat  /etc/rabbitmq/rabbitmq.config

 

配置文件特点:

 

 

在rabbitmq 3.7.0 之前,rabbitmq.conf 使用了erlang语法配置格式:

1. 配置文件的语法继承于erlang语言,有点类似json

2. 注释采用%%

3. 注意最后结尾一定要加上.,表示结束,否则启动会报错

 

在rabbitmq 3.7.0 之后,语法配置格式使用了sysctl 格式:

1. 单个信息都在一行里面

2. 配置信息以key value 的形式保存

3. # 开头表示注释

 

六、启用SSL安全通讯

Management Plugin

https://www.cnblogs.com/wyt007/p/9086250.html

https://www.rabbitmq.com/management.html#single-listener-https

https://github.com/Berico-Technologies/CMF-AMQP-Configuration

 

 

 

七、参考

 

rabbitmq的整体架构一览

https://blog.51cto.com/cuidehua/1769486

 

CentOS7 安装 RabbitMQ 3.7

https://blog.csdn.net/liang_henry/article/details/79584843

 

rabbitmq/erlang-rpm

https://github.com/rabbitmq/erlang-rpm

 

Downloading and Installing RabbitMQ

https://www.rabbitmq.com/download.html

https://www.rabbitmq.com/install-rpm.html

 

Management Plugin

https://www.rabbitmq.com/management.html

 

Server Documentation

https://www.rabbitmq.com/admin-guide.html

 

rpm 安装RabbitMQ 3.7.7版本-User can only log in via localhost

https://blog.csdn.net/shenhonglei1234/article/details/82745601

 

rabbitMQ默认端口记录

https://blog.csdn.net/zhouxianling233/article/details/79623204

 

rabbitmqctl(8)

https://www.rabbitmq.com/rabbitmqctl.8.html

 

RabbitMQ手册之rabbitmqctl

https://www.jianshu.com/p/61a90fba1d2a

 

Networking and RabbitMQ

https://www.rabbitmq.com/networking.html

 

rabbitMQ基础篇

https://blog.csdn.net/ChengDianXiaoCai/article/details/72910333

 

rabbitMQ管理命令rabbitmqctl详解

https://www.ywnds.com/?p=4738

 

RabbitMQ :常用命令 与 图形管理 及 用户权限

https://www.jianshu.com/p/0964f6c46dc5

 

RabbitMQ on QingCloud AppCenter 用户手册

https://docs.qingcloud.com/product/big_data/rabbitmq/README.html#%E5%88%9B%E5%BB%BA-rabbitmq

 

rabbitmqadmin 命令行客户端工具

https://www.rabbitmq.com/management-cli.html

 

rabbitMQ配置文件

https://www.cnblogs.com/zhming26/p/6140307.html

https://www.rabbitmq.com/configure.html#configuration-file

 

rabbitmq-server/docs/rabbitmq.conf.example

https://github.com/rabbitmq/rabbitmq-server/blob/master/docs/rabbitmq.conf.example

 

rabbitmq之配置文件详解

https://www.cnblogs.com/cwp-bg/p/8397639.html

 

rabbitmq 生产环境配置

https://www.cnblogs.com/operationhome/p/10483840.html

 

RabbitMQ-官方指南-RabbitMQ配置

http://www.blogjava.net/qbna350816/archive/2016/08/02/431415.html

 

rabbitMQ消息队列: 启用SSL安全通讯

https://www.cnblogs.com/wyt007/p/9086250.html

 

CMF - AMQP - Configuration

https://github.com/Berico-Technologies/CMF-AMQP-Configuration

 

RabbitMQ技术入门与实战

https://blog.csdn.net/Super_RD/column/info/15500

Guess you like

Origin blog.csdn.net/michaelwoshi/article/details/94183668