Add labs
This commit is contained in:
1
04-mosquitto/lab02/.gitignore
vendored
Normal file
1
04-mosquitto/lab02/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/data/mosquitto.db
|
||||
0
04-mosquitto/lab02/data/.gitkeep
Normal file
0
04-mosquitto/lab02/data/.gitkeep
Normal file
9
04-mosquitto/lab02/docker-compose.yml
Normal file
9
04-mosquitto/lab02/docker-compose.yml
Normal file
@ -0,0 +1,9 @@
|
||||
services:
|
||||
mosquitto:
|
||||
image: eclipse-mosquitto
|
||||
ports:
|
||||
- "1883:1883"
|
||||
volumes:
|
||||
- ./mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
|
||||
# - ./mosquitto-persistenz.conf:/mosquitto/config/mosquitto.conf:ro
|
||||
- ./data:/data
|
||||
40
04-mosquitto/lab02/lab.txt
Normal file
40
04-mosquitto/lab02/lab.txt
Normal file
@ -0,0 +1,40 @@
|
||||
= Mosquitto Persistenz
|
||||
|
||||
Senden Sie zunächst eine retained message
|
||||
|
||||
$ docker run --rm -it --net host eclipse-mosquitto \
|
||||
mosquitto_pub -t "test/status" -r -m "Online"
|
||||
|
||||
Rufen Sie die Nachricht ab +
|
||||
|
||||
$ docker run --rm -it --net host eclipse-mosquitto \
|
||||
mosquitto_sub -t "test/status" --debug
|
||||
|
||||
|
||||
Starten Sie den Broker neu und wiederholen den Vorgang.
|
||||
Bei Verwendung von docker-compose kann CTRL-C verwendet werden,
|
||||
alternativ kann der Prozess beendet werden.
|
||||
|
||||
$ sudo killall mosquitto
|
||||
(Neustart des Brokers, z.B. mittels `docker compose up`)
|
||||
|
||||
$ docker run --rm -it --net host eclipse-mosquitto \
|
||||
mosquitto_sub -t "test/status" --debug
|
||||
|
||||
Konfigurieren Sie Persistenz und wiederholen den Vorgang.
|
||||
Beispiel:
|
||||
|
||||
persistence true
|
||||
persistence_location /data
|
||||
autosave_interval 1 # sekunden oder events
|
||||
autosave_on_changes 1 # bei jeder einzelnen aenderung
|
||||
|
||||
|
||||
$ docker run --rm -it --net host eclipse-mosquitto \
|
||||
mosquitto_pub -t "test/status" -r -m "Online"
|
||||
|
||||
(Neustart des Brokers)
|
||||
|
||||
|
||||
$ docker run --rm -it --net host eclipse-mosquitto \
|
||||
mosquitto_sub -t "test/status" --debug
|
||||
10
04-mosquitto/lab02/mosquitto-persistenz.conf
Normal file
10
04-mosquitto/lab02/mosquitto-persistenz.conf
Normal file
@ -0,0 +1,10 @@
|
||||
listener 1883
|
||||
allow_anonymous true
|
||||
|
||||
# sys_interval 3
|
||||
|
||||
persistence true
|
||||
persistence_location /data
|
||||
autosave_interval 1 # sekunden oder events
|
||||
autosave_on_changes 1 # bei jeder einzelnen aenderung
|
||||
|
||||
4
04-mosquitto/lab02/mosquitto.conf
Normal file
4
04-mosquitto/lab02/mosquitto.conf
Normal file
@ -0,0 +1,4 @@
|
||||
listener 1883
|
||||
allow_anonymous true
|
||||
|
||||
# sys_interval 3
|
||||
Reference in New Issue
Block a user