'프로그램 사용/mosquitto'에 해당되는 글 4건

  1. 2025.02.18 mosquitto for windows 계정추가
  2. 2025.02.18 mosquitto service for windows
  3. 2024.05.23 ubuntu MQTT(mosquito)
  4. 2019.05.15 mosquitto - MQTT broker

결국은(?) password_file을 지정해서 mosquitto_passwd 명령을 통해 계정을 추가해주면 끝 인듯

 

1. password.txt 이름으로 비어있는 파일을 생성하여 Mosquitto가 설치된 폴더에 저장
2. 계정 추가
C:\mosquitto>mosquitto_passwd -b password.txt admin password

3. mosquitto.conf 파일 수정
allow_anonymous false
password_file C:\Program Files\mosquitto\password.txt

[링크 : https://hays99.tistory.com/189]

[링크 : https://mosquitto.org/man/mosquitto_passwd-1.html]

 

+

2025.02.21

"Program Files" 때문에 공백이 있어서 "로 묶어 줘야 할 줄 알았는데, 해주면 안되도록 구현이 되어있나 보다.

C:\Program Files\mosquitto>mosquitto -c mosquitto.conf -v
1740101165: mosquitto version 2.0.20 starting
1740101165: Config loaded from mosquitto.conf.
1740101165: Error: Unable to open pwfile ""C:\Program Files\mosquitto\password.txt"".
1740101165: Error opening password file ""C:\Program Files\mosquitto\password.txt"".

 

'프로그램 사용 > mosquitto' 카테고리의 다른 글

mosquitto service for windows  (0) 2025.02.18
ubuntu MQTT(mosquito)  (0) 2024.05.23
mosquitto - MQTT broker  (0) 2019.05.15
Posted by 구차니

공식 다운로드는 아래인데

[링크 : https://mosquitto.org/download/]

 

받아도 방화벽 설정은 하나도 안되고 내부에서만 허용되는 설정으로 설치가 된다.

그러니 외부 접속이 필요하면 아래 내용을 참고하여 인바운드 1883/tcp를 허용해주어야 한다.

[링크 : https://velog.io/@foxiq/MQTT-사용]

 

윈도우 64bit로 설치했을 경우 C:\Program Files\mosquitto\mosquitto.conf 에 설정 파일이 저장된다.

굳이 listener 1883 0.0.0.0 으로 해주진 않아도 외부 접속을 허용하게 되는 것으로 보인다.

# =================================================================
# Listeners
# =================================================================

# Listen on a port/ip address combination. By using this variable
# multiple times, mosquitto can listen on more than one port. If
# this variable is used and neither bind_address nor port given,
# then the default listener will not be started.
# The port number to listen on must be given. Optionally, an ip
# address or host name may be supplied as a second argument. In
# this case, mosquitto will attempt to bind the listener to that
# address and so restrict access to the associated network and
# interface. By default, mosquitto will listen on all interfaces.
# Note that for a websockets listener it is not possible to bind to a host
# name.
#
# 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
listener 1883
allow_anonymous true

 

+

2025.02.21

포트를 바꿀 경우 -p 로 바꾸어 주고

다른 서버일 경우 -h ip를 추가해주면 된다.

C:\Program Files\mosquitto>mosquitto_sub -p 27839 -t topic -u username -P password

 

C:\Program Files\mosquitto>mosquitto_pub  -p 27839 -t MY -u username -P password -m asdf

+

 

allow_anonymous true가 없으면 아래 에러가 발생한다.

Connection error: Connection Refused: not authorised.

 

전체 테스트 과정은 아래와 같다.

윈도우 (서버) 다른 PC/linux (클라이언트)
1. 프로그램 설치  
2. 방화벽 설정  
3. conf 파일 수정 및 서비스 재기동  
4. client 접속
C:\Program Files\mosquitto>mosquitto_sub.exe -t MY_TOPIC
4. client 접속
$ mosquitto_sub -v -h 192.168.0.11 -t MY_TOPIC
5. publish
C:\Program Files\mosquitto>mosquitto_pub.exe -t MY_TOPIC -m HELLO
 
  6. 메시지 확인
HELLO

-v 시에는
MY_TOPIC HELLO

 

---

Just edit Mosquitto configuration file ( /etc/mosquitto/conf.d/mosquitto.conf ) adding these lines...
allow_anonymous true
listener 1883 0.0.0.0

[링크 : https://stackoverflow.com/questions/24556160/mosquitto-client-obtain-refused-connection]

[링크 : https://iotmaker.kr/2021/08/23/mosquitto-remote-access-for-windows/]

[링크 : https://blog.naver.com/loyz/222654739136]

[링크 : https://pros2.tistory.com/137]

'프로그램 사용 > mosquitto' 카테고리의 다른 글

mosquitto for windows 계정추가  (0) 2025.02.18
ubuntu MQTT(mosquito)  (0) 2024.05.23
mosquitto - MQTT broker  (0) 2019.05.15
Posted by 구차니

mosquitto 는 broker(서버 역할)

mosquitto-client는 client 역할을 하는 프로그램이다.

$ apt-cache search mosqui
libmosquitto-dev - MQTT version 5.0/3.1.1/3.1 client library, development files
libmosquitto1 - MQTT version 5.0/3.1.1/3.1 client library
libmosquittopp-dev - MQTT version 3.1 client C++ library, development files
libmosquittopp1 - MQTT version 5.0/3.1.1/3.1 client C++ library
mosquitto - MQTT version 5.0/3.1.1/3.1 compatible message broker
mosquitto-clients - Mosquitto command line MQTT clients
mosquitto-dev - Development files for Mosquitto

 

 

publish는 메시지를 송신하고, subscribe는 메시지를 수신한다.

 

$ mosquitto_pub -h [호스트] -t [토픽] -m [메시지]
$ mosquitto_sub -h [호스트] -t [토픽]

[링크 : https://sonjuhy.tistory.com/34]

[링크 : https://changun516.tistory.com/201]

'프로그램 사용 > mosquitto' 카테고리의 다른 글

mosquitto for windows 계정추가  (0) 2025.02.18
mosquitto service for windows  (0) 2025.02.18
mosquitto - MQTT broker  (0) 2019.05.15
Posted by 구차니

일종의.. 서버 역활을 하는 녀석

eclipse 재단에서 만든건가?

 

[링크 : http://mosquitto.org/]

[링크 : https://midnightcow.tistory.com/36]

'프로그램 사용 > mosquitto' 카테고리의 다른 글

mosquitto for windows 계정추가  (0) 2025.02.18
mosquitto service for windows  (0) 2025.02.18
ubuntu MQTT(mosquito)  (0) 2024.05.23
Posted by 구차니