-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
listener configuration with include_dir not working as expected #2148
Comments
Your guess is correct, on starting a new file any listeners defined are no longer the focus of the configuration. My feeling is that this is a documentation error, I think it is more robust to have the listener configuration in a single file. What benefit do you want to get from separating the configurations like this? |
I would also like to separate my configuration like this. |
This is not a requirement for me. When I started using mosquitto in version 1.x, I thought it was nice to separate aspects of the configuration into individual files, so I had one config file for general settings, one for the TLS settings, one for ACL. Later, I added a second listener with an additional config file. I created this bug entry, because this configuration does not work any more with mosquitto 2, and I found no indication about this being intended, neither in the documentation Assuming that the behaviour of mosquitto is going to stay as it is, I think it would be good to make that more clear in the documentation. Also, I could imagine that it would be useful to log a warning if some configuration option causes the default listener to be started without it being stated explicitely in the configuration file. This would probably also help in situations like described in issue #2103. |
The whole point of having the config directory is to allow configuration to be separated, the reason I was asking is because to me personally it makes sense to have a configuration file for a listener with all its settings, but having the listener configuration across multiple files seemed... confusing. You're right to highlight this though, it wasn't an intentional change. @guydingmike I'm not quite sure what you mean by the port usage being done at a higher level - do you mean that you really do need to have separate files with |
@ralight Sorry, I was unclear by trying to be too concise. I'm new to Mosquitto so it is completely possible I just don't understand how to configure what I'm looking for. I've created my own RPM of Mosquitto that I would like to be generic so I can install it on various products/systems. I do not want that installation of Mosquitto to start any listeners. I have other RPMs that should install configuration for Mosquitto (in the Mosquitto conf directory). These RPMs (not Mosquitto) "know" what their topics are, what users there are and what ports the listeners should be on. The RPMs require Mosquitto to be installed first. The idea is that only the application RPMs themselves know what the topics are, who the users are and what ports should be used. In a similar vein, the Bridge dynamic 2.0 #1926 and Dynamic Topic Bridging #292 are of interest to me. The applications connecting to Mosquitto have the logic and information to make decisions about whether a bridge should be up or down and the configuration for the bridge. The bridge configuration may not be known at Mosquitto startup and/or we might not want the bridge to come up when Mosquitto is started (which would typically be at boot). Sorry if I went on too long Roger. |
I can confirm that I have encountered this issue as well. I upgraded the mosquitto from version 1.6.x to 2.0.10 and I noticed deprecation warning about Configuration change: -port 1883
+listener 1883 leads to
When I switch the configuration option back to I would understand this change. However, it is not mentioned in the documentation neither for the Thanks for the mosquitto BTW 😉 |
@VojtechMyslivec My bet is that you have another config option that enables the "default listener" - it's still a bug in mosquitto, but you can get around it. |
We ran into this today. We have the main config file with:
And a second config file in
Running this configuration will attempt to start a listener in the main file and that listener will only have the Adding The solution is to treat the main file as a global shared config for all configurations in the included folder and not specifying a |
This has been observed on mosquitto 2.0.9 and also 2.0.8, installed on debian buster using
deb http:https://repo.mosquitto.org/debian buster main
The following broker configuration does not work, mosquitto dies with "Error: Address already in use" (this is a minimal configuration to reproduce the issue, not my full configuration):
file /etc/mosquitto/mosquitto.conf:
Three files in
/etc/mosquitto/conf.d
:01-options.conf
:02-tls.conf
:03-listener2.conf
:Starting mosquitto with
mosquitto -c /etc/mosquitto/mosquitto.conf
prints the following, then exits with status 1:the log file
/var/log/mosquitto/mosquitto.log
contains:Removing the line
cafile /etc/mosquitto/ca.crt
from02-tls.conf
and adding it to the end of01-options.conf
allows mosquitto to run. Console out:and log file:
It appears to me that with the
cafile ...
line in02-tls.conf
, mosquitto activates a listener on the default port 1883 with this setting, instead of configuring the listener defined in01-options.conf
. The listener on port 1883 defined in03-listener2.conf
then cannot start because the port is already in use. However, moving the linecafile ...
to the end of01-options.conf
changes the setting of the listener on port 1884 instead of starting a new listener. From the documentation (man mosquitto.conf
), I would have expected the two configurations to be equivalent. If the observed behaviour is as expected, then maybe the documentation could be improved.The text was updated successfully, but these errors were encountered: