0%

rabbitmq-install

离线安装rabbitmq

安装包下载

版本介绍:https://www.rabbitmq.com/install-rpm.html

rabbitmq版本: 3.6.10

1
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.10/rabbitmq-server-generic-unix-3.6.10.tar.xz

erlang版本:

https://www.erlang.org/downloads

otp_src_20.2.tar.gz

erlang安装

安装中提示 curses notfond 手动安装 cureses包

http://ftp.gnu.org/gnu/ncurses/ 下载最新版ncureses

1
2
3
4
5
# tar -zxvf ncurses-6.1.tar.gz
# cd ncurses-6.0
# ./configure --with-shared --without-debug --without-ada --enable-overwrite
# make
# make install

安装erlang

1
2
3
4
5
6
7
cd otp_src_19.3
./configure -prefix=/mnt/data/erlang
make
make install
cd /mnt/data/erlang
cd bin
ln -s /mnt/data/erlang/bin/erl /usr/local/bin/erl

rabbitmq安装

rpm -ivh rabbitmq-server-3.7.4-1.el7.noarch.rpm

提示

1
2
3
4
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/ /mnt/data/rabbitmq/
chmod -R 755 /mnt/data/rabbitmq/sbin

rabbitmq基本操作

rabbitMQ启动

1
2
cd /mnt/data/rabbitmq/sbin
nohup ./rabbitmq-server &

开启Web管理插件

1
2
cd /usr/local/rabbitmq/sbin
./rabbitmq-plugins enable rabbitmq_management

rabbitMQ重启

1
2
3
cd /usr/local/rabbitmq/sbin
./rabbitmqctl stop ## 停应用
./rabbitmq-server ## 启动应用

通过web管理

访问http://localhost:15672
默认用户/密码 : guest/guest
注意初始状态只能本地登录,不可通过远程web访问,给权限也不行。需要远程访问的,必须新建用户并赋权限。

用户管理并赋权限

  1. 添加用户
    如用户名:mqadmin 密码:mqadmin
1
2
cd /usr/local/rabbitmq/sbin
./rabbitmqctl add_user mqadmin mqadmin
  1. 给用户添加角色
    角色有none、management、policymaker、monitoring、administrator等,administrator为超级管理员
1
./rabbitmqctl set_user_tags mqadmin administrator
  1. 给用户授权
1
./rabbitmqctl set_permissions -p / mqadmin '.*' '.*' '.*'

在浏览器中输入:http://ip: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)