| | 195 | |
| | 196 | |
| | 197 | == Install mosquitto broker == |
| | 198 | |
| | 199 | use '''apk add --no-cache mosquitto''' |
| | 200 | |
| | 201 | {{{ |
| | 202 | |
| | 203 | [root@MK53]:mosquitto # cat acl.conf |
| | 204 | # This affects access control for clients with no username. |
| | 205 | topic read $SYS/# |
| | 206 | |
| | 207 | # This only affects clients with username "roger". |
| | 208 | user IoTdevices |
| | 209 | #topic foo/bar |
| | 210 | topic foo/# |
| | 211 | |
| | 212 | # This affects all clients. |
| | 213 | pattern write $SYS/broker/connection/%c/state |
| | 214 | [root@MK53]:mosquitto # cat mosquitto.conf |
| | 215 | listener 1883 0.0.0.0 |
| | 216 | allow_anonymous false |
| | 217 | password_file /etc/mosquitto/pwfile |
| | 218 | # Specify the path to the ACL file |
| | 219 | acl_file /etc/mosquitto/acl.conf |
| | 220 | log_dest file /var/log/mosquitto/mosquitto.log |
| | 221 | #log_type warning |
| | 222 | #log_type error |
| | 223 | #log_type information |
| | 224 | #log_type notice |
| | 225 | |
| | 226 | [root@MK53]:mosquitto # ls /etc/mosquitto/ |
| | 227 | acl.conf mosquitto.conf pskfile.example pwfile.example |
| | 228 | aclfile.example mosquitto.confORG pwfile |
| | 229 | [root@MK53]:mosquitto # mosquitto -c /etc/mosquitto/mosquitto.conf |
| | 230 | |
| | 231 | ^Z[1]+ Stopped mosquitto -c /etc/mosquitto/mosquitto.conf |
| | 232 | [root@MK53]:mosquitto # bg |
| | 233 | [1] mosquitto -c /etc/mosquitto/mosquitto.conf |
| | 234 | [root@MK53]:mosquitto # netstat -tnpl |
| | 235 | Active Internet connections (only servers) |
| | 236 | Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name |
| | 237 | tcp 0 0 0.0.0.0:1883 0.0.0.0:* LISTEN 93/mosquitto |
| | 238 | tcp 0 0 :::445 :::* LISTEN - |
| | 239 | tcp 0 0 :::445 :::* LISTEN - |
| | 240 | [root@MK53]:mosquitto # |
| | 241 | |
| | 242 | }}} |