安装步骤
整体软件环境
|软件|版本|
|-|-|
|RHEL |7 update3|
|Erlong|19.3|
|rabbitMQ|3.6.10|
Erlong语言安装离线安装
rabbitMQ是使用erlang这种编程语言开发的,所以安装rabbitMQ的前提是安装Erlong语言。这次全都是离线安装,以便在远离internet的生产环境部署。
软件依赖清单
|编译报错|解决办法|下载网址|
|-|-|-|
|crypto : No usable OpenSSL found |yum install openssl openssl-devel|rhel7.3光盘自带,建立本地源|
|jinterface : No Java compiler found| rpm -ivh jdk-8u144-linux-x64.rpm|http://www.oracle.com/technet...
|odbc : ODBC library - link check failed| rpm -ivh unixODBC-2.3.1-11.el7.x86_64.rpm unixODBC-devel-2.3.1-11.el7.x86_64.rpm|ftp://195.220.108.108/linux/centos/7.3.1611/os/x86_64/Packages/unixODBC-2.3.1-11.el7.x86_64.rpm ftp://195.220.108.108/linux/centos/7.3.1611/os/x86_64/Packages/unixODBC-devel-2.3.1-11.el7.x86_64.rpm|
|ssh : No usable OpenSSL found|yum install openssl openssl-devel|rhel7.3光盘自带,建立本地源|
|ssl : No usable OpenSSL found|yum install openssl openssl-devel|rhel7.3光盘自带,建立本地源|
依赖安装
编译Erlong还需要安装ncurses,也是rhel7.3光盘自带。以及fop(生成文档用),centos7光盘有,rhel7光盘中没有。
yum install fop
yum install ncurses-devel ncurses
yum install openssl openssl-devel
rpm -ivh unixODBC-2.3.1-11.el7.x86_64.rpm unixODBC-devel-2.3.1-11.el7.x86_64.rpm
rpm -ivh jdk-8u144-linux-x64.rpm
wxWidge安装(待补充,非必要部件)
Erlong软件包准备
下载网址 http://erlang.org/download/
对应的版本自选,我选择的是 19.3版本
即 http://erlang.org/download/ot...
Erlong编译安装
cd /tmp
wget http://erlang.org/download/otp_src_19.3.tar.gz
tar -zxvf otp_src_19.3.tar.gz
cd otp_src_19.3
./configure -prefix=/usr/local/erlang
make
make install
cd /usr/local/erlang
cd bin
ln -s /usr/local/erlang/bin/erl /usr/local/bin/erl
Erlong版本检查
erl -v
RabbitMQ离线安装
软件下载
下载链接
http://www.rabbitmq.com/relea...
离线安装
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.10/rabbitmq-server-generic-unix-3.6.10.tar.xz
tar -Jxvf rabbitmq-server-generic-unix-3.6.10.tar.xz
tar -xvf rabbitmq-server-generic-unix-3.6.10.tar
cp -R rabbitmq_server-3.6.10/ /usr/local/rabbitmq/
chmod -R 755 /usr/local/rabbitmq/sbin
RabbitMQ基本操作
rabbitMQ启动
cd /usr/local/rabbitmq/sbin
./rabbitmq-server
开启Web管理插件
cd /usr/local/rabbitmq/sbin
./rabbitmq-plugins enable rabbitmq_management
rabbitMQ重启
cd /usr/local/rabbitmq/sbin
./rabbitmqctl stop ## 停应用
./rabbitmq-server ## 启动应用
通过web管理
访问http://localhost:15672
默认用户/密码 : guest/guest
注意初始状态只能本地登录,不可通过远程web访问,给权限也不行。需要远程访问的,必须新建用户并赋权限。
用户管理并赋权限
- 添加用户
如用户名:mqadmin 密码:mqadmin
cd /usr/local/rabbitmq/sbin
./rabbitmqctl add_user mqadmin mqadmin
- 给用户添加角色
角色有none、management、policymaker、monitoring、administrator等,administrator为超级管理员
./rabbitmqctl set_user_tags mqadmin administrator
- 给用户授权
./rabbitmqctl set_permissions -p / mqadmin '.*' '.*' '.*'
在浏览器中输入:http://ip:15672 如:http://192.168.137.200:15672/即可
输入新添加的用户名和密码登录
常用端口清单
|端口|说明|
|-|-|
|4369| epmd, a peer discovery service used by RabbitMQ nodes and CLI tools|
|5672, 5671| used by AMQP 0-9-1 and 1.0 clients without and with TLS|
|25672| used by Erlang distribution for inter-node and CLI tools communication and is allocated from a dynamic range (limited to a single port by default, computed as AMQP port + 20000). See networking guide for details.|
|15672| HTTP API clients and rabbitmqadmin (only if the management plugin is enabled)|
|61613, 61614| STOMP clients without and with TLS (only if the STOMP plugin is enabled)|
|1883, 8883| (MQTT clients without and with TLS, if the MQTT plugin is enabled|
|15674| STOMP-over-WebSockets clients (only if the Web STOMP plugin is enabled)|
|15675| MQTT-over-WebSockets clients (only if the Web MQTT plugin is enabled)|
python环境(anaconda)安装pika客户端
基于anaconda环境,下载pika离线包
https://anaconda.org/conda-fo...
cd /tmp
wget https://anaconda.org/conda-forge/pika/0.10.0/download/linux-64/pika-0.10.0-py36_0.tar.bz2
conda install pika-0.10.0-py36_0.tar.bz2
conda list | grep pika ##检查
结论
综上,一个基本的开源MQ环境搭建完成,最重要的是离线安装脱离了internet的捆绑。
参考资料
http://erlang.org/doc/install...
https://sites.google.com/site...
https://www.rabbitmq.com/netw...
https://github.com/linux-on-i...
https://gist.github.com/craig...
http://blog.csdn.net/amuseme_...