miin29na

[MQTT]Mosquitto 설치/테스트 (맥북) 본문

IT/Mqtt

[MQTT]Mosquitto 설치/테스트 (맥북)

miin29na 2020. 4. 11. 20:53

1. Mosquitto Broker 설치

js-MacBookPro:~ js.k$ brew install mosquitto

Updating Homebrew...

==> Auto-updated Homebrew!

 

 

==> Installing dependencies for mosquitto: openssl@1.1, libevent, libuv and libwebsockets

==> Installing mosquitto dependency: openssl@1.1

==> Downloading https://homebrew.bintray.com/bottles/openssl@1.1-1.1.1f.catalina.bottle.tar.gz

==> Downloading from https://akamai.bintray.com/72/724cd97c269952cdc28e24798e350fcf520a32c5985a

######################################################################## 100.0%

==> Pouring openssl@1.1-1.1.1f.catalina.bottle.tar.gz

==> Caveats

A CA file has been bootstrapped using certificates from the system

keychain. To add additional certificates, place .pem files in

  /usr/local/etc/openssl@1.1/certs

 

and run

  /usr/local/opt/openssl@1.1/bin/c_rehash

 

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,

because macOS provides LibreSSL.

 

If you need to have openssl@1.1 first in your PATH run:

  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.bash_profile

 

For compilers to find openssl@1.1 you may need to set:

  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"

  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

 

==> Summary

🍺  /usr/local/Cellar/openssl@1.1/1.1.1f: 8,057 files, 18MB

==> Installing mosquitto dependency: libevent

==> Downloading https://homebrew.bintray.com/bottles/libevent-2.1.11_1.catalina.bottle.tar.gz

==> Downloading from https://akamai.bintray.com/9d/9d262f9ffb2268340a89c713826d8ca068bcac06c30b

######################################################################## 100.0%

==> Pouring libevent-2.1.11_1.catalina.bottle.tar.gz

🍺  /usr/local/Cellar/libevent/2.1.11_1: 1,063 files, 5MB

==> Installing mosquitto dependency: libuv

==> Downloading https://homebrew.bintray.com/bottles/libuv-1.35.0.catalina.bottle.tar.gz

==> Downloading from https://akamai.bintray.com/f9/f9e218fe31eec56662a5a10b0e736ac4de35d3fb22f0

######################################################################## 100.0%

==> Pouring libuv-1.35.0.catalina.bottle.tar.gz

🍺  /usr/local/Cellar/libuv/1.35.048 files, 3.0MB

==> Installing mosquitto dependency: libwebsockets

==> Downloading https://homebrew.bintray.com/bottles/libwebsockets-4.0.1.catalina.bottle.tar.gz

==> Downloading from https://akamai.bintray.com/a5/a5f2a171607549355e6958d260c9441d3c7d4093344e

######################################################################## 100.0%

==> Pouring libwebsockets-4.0.1.catalina.bottle.tar.gz

🍺  /usr/local/Cellar/libwebsockets/4.0.187 files, 1.4MB

==> Installing mosquitto

==> Downloading https://homebrew.bintray.com/bottles/mosquitto-1.6.9.catalina.bottle.tar.gz

==> Downloading from https://akamai.bintray.com/fc/fcbdbcbd2f8abdb5880c6468a0c840a3c058d0b743c1

######################################################################## 100.0%

==> Pouring mosquitto-1.6.9.catalina.bottle.tar.gz

==> Caveats

mosquitto has been installed with a default configuration file.

You can make changes to the configuration by editing:

    /usr/local/etc/mosquitto/mosquitto.conf

 

To have launchd start mosquitto now and restart at login:

  brew services start mosquitto

Or, if you don't want/need a background service you can just run:

  mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf

==> Summary

🍺  /usr/local/Cellar/mosquitto/1.6.9: 38 files, 997.1KB

==> Caveats

==> openssl@1.1

A CA file has been bootstrapped using certificates from the system

keychain. To add additional certificates, place .pem files in

  /usr/local/etc/openssl@1.1/certs

 

and run

  /usr/local/opt/openssl@1.1/bin/c_rehash

 

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,

because macOS provides LibreSSL.

 

If you need to have openssl@1.1 first in your PATH run:

  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.bash_profile

 

For compilers to find openssl@1.1 you may need to set:

  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"

  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

 

==> mosquitto

mosquitto has been installed with a default configuration file.

You can make changes to the configuration by editing:

    /usr/local/etc/mosquitto/mosquitto.conf

 

To have launchd start mosquitto now and restart at login:

  brew services start mosquitto

Or, if you don't want/need a background service you can just run:

  mosquitto -/usr/local/etc/mosquitto/mosquitto.conf

jinsunkimui-MacBookPro:~ jinsun.kim$ 

 

 

2. Mosquitto Broker 실행

js-MacBookPro:~ js.k$ brew services start mosquitto

==> Tapping homebrew/services

Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'...

remote: Enumerating objects: 7done.

remote: Counting objects: 100% (7/7), done.

remote: Compressing objects: 100% (7/7), done.

remote: Total 698 (delta 0), reused 3 (delta 0), pack-reused 691

Receiving objects: 100% (698/698), 193.05 KiB | 356.00 KiB/s, done.

Resolving deltas: 100% (273/273), done.

Tapped 1 command (40 files, 267.2KB).

==> Successfully started `mosquitto` (label: homebrew.mxcl.mosquitto)

 

3. 메시지 구독(Subscribe)/메시지 발행(Publishing)

 

js-MacBookPro:~ js.k$ mosquitto_sub -h localhost -1883 -t topic 

Hello message

js-MacBookPro:~ js.k$ mosquitto_pub -h localhost -1883 -t topic -"Hello message"

js-MacBookPro:~ js.k.kim$ 

'IT > Mqtt' 카테고리의 다른 글

[MQTT] MQTT Protocol  (0) 2020.04.11
Comments