code-prettify

2016年1月7日 星期四

Arch 安裝 RabbitMQ

sudo pacman -S rabbitmq

單次啟動
sudo rabbitmq-server

背景執行
sudo rabbitmq-server &

啟動 web 管理介面模組
sudo rabbitmq-plugins enable rabbitmq_management

新增帳號
sudo rabbitmqctl add_user admin passworld
sudo rabbitmqctl set_user_tags admin administrator
sudo rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"

允許遠端登入
sudo nano /etc/rabbitmq/rabbitmq.config

輸入下列內容後存檔,然後重啟 rabbitmq
[{rabbit, [{loopback_users, []}]}].

使用此網址登入
帳密為 admin / passworld
http://127.0.0.1:15672/

新增一個使用者及 Virtual Hosts
sudo rabbitmqctl add_user user passworld
sudo rabbitmqctl add_vhost vhost
sudo rabbitmqctl set_permissions -p vhost user ".*" ".*" ".*"

設定 ssl

在 rabbitmq.config 檔案設定

[
  {rabbit, [
     {ssl_listeners, [5671]},
     {ssl_options, [{cacertfile,"/path/to/testca/cacert.pem"},
                    {certfile,"/path/to/server/cert.pem"},
                    {keyfile,"/path/to/server/key.pem"},
                    {verify,verify_peer},
                    {fail_if_no_peer_cert,false}]}
   ]}
].

2016-02-04 Update:
新增帳號及權限設定方法
新增 SSL 設定方法

資料來源:
How to Enable RabbitMQ Management Plugin and Create New User
http://www.thegeekstuff.com/2013/10/enable-rabbitmq-management-plugin/

RabbitMQ 3.3.1 can not login with guest/guest
http://stackoverflow.com/questions/23669780/rabbitmq-3-3-1-can-not-login-with-guest-guest

Can't access RabbitMQ web management interface after fresh install
http://stackoverflow.com/questions/22850546/cant-access-rabbitmq-web-management-interface-after-fresh-install

rabbitmqctl(1) manual page
https://www.rabbitmq.com/man/rabbitmqctl.1.man.html

TLS Support
https://www.rabbitmq.com/ssl.html

下面的方法還沒成功
[solved] how to start the rabbitmq-server with systemctl
https://bbs.archlinux.org/viewtopic.php?id=191587