Networks/MQTT

MQTT server(broker) 설치하기

iKay 2017. 12. 23. 21:58
반응형

MQTT server, client는 여러 종류가 있지만 흔히 사용되는 mosquitto를 Ubuntu(18.04)에 설치해 볼 것이다. 아래와 같이 설치 명령어를 실행하면 매우 쉽게 설치할 수 있다. mosquitto-clients도 함께 설치하자. 나중에 mosquitto-clients로 publish/subscribe를 해 볼 것이다.

 

kay@ubuntu:~$ sudo apt-get install mosquitto mosquitto-clients

 

설치가 완료되면 mosquitto가 자동으로 실행된다. 실행된 모습을 ps 명령어로 확인해보자. 그러면 아래와 같이 mosquitto 프로세스가 실행 중임을 알 수 있다.   

 

kay@ubuntu:~$ ps -ef | grep 'mosquitto'
mosquit+  2224     1  0 07:40 ?        00:00:00 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
kay       2377  1018  0 08:08 pts/0    00:00:00 grep --color=auto mosquitto
kay@ubuntu:~$

 

 

mosquitto 중 -c 옵션은 무엇일까? --help 옵션으로 확인해보자. 

 

kay@ubuntu:~$ mosquitto --help
mosquitto version 1.4.15 (build date Sat, 07 Apr 2018 11:16:43 +0100)

mosquitto is an MQTT v3.1.1/v3.1 broker.

Usage: mosquitto [-c config_file] [-d] [-h] [-p port]

 -c : specify the broker config file.
 -d : put the broker into the background after starting.
 -h : display this help.
 -p : start the broker listening on the specified port.
      Not recommended in conjunction with the -c option.
 -v : verbose mode - enable all logging types. This overrides
      any logging options given in the config file.

See http://mosquitto.org/ for more information.

kay@ubuntu:~$

 

내용을 죽 보면 'broker의 config file을 명시한다.'라고 간단히 설명 돼있다. 즉 실행시 어떤 설정 파일을 참조할 것인지 지정하는 것이라고 보면 될 것 같다.  

 

 

끝.

반응형

'Networks > MQTT' 카테고리의 다른 글

MQTT 발행(publish)과 구독(subscribe)  (0) 2018.10.07
MQTT란?  (0) 2017.10.21