I have an MQTT broker running in Ubuntu 16.04. My question is that how I can add users while the broker is running? When I add a user using
mosquitto_passwd -c /etc/mosquito/pwfile user2
The user does show up in pwfile but I am not able to access that user from an external source until I restart the broker. I have tried to use
sudo mosquitto -c /etc/mosquitto/mosquitto.conf
to reload the mosquitto.conf file but it gives this error
1483102542: Config loaded from /etc/mosquitto/mosquitto.conf.
1483102542: Opening ipv4 listen socket on port 1883.
1483102542: Error: Address already in use
So what should I do to add users to broker and load them without restarting the broker?(I am using ESP8266 devices to access this broker and I have also tried to access the newly added user using MQTTLens(a chrome extension) but I was unable to access)
Each one will handle 10-20 clients. As far as I understand a common solution is MQTT. The clients periodically send data to the broker (i.e. Mosquitto running on the hosting server), that in turn updates the main web app that runs on the same server.
Any device that has a TCP/IP stack and is capable of using an MQTT library can become an MQTT client, that is, a publisher, a subscriber or both a publisher and a subscriber. The MQTT library makes it possible for the device to talk MQTT on top of TCP/IP and to interact with specific types of MQTT servers.
Username and password authentication is common on all computer systems and the Mosquitto MQTT broker supports this authentication mechanism. To use Password authentication you need to configure the MQTT broker to require it. The username and password are sent in clear text, and you will need to use TLS to secure it.
There are 2 options for this.
mosquitto_passwd
. You can force mosquitto to re-read the file by sending the mosquitto broker a HUP signalYou can Reload the configuration without interrupting the existing connections by sending SIGHUP to the process.
$kill -SIGHUP PID
This will reload the pwfile. But not the PID file. More information of the reloading files with HUP can be found in : mosquitto conf documentation
Complete Steps are shown here: reload mosquito config without restarting the service
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With