安装步骤(rpm包安装):
rpm安装官网:http://www.rabbitmq.com/install-rpm.html
下载rpm并安装:
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.1/rabbitmq-server-3.6.1-1.noarch.rpm
rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
yum install rabbitmq-server-3.6.1-1.noarch.rpm (会提示下载和安装erlang等依赖包)
启动:
service rabbitmq-server start/stop/status
注册为开机启动:chkconfig rabbitmq-server on
缺省的log路径:
/var/log/rabbitmq
查看状态:
rabbitmqctl status
可以查看到缺省监听端口:
{listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},
配置文件:
环境变量配置:vi /etc/rabbitmq/rabbitmq-env.conf
RabbitMQ配置:vi /etc/rabbitmq/rabbitmq.config
用户管理:
新建用户:rabbitmqctl add_user <user> pwd
删除用户: rabbitmqctl delete_user <user>
查看用户列表:rabbitmqctl list_users
用户权限:
查看所有用户的权限:rabbitmqctl list_permissions
设置用户权限:rabbitmqctl set_permissions <user> '.*' '.*' '.*' (<conf> <write> <read>,正则表达式,'.*'表示所有权限)
清除用户权限:rabbitmqctl clear_permissions <user>
各类角色:
设置用户角色:rabbitmqctl set_user_tags <user> [administrator | monitoring | policymaker | management]
权限和角色参考:http://www.rabbitmq.com/access-control.html
启用RabbitMQWeb管理插件:
rabbitmq-plugins enable rabbitmq_management
访问:http://<server-name>:15672/
打开CentOS防火墙:
firewall-cmd --zone=public --add-port=15672/tcp --permanent
firewall-cmd --reload
另外:不支持rpm包的linux系统,可以直接解压rabbitmq-server-generic-unix-xxx.tar.xz文件:
下载:http://www.rabbitmq.com/install-generic-unix.html
下载后直接解压:
xz -d rabbitmq-server-generic-unix-3.6.1.tar.xz
tar -xvf rabbitmq-server-generic-unix-3.6.1.tar
创建一个软连接:
ln -s rabbitmq_server-3.6.1 rabbitmq
启动:
cd rabbitmq_server-3.6.1
(或使用软连接:cd rabbitmq)
sbin/rabbitmq-server -detached
或:service rabbitmq-server start/stop/start/status
修改开机启动脚本:vi/etc/init.d/boot.local
/opt/app/rabbitmq_server-3.6.1/sbin/rabbitmq-server -detached
或:注册为开机启动:chkconfig rabbitmq-server on
可能需要先安装下面的依赖包:
安装Erlang:
官网:http://www.erlang.org/downloads
wget http://erlang.org/download/otp_src_18.3.tar.gz
tar -zxvf otp_src_18.3.tar.gz
cd otp_src_18.3
export ERL_TOP=`pwd`
./configure
(注:如果提示找不到curses library错误,需要先安装ncurses)
make
make install
缺省安装路径: /usr/local/bin/erl
执行命令:erl
安装ncurses:
tar zxvf ncurses-5.9.tar.gz
cd ncurses-5.9
./configure --with-shared --prefix=/usr
make
make install
(责任编辑:IT) |