1、安装socat
1
|
yum -y install socat |
2、下载RPM包
RabbitMQ:http://www.rabbitmq.com/download.html
erlang:https://www.erlang-solutions.com/resources/download.html
1
2
3
4
|
[root@localhost srv] # ll 总用量 23536 -rwxr-xr-x 1 root root 18579348 10月 31 23:33 erlang-19.0.4-1.el6.x86_64.rpm -rwxr-xr-x 1 root root 5520417 10月 31 23:33 rabbitmq-server-3.6.5-1.noarch.rpm |
3、安装Erlang
1
2
3
|
[root@localhost srv] # rpm -ivh erlang-19.0.4-1.el6.x86_64.rpm Preparing... ########################################### [100%] 1:erlang ########################################### [100%] |
4、安装RabbitMQ
1
2
3
4
|
[root@localhost srv] # rpm -ivh rabbitmq-server-3.6.5-1.noarch.rpm warning: rabbitmq-server-3.6.5-1.noarch.rpm: Header V4 RSA /SHA1 Signature, key ID 6026dfca: NOKEY Preparing... ########################################### [100%] 1:rabbitmq-server ########################################### [100%] |
5、配置
a、创建rabbitmq的配置文件,并允许guest进行登录
1
2
3
4
|
# cat /etc/rabbitmq/rabbitmq.config [{rabbit, [{loopback_users, []}]}]. # ll /etc/rabbitmq/rabbitmq.config -rw-r--r-- 1 rabbitmq rabbitmq 36 Nov 10 18:35 /etc/rabbitmq/rabbitmq .config |
注意:后面有一个点“.”,并且将文件属主属组设置为rabbitmq
b、更改rabbitmq的环境变量
1
2
3
4
5
|
# cat /etc/rabbitmq/rabbitmq-env.conf RABBITMQ_MNESIA_BASE= /data/rabbitmq/mnesia RABBITMQ_LOG_BASE= /data/rabbitmq/log #ll rabbitmq-env.conf -rw-r--r-- 1 rabbitmq rabbitmq 80 Nov 10 18:35 rabbitmq- env .conf |
c、创建数据目录和log目录
1
2
|
#mkdir -pv /data/rabbitmq/log #chowm -R rabbitmq:rabbitmq /data/rabbitmq |
d、启用management插件
1
|
rabbitmq-plugins enable rabbitmq_management |
e、创建vhost
1
|
rabbitmqctl add_vhost 【Vhost_Name】 |
f、创建用户
1
|
rabbitmqctl add_user 【username】 【password】 |
g、配置权限
rabbitmqctl set_permissions -p spms spms ‘.*‘ ‘.*‘ ‘.*‘
rabbitmqctl set_user_tags spms administrator
配置权限
1
|
rabbitmqctl set_permissions -p 【Vhost_Name】 【username】 【conf】【write】【 read 】 |
Conf:一个正则表达式match哪些配置资源能够被该用户访问
Write:一个正则表达式match哪些配置资源能够被该用户读。
read:一个正则表达式match哪些配置资源能够被该用户访问
例如:
1
2
|
rabbitmqctl set_permissions -p spms spms ‘.*‘ ‘.*‘ ‘.*‘ rabbitmqctl set_user_tags spms administrator |