환경 설정
OS - Ubuntu 16.04.3-desktop-amd64
Source - mosquitto-1.4.14
sudo apt-get install openssl build-essential libc-ares-dev uuid-dev libssl-dev libcurl4-openssl-dev libmysqlclient-dev
cd ~
wget http://mosquitto.org/files/source/mosquitto-1.4.14.tar.gz
tar xvf mosquitto-1.4.14.tar.gz
cd mosquitto-1.4.14
make
sudo make install
sudo mosquitto
mosquitto_sub -h 127.0.0.1 -t 'topic'
mosquitto_pub -h 127.0.0.1 -t 'topic' -m "Hello Mosquitto!"
#유저 pw, name 설정 한 경우
mosquitto_pub -t 'topic' -u username -P password -m 'message'
mosquitto_sub -t 'topic' -u username -P password
-c, –config-file
Load configuration from a file. If not given, the default values as described in mosquitto.conf(5) are used.
-d, –daemon
Run mosquitto in the background as a daemon. All other behaviour remains the same.
-p, –port
Listen on the port specified instead of the default 1883. This acts in addition to the port setting in the config file. May be specified multiple times to open multiple sockets listening on different ports. This socket will be bound to all network interfaces.
-v, –verbose
Use verbose logging. This is equivalent to setting log_type to all in the configuration file. This overrides and logging options given in the configuration file.
sudo /etc/init.d/mosquitto stop