The MQTT broker can be installed as a service,
to ensure that it starts interacting with clients as soon as your machine boots:
To monitor & bulletproof the EMQ X Broker (EMQX) Windows Service with Service Protector:
-
If necessary,
download and setup EMQX.
Be sure to run "bin\emqx.cmd install" to enable Windows Service operation.
-
Download and
install
Service Protector, if necessary.
-
Start Service Protector.
-
Select Protector > Add to open the Add Protector window:
-
On the General tab, in the Service to protect field, select the EMQ X Broker windows service.
Since we installed EMQX version 4.29, the service is called emqx_4.2.9 on our system:
-
Move to the Monitor tab. To keep your MQTT broker "fresh" and free of memory leaks and other unwanted accumulations,
we recommend establishing a nightly restart of the service.
To set that up, check the At the following times box, click the Add button and specify when you want the service to be recycled.
For example, we have opted for a daily restart at 2 AM:
Please feel free to select a weekly restart (during an established maintenance window?) if you think a daily schedule is overkill.
Also, consider rebooting the entire operating system if you think that will improve the stability of your environment.
-
We're done setting up EMQ X Broker
so click the Save button to record your settings. In a few seconds, a new entry will show up in the Service Protector window.
The green shield indicates that Service Protector is already monitoring the EMQX Windows Service,
to rapidly detect and react to crashes and other failures:
-
That's it! Next time your computer boots, EMQ X Broker will start automatically and Service Protector will babysit the service to promptly restart it if it stops for any reason.
We encourage you to edit the EMQX entry in Service Protector and browse through the many other settings that may be appropriate for your environment.
For example, send an email whenever the service fails, clamp down on RAM or CPU hogging,
verify that TCP/IP connections are accepted, and much more.