0
0
Raspberry Piprogramming~5 mins

MQTT broker setup (Mosquitto) in Raspberry Pi - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is Mosquitto in the context of MQTT?
Mosquitto is a lightweight MQTT broker that manages message exchange between devices using the MQTT protocol.
Click to reveal answer
beginner
Which command installs Mosquitto on a Raspberry Pi running Raspberry Pi OS?
Use sudo apt update followed by sudo apt install mosquitto mosquitto-clients to install Mosquitto and its clients.
Click to reveal answer
beginner
How do you start the Mosquitto service and enable it to run on boot?
Run sudo systemctl start mosquitto to start and sudo systemctl enable mosquitto to enable it at boot.
Click to reveal answer
beginner
What is the default port Mosquitto listens on for MQTT connections?
Mosquitto listens on port 1883 by default for MQTT client connections.
Click to reveal answer
beginner
How can you test if Mosquitto broker is working on your Raspberry Pi?
Use mosquitto_sub -h localhost -t test/topic in one terminal to subscribe, and mosquitto_pub -h localhost -t test/topic -m "Hello" in another to publish a message. If the subscriber shows the message, the broker works.
Click to reveal answer
Which command installs Mosquitto on Raspberry Pi?
Asudo install mosquitto
Bsudo apt-get remove mosquitto
Csudo apt install mosquitto mosquitto-clients
Dsudo systemctl start mosquitto
What port does Mosquitto use by default for MQTT?
A8080
B1883
C443
D22
How do you enable Mosquitto to start automatically on boot?
Asudo mosquitto start
Bsudo systemctl disable mosquitto
Csudo apt install mosquitto
Dsudo systemctl enable mosquitto
Which command subscribes to a topic 'test/topic' on local Mosquitto broker?
Amosquitto_sub -h localhost -t test/topic
Bmosquitto_pub -h localhost -t test/topic
Cmosquitto_start -t test/topic
Dmosquitto_listen -t test/topic
What is the role of Mosquitto in MQTT communication?
AIt is a broker managing message delivery between clients.
BIt is a database for storing MQTT messages.
CIt encrypts MQTT messages.
DIt acts as a client sending messages.
Explain the steps to install and start Mosquitto broker on a Raspberry Pi.
Think about commands using apt and systemctl.
You got /4 concepts.
    Describe how to test if your Mosquitto broker is working correctly on your Raspberry Pi.
    Use two terminal windows for testing publish and subscribe.
    You got /3 concepts.