Control of mosquitto/MQTT



  • I have been having a look at MQTT and the mosquitto implementation - it seems that it has some useful possibilities.

    I used opkg to install mosquitto to play with it.
    All went well, however I was surprised that:

    1. On installation mosquitto is automatically started and is also re-started on a reboot (because there exists the file /etc/rc.d/S80mosquitto that does so)
    2. There is no (obvious) way to stop mosquitto from the mosquitto command.
      All I was able to do was:
      a. Use kill on the mosquitto process id
      b. or use /etc/init.d/mosquitto stop

    I'm not really sure that it is a good idea for things to be automatically started on installation; nor is it a good idea to have no obvious method of stopping them once they are started.

    Perhaps this could be addressed in a later version of the *mosquitto package.



  • Mosquitto is an MQTT broker (server), and the main purpose of a server is to be available as much as possible. What is wrong with that ?



  • If you have issues with this package, you should address the creators of that software package. I also agree with Johan, it is a server package, why disable it from starting up?



  • Howdy Kit,

    I'm with the other two, when installing MQTT 99.9% of the time you want it to be running, including after a reboot.

    The other 0.1 of the time is someone testing :)

    Matt

    PS. If this is your first play with MQTT, it is by far the best way to push messages around numerous devices with an exceptionally low overhead. Topics are the way forward!

    I personally use it with a load of Arduino's & ESP8266's and it's made intercommunication "amazeballs", almost as cool as realising you can run over-the-air updates on ESP8266 boards :)



  • Current running a project using mosquito. The actual broker is running on a pi. The omega has the mosquito client package installed. Got a cron job that reads a temperature sensor on a GPIO then publishes to a topic. Omega talks to the pi over wifi.

    Works fine.



  • @mark-doutre said:

    Current running a project using mosquito. The actual broker is running on a pi. The omega has the mosquito client package installed. Got a cron job that reads a temperature sensor on a GPIO then publishes to a topic. Omega talks to the pi over wifi.

    Works fine.

    Howdy Mark,

    Quick question are you using a DHT11 or DHT22 sensor? I did have a look eaierly to see if there was a library kicking around I could use for the Omega, hence I'm curious to see what you're using :)

    Matt



  • @Matt-Ogborne I've got a DS18B20 connected to a GPIO that I sample periodically.



  • To the various people who replied to my original post: thank you, that's what having a community like this is all about - the ability to express and share different ideas and view points. :-)

    In response:

    • I don't have a major disagreement with MQTT starting automatically since, as has been said, there will often be cases where this is what is wanted, but as a general principle I don't like it when a system does something that impinges on my system (a) without letting me know; and (b) without any obvious clean way to control it.
    • While I can envisage that I will (in the future) make use of MQTT, I don't necessarily want it running (and consuming system resources) all the time - I want this to be under my control
    • The mechanism by which the automatic starting of MQTT is done uses the default configuration file with the default port. While it is possible to edit the configuration file, I would much prefer the flexibility that is afforded via specifying the configuration file and/or port from the command line
    • My biggest objection to the current situation is that it is not immediately obvious as to how to stop it once it is started and this is even more so if one has started an instance via the command line with the -d option

    Other than all of my rants above, I do think that MQTT is (can be) a very useful tool for intercommunication - I really like it in general :-)



  • @Matt-Ogborne check this topic, it has a precompiled executable to read data from DTH11/DHT22 in the Omega.



  • @Kit-Bishop In the mosquitto.conf file, there is an option for a pid file. Set that up then send a SIGHUP to the existing broker. It should re-read the conf file. You can now kill the broker whenever you want.

    As far as using mosquitto goes, I wouldn't run the broker on the Omega. I've always regarded the Omega as an edge device rather than a micro server (like a pi).



  • @mark-doutre Thanks - found that. :-) Though I think it would still be good if there was a more direct method of stopping it.

    Regarding the running of the broker on the Omega, I agree with your comment. So far I have just been playing with MQTT and having a local broker under one's own control is a valuable part of getting to understand it all. In the real world, using a separate broker somewhere else is probably the way to go.

    Any way, thanks for your interest and comments :-)


Log in to reply
 

Looks like your connection to Onion Community was lost, please wait while we try to reconnect.