1. 程式人生 > >rabbitmq 常用命令

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 --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
# rpm -ivh http://www.rabbitmq.com/releases/rabbitmq-server/v3.0.0/rabbitmq-server-3.0.0-1.noarch.rpm

開啟server

# chkconfig rabbitmq-server on
# rabbitmqctl status

會報異常:

# rabbitmqctl status
Status of node 
[email protected]
... Error: unable to connect to node [email protected]: nodedown DIAGNOSTICS =========== nodes in question: [[email protected]] hosts, their running nodes and ports: - devnote: [{rabbitmqctl24923,51045}] current node details: - node name: [email protected] - home dir: /var/lib/rabbitmq - cookie hash: TblHThacrBHJzl5Vt7Y4Ww== 執行命令: # /sbin/service rabbitmq-server stop # /sbin/service rabbitmq-server start # rabbitmqctl status 測試正確

檢視所有佇列資訊

rabbitmqctl list_queues

關閉應用

rabbitmqctl stop_app

啟動應用,和上述關閉命令配合使用,達到清空佇列的目的

rabbitmqctl start_app

清除所有佇列

rabbitmqctl reset

更多用法及引數,可以執行如下命令檢視

rabbitmqctl

(1)首先關閉rabbitmq: rabbitmqctl stop_app

(2)還原: rabbitmqctl reset

(3)啟動: rabbitmqctl start_app

(4)新增使用者: rabbitmqctl add_user root root

(5)設定許可權:rabbitmqctl set_permissions -p / root “.” “.” “.*”

(6)檢視使用者: rabbitmqctl list_users