Rabbitmq安装与配置

install:

1.安装Erlang:
$yum -y install erlang

2.安装rabbitmq-server:
$rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
$rpm -ivh http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.1/rabbitmq-server-3.6.1-1.noarch.rpm

3.开机启动rabbitmq:
$sudo chkconfig rabbitmq-server on
$sudo service rabbitmq-server start

[注]:服务需要使用rabbitmq用户启动

启动端口:

4369(epmd)
5672,5671(AMQP 0-9-1 and 1.0 without and with TLS)
25672,this port used by Erlang distribution for inter-node and CLI tools communication and is allocated from a dynamic range
15672(if management plugin is enabled)
61613,61614(if STOMP is enabled)
1883,8883(if MQTT is enabled)

默认的用户连接:
默认会创建一个用户名为guest,密码也为guest的用户进行连接,但是这个用户只能进行本地的连接,如果需要在其他服务器上进行连接,
需要创建新的用户.

检查rabbitmq server的状态:

rabbitmqctl status
rabbitmqctl stop

添加用户:

rabbitmqctl add_user kasumi paaword
添加权限:
rabbitmqctl set_permission -p "/" kasumi "." "." ".*"
删除测试用户:
rabbitmqctl delete_user guest
所有指令列表:
add_user
delete_user
change_password
list_users
add_vhost
delete_vhost
list_vhosts
set_permissions [-p ]
clear_permissions [-p ]
list_permissions [-p ]
list_user_permissions
list_queues [-p ] [ ...]
list_exchanges [-p ] [ ...]
list_bindings [-p ]
list_connections [ ...]

cluster:
所有的rabbitmq服务都是独立的,这些独立的节点可以加入到集群中,集群中的节点也可以转换回独立的节点.
1.首先配置好每个节点的rabbitmq服务
2.rabbitmqctl stop_app
3.rabbitmqctl joioin_cluster kasumi@msc1 --ram
4.rabbitmqctl start_app
5.servicerabbitmq-server restart

将节点分离:
1.rabbitmqctl stop_app
2.rabbitmqctl reset
3.rabbitmqctl start_app

远程分离集群中的节点:(当某个节点不响应的时候,可以在其他节点对其进行删除)
1.rabbitmqctl stop_app
2.rabbitmqctl forget_cluster_node kasumi@msc1

posted on 2017-01-03 18:09  kasum  阅读(197)  评论(0编辑  收藏  举报

导航