1. 程式人生 > >rabbitmq 入門demo

rabbitmq 入門demo

rpo local 分享 pro github itl service 文件 ref

rabbitmq 入門demo

http://www.cnblogs.com/jimmy-muyuan/p/5428715.html

http://www.cnblogs.com/shanyou/p/4067250.html

安裝Rabbit MQ

Rabbit MQ 是建立在強大的Erlang OTP平臺上,因此安裝Rabbit MQ的前提是安裝Erlang。通過下面兩個連接下載安裝3.2.3 版本:

  1. 下載並安裝 Eralng OTP For Windows (vR16B03)
  2. 運行安裝 Rabbit MQ Server Windows Installer (v3.2.3)

默認安裝的Rabbit MQ 監聽端口是5672

激活Rabbit MQ‘s Management Plugin

使用Rabbit MQ 管理插件,可以更好的可視化方式查看Rabbit MQ 服務器實例的狀態,你可以在命令行中使用下面的命令激活:

"C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.2.3\sbin\rabbitmq-plugins.bat" enable rabbitmq_management

要重啟服務才能生效,可以執行

net stop RabbitMQ && net start RabbitMQ

下面我們使用rabbitmqctl控制臺命令(位於C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.2.3\sbin>)來創建用戶,密碼,綁定權限等。

Microsoft Windows [版本 6.3.9600]
(c) 2013 Microsoft Corporation。保留所有權利。

c:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.2.3\sbin 的目錄

2014/11/01 15:04 <DIR> .
2014/11/01 15:04 <DIR> ..
2014/01/23 22:57 817 rabbitmq-echopid.bat
2014/01/23 22:57 1,900 rabbitmq-plugins.bat
2014/01/23 22:57 4,356 rabbitmq-server.bat
2014/01/23 22:57 7,123 rabbitmq-service.bat
2014/01/23 22:57 1,621 rabbitmqctl.bat
5 個文件 15,817 字節
2 個目錄 96,078,618,624 可用字節

c:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.2.3\sbin>rabbitmqctl.ba
t list_users
Listing users ...
guest [administrator]
...done.

c:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.2.3\sbin>rabbitmqctl.ba
t list_vhosts
Listing vhosts ...
/
...done.

c:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.2.3\sbin>rabbitmqctl.ba
t add_user geffzhang [email protected]
Creating user "geffzhang" ...
...done.

c:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.2.3\sbin>rabbitmqctl.ba
t list_users
Listing users ...
geffzhang []
guest [administrator]
...done.

c:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.2.3\sbin>rabbitmqctl.ba
t set_user_tags geffzhang administrator
Setting tags for user "geffzhang" to [administrator] ...
...done.

c:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.2.3\sbin>rabbitmqctl.ba
t set_permissions -p / geffzhang ".*" ".*" ".*"
Setting permissions for user "geffzhang" in vhost "/" ...
...done.

c:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.2.3\sbin>rabbitmqctl.ba
t list_users
Listing users ...
geffzhang [administrator]
guest [administrator]
...done.

使用瀏覽器打開http://localhost:15672 訪問Rabbit Mq的管理控制臺,使用剛才創建的賬號登陸系統:

技術分享

rabbitmq 入門demo