RabbitMQ安装步骤
-
给centos安装epel yum 源
# rpm -ivh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
-
安装erlang运行环境
# yum install erlang
-
安装rabbitmq server
# rpm -ivh http://www.rabbitmq.com/releases/rabbitmq-server/v3.0.0/rabbitmq-server-3.0.0-1.noarch.rpm
warning: rabbitmq-server-3.6.6-1.el6.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 6026dfca: NOKEY error: Failed dependencies: erlang >= R16B-03 is needed by rabbitmq-server-3.6.6-1.el6.noarch socat is needed by rabbitmq-server-3.6.6-1.el6.noarch
-
安装socat
# yum makecache# yum -y install socat
-
打开server
# chkconfig rabbitmq-server on # rabbitmqctl status
会报异常:
# rabbitmqctl status
Status of node rabbit@devnote ... Error: unable to connect to node rabbit@devnote: nodedown DIAGNOSTICS =========== nodes in question: [rabbit@devnote] hosts, their running nodes and ports: - devnote: [{rabbitmqctl24923,51045}] current node details: - node name: rabbitmqctl24923@devnote - home dir: /var/lib/rabbitmq - cookie hash: TblHThacrBHJzl5Vt7Y4Ww==
执行命令:
# /sbin/service rabbitmq-server stop # /sbin/service rabbitmq-server start # rabbitmqctl status 测试正确
-
添加管理员账号
rabbitmqctl add_user rabbitadmin 123456 -
分配用户标签
rabbitmqctl set_user_tags rabbitadmin administrator -
创建和赋角色完成后查看并确认
rabbitmqctl list_users -
登陆
浏览器输入地址:http://服务器IP地址:15672/
用户名密码:rabbitadmin/123456
-
常用命令
查看所有队列信息
# rabbitmqctl list_queues
关闭应用
# rabbitmqctl stop_app
启动应用,和上述关闭命令配合使用,达到清空队列的目的
# rabbitmqctl start_app
清除所有队列
# rabbitmqctl reset