본문 바로가기
Mosquitto

Mosquitto 설치 및 설정

by 지민재 2024. 5. 3.
반응형
SMALL

Mosquitto 란?

Mosquitto는 Eclipse Foundation에서 개발한 오픈 소스 MQTT(Message Queuing Telemetry Transport) 브로커이다. MQTT는 경량 프로토콜로, IoT(Internet of Things) 디바이스와 애플리케이션 간에 메시지 통신을 위해 사용된다. Mosquitto는 이러한 MQTT 프로토콜을 구현하고, 메시지 브로커로서의 역할을 수행하여 클라이언트 간의 안정적이고 신속한 통신을 지원한다.

Mosquitto의 주요 특징

  1. 경량성: Mosquitto는 리소스 사용량이 적고 경량적인 디자인을 가지고 있어서, 리소스가 제한된 환경에서도 효율적으로 동작한다.
  2. 오픈 소스: Mosquitto는 오픈 소스 프로젝트로, 누구나 소스 코드를 확인하고 기여할 수 있습니다. 이는 커뮤니티의 지원을 받아 계속해서 발전할 수 있음을 의미한다.
  3. 다양한 플랫폼 지원: Mosquitto는 여러 플랫폼(예: Linux, Windows, macOS)에서 동작하며, 다양한 프로그래밍 언어를 지원하는 클라이언트 라이브러리를 제공한다.
  4. 인증 및 보안 기능: Mosquitto는 TLS/SSL을 포함한 다양한 보안 기능을 제공하여 안전한 통신을 보장한다. 또한 사용자 인증 및 접근 제어를 통해 시스템의 보안을 강화할 수 있다.
  5. 유연성: Mosquitto는 다양한 설정 옵션을 제공하여 사용자의 요구에 맞게 구성할 수 있다. 또한 다양한 배포 형태를 지원하여 클라우드 환경부터 에지 디바이스까지 다양한 환경에서 사용할 수 있다.

Mosquitto 설치

아래 링크에 접속하여 자신에 맞는 OS 버전을 선택 후 설치해준다.

https://mosquitto.org/download/

 

Download

Source mosquitto-2.0.18.tar.gz (GPG signature) Git source code repository (github.com) Older downloads are available at https://mosquitto.org/files/ Binary Installation The binary packages listed be

mosquitto.org

 

Mosquitto 설정

윈도우에 Mosquitto를 설치하면 기본적으로 동일 기기(로컬 머신)에서만 접속이 허용된다. 외부 기기에서 원격 접속이 가능하도록 하기 위해서는 Mosquitto 설치 디렉토리에 있는 mosquitto.conf 파일의 내용을 다음과 같이 수정해야 한다. (mosquitto.conf 파일은 디렉토리 c:\Program Files\Mosquitto 또는 c:\Program Files (x86)\Mosquitto 안에 있다.)

아래 conf 파일에서 내용이 많으므로 주황색으로 칠한곳만 표시하면 된다.


# On systems that support Unix Domain Sockets, it is also possible
# to create a # Unix socket rather than opening a TCP socket. In
# this case, the port number should be set to 0 and a unix socket
# path must be provided, e.g.
# listener 0 /tmp/mosquitto.sock
#
# listener port-number [ip address/host name/unix socket path]
listener 1883
# By default, a listener will attempt to listen on all supported IP protocol
# versions. If you do not have an IPv4 or IPv6 interface you may wish to
# disable support for either of those protocol versions. In particular, note
# that due to the limitations of the websockets library, it will only ever # attempt to open IPv6 sockets if IPv6 support is compiled in, and so will fail
# if IPv6 is not available.

# Defaults to false, unless there are no listeners defined in the configuration
# file, in which case it is set to true, but connections are only allowed from
# the local machine.
allow_anonymous true
# -----------------------------------------------------------------
# Default authentication and topic access control
# -----------------------------------------------------------------

# Control access to the broker using a password file. This file can be
# generated using the mosquitto_passwd utility. If TLS support is not compiled
# into mosquitto (it is recommended that TLS support should be included) then
# plain text passwords are used, in which case the file should be a text file

 

mosquitto.conf을 수정하여 저장한 후 서비스를 검색하여 열어준다.

 

서비스에서 Mosquitto Broker 를 찾은 후 아래 그림처럼 다시 시작을 해주면 끝이다.

댓글