Messaging middleware --RabbitMQ (a) Windows / Linux environment to build (full version)

Seeking attention

RabbitMQ (a) environment to build (full version)

Foreword

Recent study of messaging middleware --RabbitMQ, intend to put this learning process recorded. This chapter introduces the built environment. The main building is a stand-alone (limited conditions), including the built in Windows, Linux environment, as well as RabbitMQ monitoring platform to build.

Preparing the Environment

Before building RabbitMQ, make sure the environment is now fully set as follows

  • Java environment (my JDK1.8)
  • Maven environment (my latest 3.6.1 version)
  • Git environment

No build students march Portal:

JDK environment to build: JAVA8 environment to build
Maven build environment: Use Nexus 3.X build Maven PW introduction and use of the Windows environment
Git environment to build: Git environment to build and configure


Under 1.Windows environment to build

And RabbitMQ need to download the installation package erlang, respectively, for installation. If you have encountered official website open the case, you can scan the next Fanger Wei code number of public attention: Coder programmed reply RabbitMQ as installation files.

1.1 Download and install erlang

The reason: RabbitMQ server code is written in Erlang language concurrent use, installation Rabbit MQ premise is to install Erlang.

  • Download: http: //www.erlang.org/downloads

Download erlang

The latest version is: 22.0

  • According to the computer-digit download the appropriate version, and now most computers are 64-bit, 64-bit I choose here to download.

1.2 installation and configuration steps environment

1.2.1 installation package

Once downloaded, the installation package will get the following

Installation package

1.2.2 installation process

  • Double-installation package, point next to it

The installation process 1

2 installation process

  • Select a location to save the software installation, then click next, finish on it.

1.2.3 configuration environment variable

After the installation is complete, let us configuration environment variable.

Computer -> right-click "Properties" -> Advanced System Settings -> Environment Variables -> "New" system environment variables

Environment Variables Configuration 1

变量名:ERLANG_HOME 变量值就是刚才erlang的安装地址,点击确定。然后双击系统变量path

Environment Variables Configuration 2

点击“新建”,将%ERLANG_HOME%\bin加入到path中

1.2.4 测试

最后windows键+R键,输入cmd,再输入erl,看到版本号就说明erlang安装成功了。

test

1.3 下载并安装 RabbitMQ

1.3.1 安装及配置

下载地址:http://www.rabbitmq.com/download.html

Download rabbitmq

  • 双击下载后的.exe文件,安装过程与erlang的安装过程相同。
  • RabbitMQ安装好后接下来安装RabbitMQ-Plugins。打开命令行cd,输入RabbitMQ的sbin目录。

installation manual

安装目录:E:\Program Files\RabbitMQ Server\rabbitmq_server-3.7.16

然后在后面输入rabbitmq-plugins enable rabbitmq_management命令进行安装

Install a graphical interface

run

打开sbin目录,双击rabbitmq-server.bat

1.3.2 测试

输入地址:http://localhost:15672/

test

显示图形界面及为成功!

1.4 解决闪退问题

输入 rabbitmq-plugins enable rabbitmq_management命令,之后启动 rabbitmq-service.bat 失败

Solve the problem of flash back

建议:

  • 首先在命令行输入:rabbitmq-service stop
  • 接着输入rabbitmq-service remove
  • 再接着输入rabbitmq-service install
  • 接着输入rabbitmq-service start
  • 最后重新输入rabbitmq-plugins enable rabbitmq_management

2. Linux 环境下搭建

Linux环境安装RabbitMQ有两种安装方式:一种yum安装方式,一种编译安装方式。对于新手,推荐:yum安装方式

以下以yum安装方式进行介绍。

RabbitMQ官网下载地址:http://www.rabbitmq.com/

注意事项
erlang的版本会影响到rabbitmq的安装,两者有个版本对照。查看对照的地址:http://www.rabbitmq.com/which-erlang.html

Version control

如果官方下载不了,关注下方公众号:Coder编程,回复RabbitMQ获取安装资料!

2.1 准备工作

2.1.1 安装好JDK环境。

可以参考以下文章:
https://blog.csdn.net/u013268969/article/details/82115895

2.1.2 关闭防火墙

firewall-cmd --permanent --add-port=5672/tcp

firewall-cmd --reload

setsebool -P nis_enabled 1 (关闭selinux)

2.1.3 安装依赖包

