ec2 instance를 생성하고 mosquitto를 실행시켰다.
그리고 mqtt connection tool를 사용하여 연결을 시도하니,

연결이 불가능했다

Starting in local only mode. Connections will only possible from clients running on this machine.
로컬 모드에서만 가능하며
Create a configuration file which defines a listener to allow remote access.
원격 엑세스를 config를 create 하라고 하는 것 같다
첫번째, mosquitto config를 수정한다.
linux라면 /etc/mosquitto/mosquitto.conf 에 위치한다.

이렇게 설정되어있는데,
아래에 두줄만 추가하면 된다.
allow_anonymous true
listener 1883 0.0.0.0

두번째, ec2 instance에 1883 포트를 열어주자
instance의 security group에서 inbound rules에 추가해주면 된다. 아주 간단함

끝이다. 이제 mosquitto 재실행만 시켜주면
systemctl stop mosquitto
systemctl start mosquitto


연결 완료
오늘의 뻘짓 : 바보같이 example conf파일 수정하고 연결안된다고 2시간동안 구글링했다 ㅎㅎ
/etc/mosquitto/mosquitto.conf 수정해야하는데, /usr/share/doc/mosquitto/examples/mosquitto.conf 수정한 나
반성하자 ㅎㅎ
'🍔 database' 카테고리의 다른 글
mysql 데이터 변경 실시간 확인 (2) | 2024.10.02 |
---|---|
[MQTT] message를 안보내는데 계속 message가 쌓이는 issue (1) | 2024.03.07 |
[Redis] Redis에 대한 간단한 정리 (0) | 2023.12.04 |
[Flower] Monitoring Celery Tasks using Flower (0) | 2022.06.20 |
[Celery] Celery with Redis (python) : 비동기 작업 queue (0) | 2022.06.06 |