MQTT: install di Ubuntu 22.04 dengan cedalo docker
sumber: https://linux.how2shout.com/how-to-install-mosquitto-in-ubuntu-22-04-or-20-04-lts/
Mosquitto MQTT Server adalah message broker yang bekerja di atas protokol MQTT. MQTT adalah protokol messaging ringan yang standar ISO untuk digunakan di atas protokol TCP/IP. Hal ini banyak digunakan untuk berkomunikasi dengan perangkat Internet of Things. Kami akan menginstal Mosquitto di server Ubuntu 22.04 dan kami akan mengirim pesan dari perangkat lunak MQTT-spy. Mosquitto adalah proyek Eclipse dan didistribusikan dengan lisensi EDL. Jadi mari kita mulai.
Install Web Manajemen UI
Install docker sesuai petunjuk untuk Ubuntu 22.04 - Docker: Instalasi di Ubuntu 22.04
Selanjutnya, install free dan open-source Management UI untuk MQTT Cedalo
sudo docker run -it -v ~/cedalo_platform:/cedalo cedalo/installer:2-linux
Start
cd ~/cedalo_platform sudo sh start.sh
Jika berhasil
Starting cedalo_platform_mosquitto_1 ... done Creating cedalo_platform_streamsheets_1 ... done Creating cedalo_platform_management-center_1 ... done Attaching to cedalo_platform_mosquitto_1, cedalo_platform_streamsheets_1, cedalo_platform_management-center_1 streamsheets_1 | Password for default Mosquitto does not exist, will create one. mosquitto_1 | 1688368702: mosquitto version 2.0.15 starting mosquitto_1 | 1688368702: Config loaded from /mosquitto/config/mosquitto.conf. mosquitto_1 | 1688368702: Loading plugin: /usr/lib/mosquitto_dynamic_security.so mosquitto_1 | 1688368702: Opening ipv4 listen socket on port 1883. mosquitto_1 | 1688368702: Opening ipv6 listen socket on port 1883. mosquitto_1 | 1688368702: mosquitto version 2.0.15 running management-center_1 | Starting Management Center for Eclipse Mosquitto streamsheets_1 | sed: cannot rename streamsheets/packages/gateway/config/sedPC5i8a: Device or resource busy streamsheets_1 | -e Password for default Mosquitto created successfully. streamsheets_1 | -e Hashed password for Mosquitto broker is located inside the installation directory in the file settings/mosquitto/pw.txt. streamsheets_1 | -e Clear text password for Mosquitto broker is located inside the installation directory in the file settings/mosquitto/pw_clear.txt. streamsheets_1 | -e Warning: for security reasons please copy the password from settings/mosquitto/pw_clear.txt and delete that file afterwards. streamsheets_1 | 2023-07-03 07:18:36,850 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. streamsheets_1 | 2023-07-03 07:18:36,935 INFO supervisord started with pid 14 management-center_1 | [Error: ENOENT: no such file or directory, access '/management-center/src/license/utils/config/license.lic'] { management-center_1 | errno: -2, management-center_1 | code: 'ENOENT', management-center_1 | syscall: 'access', management-center_1 | path: '/management-center/src/license/utils/config/license.lic' management-center_1 | } management-center_1 | /management-center/src/license/utils management-center_1 | undefined streamsheets_1 | 2023-07-03 07:18:37,943 INFO spawned: 'mongod' with pid 17 streamsheets_1 | 2023-07-03 07:18:37,952 INFO spawned: 'redis' with pid 18 streamsheets_1 | 2023-07-03 07:18:37,969 INFO spawned: 'mosquitto-default' with pid 19 streamsheets_1 | 2023-07-03 07:18:37,973 INFO spawned: 'nginx' with pid 20 streamsheets_1 | 2023-07-03 07:18:37,977 INFO spawned: 'mosquitto' with pid 21 streamsheets_1 | 2023-07-03 07:18:37,980 INFO spawned: 'gateway' with pid 22 streamsheets_1 | 2023-07-03 07:18:37,983 INFO spawned: 'service-graphs' with pid 23 streamsheets_1 | 2023-07-03 07:18:37,986 INFO spawned: 'service-machines' with pid 24 streamsheets_1 | 2023-07-03 07:18:37,991 INFO spawned: 'service-streams' with pid 25 streamsheets_1 | 2023-07-03 07:18:38,989 INFO success: mongod entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) streamsheets_1 | 2023-07-03 07:18:38,989 INFO success: redis entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) streamsheets_1 | 2023-07-03 07:18:38,990 INFO success: mosquitto-default entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) streamsheets_1 | 2023-07-03 07:18:38,990 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) streamsheets_1 | 2023-07-03 07:18:38,990 INFO success: mosquitto entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) streamsheets_1 | 2023-07-03 07:18:38,991 INFO success: gateway entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) streamsheets_1 | 2023-07-03 07:18:38,993 INFO success: service-graphs entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) streamsheets_1 | 2023-07-03 07:18:38,994 INFO success: service-machines entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) streamsheets_1 | 2023-07-03 07:18:38,994 INFO success: service-streams entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) management-center_1 | Mon, 03 Jul 2023 07:18:39 GMT express-session deprecated undefined resave option; provide resave option at start.js:179:10 management-center_1 | Mon, 03 Jul 2023 07:18:39 GMT express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at start.js:179:10 management-center_1 | Connecting to "Mosquitto 2.0" on mqtt://mosquitto:1883 management-center_1 | Started Mosquitto proxy at http://localhost:8088 management-center_1 | "CEDALO_MC_PLUGIN_DIR" is not set. Skipping loading of plugins management-center_1 | Mosquitto proxy server started on port 8088 mosquitto_1 | 1688368719: New connection from 172.18.0.4:53494 on port 1883. mosquitto_1 | 1688368719: New client connected from 172.18.0.4:53494 as mqttjs_97f98186 (p2, c1, k60, u'cedalo'). management-center_1 | Connected to 'Mosquitto 2.0' at mqtt://mosquitto:1883
Akses web
http://ip-address:8088 http://192.168.0.62:8088
username cedalo password mmcisawesome
Konfigurasi
cd /home/onno/cedalo_platform/mosquitto/config vi mosquitto.conf
Tambahkan
allow_anonymous true listener 1883 0.0.0.0 persistence true persistence_location /mosquitto/data/
persistence_file mosquitto.db log_dest syslog log_dest stdout log_dest topic log_type error log_type warning log_type notice log_type information connection_messages true log_timestamp true password_file /etc/mosquitto/pwfile plugin /usr/lib/mosquitto_dynamic_security.so plugin_opt_config_file /mosquitto/data/dynamic-security.json
Restart
sudo docker restart cedalo_platform_mosquitto_1 sudo docker restart cedalo_platform_management-center_1 sudo docker restart cedalo_platform_streamsheets_1