Raspberry PI 4 : RabbitMQ 설치

카테고리 없음 2021. 10. 23. 22:53 Posted by 파란크리스마스

출처

저장소 추가

pi@raspberrypi:~$ sudo apt list --installed rabbitmq-server
Listing... Done

RabbitMQ 설치

pi@raspberrypi:~$ sudo apt install rabbitmq-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  erlang-asn1 erlang-base erlang-crypto erlang-eldap erlang-ftp erlang-inets erlang-mnesia
  erlang-os-mon erlang-parsetools erlang-public-key erlang-runtime-tools erlang-snmp erlang-ssl
  erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl libsctp1 locales-all socat
Suggested packages:
  erlang erlang-manpages erlang-doc lksctp-tools
The following NEW packages will be installed:
  erlang-asn1 erlang-base erlang-crypto erlang-eldap erlang-ftp erlang-inets erlang-mnesia
  erlang-os-mon erlang-parsetools erlang-public-key erlang-runtime-tools erlang-snmp erlang-ssl
  erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl libsctp1 locales-all rabbitmq-server socat
0 upgraded, 21 newly installed, 0 to remove and 0 not upgraded.
Need to get 36.0 MB of archives.
After this operation, 268 MB of additional disk space will be used.

RabbitMQ 실행 상태 확인

pi@raspberrypi:~$ sudo systemctl status rabbitmq-server
● rabbitmq-server.service - RabbitMQ Messaging Server
   Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2021-10-23 23:10:21 KST; 8min ago
 Main PID: 1235 (beam.smp)
   Status: "Initialized"
    Tasks: 91 (limit: 4915)
   CGroup: /system.slice/rabbitmq-server.service
           ├─1231 /bin/sh /usr/sbin/rabbitmq-server
           ├─1235 /usr/lib/erlang/erts-10.2.4/bin/beam.smp -W w -A 64 -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048576 -t 5000000 -stbt db -zdbbl 128000 -K true -- -root /us
           ├─1482 erl_child_setup 65536
           ├─1505 inet_gethost 4
           └─1506 inet_gethost 4
 
Oct 23 23:10:12 raspberrypi systemd[1]: Starting RabbitMQ Messaging Server...
Oct 23 23:10:21 raspberrypi systemd[1]: rabbitmq-server.service: Supervising process 1235 which is not our child. We'll most likely not notice when it exits.
Oct 23 23:10:21 raspberrypi systemd[1]: Started RabbitMQ Messaging Server.
Oct 23 23:10:22 raspberrypi systemd[1]: rabbitmq-server.service: Supervising process 1235 which is not our child. We'll most likely not notice when it exits.

Management UI 플러그인 활성화

pi@raspberrypi:~$ sudo rabbitmq-plugins enable rabbitmq_management
The following plugins have been configured:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch
Applying plugin configuration to rabbit@raspberrypi...
The following plugins have been enabled:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch
 
started 3 plugins.

사용자 추가

사용자 목록 조회

pi@raspberrypi:~$ sudo rabbitmqctl list_users
Listing users ...
guest   [administrator]

사용자 추가

pi@raspberrypi:~$ sudo rabbitmqctl add_user admin 'passwd'
Adding user "admin" ...

사용자 권한 부여

pi@raspberrypi:~$ sudo rabbitmqctl set_user_tags admin administrator
Setting tags for user "admin" to [administrator] ...

암호 변경

pi@raspberrypi:~$ sudo rabbitmqctl change_password admin 'passwd'
Changing password for user "admin" ...

사용자 삭제

pi@raspberrypi:~$ sudo rabbitmqctl delete_user admin
Deleting user "admin" ...

RabbitMQ 포트

  • 4369 : epmd, 여러 rabbitmq 서버끼리 서로를 찾을 수 있는 네임 서버 역할을 하는 데몬에서 사용
  • 5672, 5671 : AMQP 를 사용한 메시지 전달
  • 25672 : inter-node 와 CLI Tool 연결
  • 15672 : HTTP API, Management UI

RabbitMQ 관리페이지

웹브라우저로 http://serverip:15672/에 접속

MQTT 플러그인 활성화

pi@raspberrypi:~$ sudo rabbitmq-plugins enable rabbitmq_mqtt
The following plugins have been configured:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_mqtt
  rabbitmq_web_dispatch
Applying plugin configuration to rabbit@raspberrypi...
The following plugins have been enabled:
  rabbitmq_mqtt
 
started 1 plugins.
pi@raspberrypi:~$ netstat -nao | grep 1883
tcp6       0      0 :::1883                 :::*                    LISTEN      off (0.00/0/0)

댓글을 달아 주세요