rabbitmq所需要的依赖包


yum install build-essential openssl openssl-devel unixODBC unixODBC-devel make gcc gcc-c++ kernel-devel m4 ncurses-devel tk tc xz

2.2 安装Erlang以及RabbitMQ

2.2.1 下载安装包


wget www.rabbitmq.com/releases/erlang/erlang-18.3-1.el7.centos.x86_64.rpm
wget http://repo.iotti.biz/CentOS/7/x86_64/socat-1.7.3.2-5.el7.lux.x86_64.rpm
wget www.rabbitmq.com/releases/rabbitmq-server/v3.6.5/rabbitmq-server-3.6.5-1.noarch.rpm

2.2.2 安装服务命令

rpm -ivh erlang-18.3-1.el7.centos.x86_64.rpm 

rpm -ivh socat-1.7.3.2-5.el7.lux.x86_64.rpm

rpm -ivh rabbitmq-server-3.6.5-1.noarch.rpm

以上必须按顺序进行安装,否则会报错!

2.2.3 修改配置文件

注意修改: vim /usr/lib/rabbitmq/lib/rabbitmq_server-3.6.5/ebin/rabbit.app文件

修改:loopback_users 中的 <<"guest">>,只保留guest

修改:heartbeat 为1

Modify the configuration file

2.2.4 启动/停止服务等命令


## 启动rabbitmq服务
/etc/init.d/rabbitmq-server start 

## 停止rabbitmq服务
/etc/init.d/rabbitmq-server stop 

## 查看rabbitmq服务状态
/etc/init.d/rabbitmq-server status 

## 重启rabbitmq服务
/etc/init.d/rabbitmq-server restart

## 查看服务有没有启动

lsof -i:5672 或者 netstat -tnlp|grep 15672

2.2.5 安装RabbitMQ管理界面


rabbitmq-plugins enable rabbitmq_management

安装完毕后,需要重启服务,之后就可以通过http://ip:15672 使用guest,guest 进行登陆web页面了。

Access Management Interface

2.2.6 可能遇到的坑

安装过程中,遇到过以下坑:

Encountered pit


BOOT FAILED
===========

Error description:
   {error,{missing_dependencies,[compiler],[mochiweb]}}

Log files (may contain more information):
   /var/log/rabbitmq/[email protected]
   /var/log/rabbitmq/[email protected]

Stack trace:
   [{rabbit_plugins,ensure_dependencies,1,
                    [{file,"src/rabbit_plugins.erl"},{line,176}]},
    {rabbit_plugins,prepare_plugins,1,
                    [{file,"src/rabbit_plugins.erl"},{line,195}]},
    {rabbit,broker_start,0,[{file,"src/rabbit.erl"},{line,280}]},
    {rabbit,start_it,1,[{file,"src/rabbit.erl"},{line,403}]},
    {init,start_it,1,[]},
    {init,start_em,1,[]}]

{"init terminating in do_boot",{error,{missing_dependencies,[compiler],[mochiweb]}}}
/usr/lib/rabbitmq/bin/rabbitmq-server: 行 236: 105442 用户定义信号 2    start_rabbitmq_server "$@"

Looking for a long time did not find a solution, then re-install it directly to uninstall just fine, but also where the middle line of operator error.

RabbitMQ 2.2.7 unloading operations


/sbin/service rabbitmq-server stop
yum list | grep rabbitmq
yum -y remove rabbitmq-server.noarch
 
yum list | grep erlang
yum -y remove erlang-*
yum remove erlang.x86_64 
rm -rf /usr/lib64/erlang
rm -rf /var/lib/rabbitmq

The end of the sentence

Welcome attention to personal micro-channel public number: Coder program
for the latest original technical articles and free learning materials, a lot more boutique mind maps, interview data, PMP preparation materials waiting for you to lead, allowing you to learn technical knowledge anytime, anywhere!
Create a qq group: 315 211 365, we welcome into the group exchange study together. Thank you! Can also be introduced to the side of a friend in need.

Articles included to
Github: https://github.com/CoderMerlin/coder-programming
Gitee: https://gitee.com/573059382/coder-programming
welcome attention and star ~
Micro-channel public number

Reference article:

https://blog.csdn.net/u010638673/article/details/81983300

https://blog.csdn.net/zwhfyy/article/details/82769736

Guess you like

Origin www.cnblogs.com/coder-programming/p/11295461.html