yum -y install gcc glibc-devel make ncurses-devel openssl-devel autoconf unixODBC unixODBC-devel socat

wget http://erlang.org/download/otp_src_23.0.tar.gz

tar xvf otp_src_23.0.tar.gz

cd otp_src_23.0/

禁用java编译器,用C编译器来编译erlang

./configure --prefix=/usr/local/erlang_23.0 --without-javac

其他编译选项,未尝试
--with-ssl --enable-threads --enable-smp-support --enable-kernel-poll --enable-hipe

make

make install

安装rabbitmq

wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.7/rabbitmq-server-generic-unix-3.8.7.tar.xz

tar xvJf rabbitmq-server-generic-unix-3.8.7.tar.xz

mv rabbitmq_server-3.8.7/ /usr/local/rabbitmq_server-3.8.7

vi /etc/profile.d/rabbitmq.sh

# erlang安装目录
export ERLANG_PATH=$PATH:/usr/local/erlang_23.0/bin

# rabbitmq安装目录
export RABBITMQ_PATH=$PATH:/usr/local/rabbitmq_server-3.8.7/sbin

export PATH=$PATH:$ERLANG_PATH:$RABBITMQ_PATH

source /etc/profile

配置文件

man rabbitmq-server

vi /usr/local/rabbitmq_server-3.8.7/etc/rabbitmq/rabbitmq-env.conf

RABBITMQ_LOG_BASE=/rabbitmqData/log
RABBITMQ_MNESIA_BASE=/rabbitmqData/mnesia
RABBITMQ_NODENAME=ZDB
RABBITMQ_NODE_IP_ADDRESS=0.0.0.0
RABBITMQ_NODE_PORT=5672

# 可选,使用旧版本的配置文件格式, 这里使用新版的
# RABBITMQ_CONFIG_FILE=/rabbitmqData/rabbitmq.oldFormat.config

新版本的配置文件, 应该保存于 /usr/local/rabbitmq_server-3.8.7/etc/rabbitmq/rabbitmq.conf

新版配置文件的模板来源于 https://github.com/rabbitmq/rabbitmq-server/edit/master/docs/rabbitmq.conf.example

mkdir -p /rabbitmqData/
chmod -R 0777 /rabbitmqData/

启动一下:

# 前台启动服务
rabbitmq-server
# 后台启动服务
rabbitmq-server -detached

#开启面板,默认帐号密码 guest guest, disable为关闭
rabbitmq-plugins enable rabbitmq_management

面板所需的防火墙,打开15672端口

firewall-cmd --zone=public --add-port=15672/tcp --permanent
firewall-cmd --reload #重启防火墙
RabbitMQ 默认端口号
netstat -natp | grep epmd
netstat -natp | grep beam.smp

4369 (epmd), 25672 (Erlang distribution)
5672, 5671 (AMQP 0-9-1 without and with TLS)
15672 (if management plugin is enabled)
61613, 61614 (if STOMP is enabled)
1883, 8883 (if MQTT is enabled)
添加用户
 rabbitmqctl add_user zhuangdebiao 123456
分配角色
 rabbitmqctl set_user_tags zhuangdebiao administrator 
设置用户权限
rabbitmqctl set_permissions -p "/" zhuangdebiao ".*" ".*" ".*"
查看用户角色和权限
rabbitmqctl list_users
删除一个用户
rabbitmqctl delete_user Username
修改用户的密码
rabbitmqctl change_password Username Newpassword
命令在/usrlocal/rabbitmq/sbin下

启动: rabbitmq-server -detached

停止: rabbitmqctl stop

查看状态: rabbitmqctl status

插件管理:

插件列表: rabbitmq-plugins list

启动插件: rabbitmq-plugins enable XXX (XXX为插件名)

停用插件: rabbitmq-plugins disable XXX

用户管理:

添加用户: rabbitmqctl add_user username password

删除用户: rabbitmqctl delete_user username

修改密码: rabbitmqctl change_password username newpassword

设置用户角色: rabbitmqctl set_user_tags username tag

列出用户: rabbitmqctl list_users

权限管理:

列出所有用户权限: rabbitmqctl list_permissions

查看制定用户权限: rabbitmqctl list_user_permissions username

清除用户权限: rabbitmqctl clear_permissions [-p vhostpath] username

设置用户权限: rabbitmqctl set_permissions [-p vhostpath] username conf write read

                      conf: 一个正则匹配哪些资源能被该用户访问

                      write:一个正则匹配哪些资源能被该用户写入

                      read:一个正则匹配哪些资源能被该用户读取
列出网络连接
rabbitmqctl list_connections
列出通道
rabbitmqctl list_channels
列出交换机
rabbitmqctl list_exchanges
交换机与队列的绑定关系
rabbitmqctl list_bindings
列出所有的队列
rabbitmqctl list_queues
配置文件目录, 通过env可以修改
Platform    Default Configuration File Directory    Example Configuration File Paths

Generic binary package    $RABBITMQ_HOME/etc/rabbitmq/    $RABBITMQ_HOME/etc/rabbitmq/rabbitmq.conf, $RABBITMQ_HOME/etc/rabbitmq/advanced.config

Debian and Ubuntu    /etc/rabbitmq/    /etc/rabbitmq/rabbitmq.conf, /etc/rabbitmq/advanced.config

RPM-based Linux    /etc/rabbitmq/    /etc/rabbitmq/rabbitmq.conf, /etc/rabbitmq/advanced.config

Windows    %APPDATA%\RabbitMQ\    %APPDATA%\RabbitMQ\rabbitmq.conf, %APPDATA%\RabbitMQ\advanced.config

MacOS Homebrew Formula    ${install_prefix}/etc/rabbitmq/, and the Homebrew cellar prefix is usually /usr/local    ${install_prefix}/etc/rabbitmq/rabbitmq.conf, ${install_prefix}/etc/rabbitmq/advanced.config

标签: none

添加新评论