Influx and Mosquitto failure

Hello,

since I have changes (with a new installation on Rpi4) to OH3 I have problems with Influx as well as Mosquitto.

2021-10-08 16:25:16.252 [INFO ] [.reconnect.PeriodicReconnectStrategy] - Try to restore connection to '192.168.178.113'. Next attempt in 60000ms
2021-10-08 16:25:16.255 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '192.168.178.113' with clientid 3de734c1-1034-43e6-a981-f9db8d39d852

2021-10-08 16:24:23.065 [INFO ] [openhab.event.ThingStatusInfoEvent  ] - Thing 'mqtt:broker:Mqtt_Home' updated: OFFLINE (COMMUNICATION_ERROR): CONNECT failed as CONNACK contained an Error Code: NOT_AUTHORIZED.
2021-10-08 16:24:23.067 [INFO ] [openhab.event.ThingStatusInfoEvent  ] - Thing 'mqtt:topic:Basic1_thg' updated: OFFLINE (BRIDGE_OFFLINE)
2021-10-08 16:24:23.068 [INFO ] [openhab.event.ThingStatusInfoEvent  ] - Thing 'mqtt:topic:Basic2_thg' updated: OFFLINE (BRIDGE_OFFLINE)
2021-10-08 16:24:23.069 [INFO ] [openhab.event.ThingStatusInfoEvent  ] - Thing 'mqtt:topic:BasicR3_thg' updated: OFFLINE (BRIDGE_OFFLINE)
2021-10-08 16:24:23.071 [INFO ] [openhab.event.ThingStatusInfoEvent  ] - Thing 'mqtt:topic:TH_thg' updated: OFFLINE (BRIDGE_OFFLINE)

Mosquito:
MQTT Things will not go online and by typing

openhabian@openhabian:~ $ mosquitto

I got following message:

1633703369: mosquitto version 1.5.7 starting
1633703369: Using default config.
1633703369: Opening ipv4 listen socket on port 1883.
1633703369: Error: Address already in use

When I stop the Mosquitto service:

root@openhabian:/# systemctl stop mosquitto.service

and type in:

openhabian@openhabian:~ $ mosquitto

Mosquitto starts :

1633703527: mosquitto version 1.5.7 starting
1633703527: Using default config.
1633703527: Opening ipv4 listen socket on port 1883.
1633703527: Opening ipv6 listen socket on port 1883.
1633703529: New connection from …
…
…
…

And the MQTT Things are online :grinning: .
But this is not permanent running. After I reboot OH I have to repeat the procedure above.

Influx DB:
The behavior is similar but more complex. After starting OH Influx is not working.

2021-10-08 16:20:08.522 [ERROR] [ence.internal.PersistenceManagerImpl] - Exception occurred while querying persistence service 'influxdb': java.net.ConnectException: Failed to connect to /192.168.178.113:8086
2021-10-08 16:21:00.181 [ERROR] [org.influxdb.impl.BatchProcessor    ] - Batch could not be sent. Data will be lost

When I type:

root@openhabian:/# influx

I got this Message:

Failed to connect to http://localhost:8086: Get http://localhost:8086/ping: dial tcp [::1]:8086: connect: connection refused
Please check your connection settings and ensure 'influxd' is running.

And with:

root@openhabian:/# influxd

I got this Message:

8888888           .d888 888                   8888888b.  888888b.
   888            d88P"  888                   888  "Y88b 888  "88b
   888            888    888                   888    888 888  .88P
   888   88888b.  888888 888 888  888 888  888 888    888 8888888K.
   888   888 "88b 888    888 888  888  Y8bd8P' 888    888 888  "Y88b
   888   888  888 888    888 888  888   X88K   888    888 888    888
   888   888  888 888    888 Y88b 888 .d8""8b. 888  .d88P 888   d88P
 8888888 888  888 888    888  "Y88888 888  888 8888888P"  8888888P"

2021-10-08T14:36:19.520884Z	info	InfluxDB starting	{"log_id": "0X45B0l0000", "version": "1.8.9", "branch": "1.8", "commit": "d9b56321d579"}
2021-10-08T14:36:19.520968Z	info	Go runtime	{"log_id": "0X45B0l0000", "version": "go1.13.8", "maxprocs": 4}
run: open server: listen: listen tcp 127.0.0.1:8088: bind: address already in use

With the following process I get Influx running:

root@openhabian:/# sudo systemctl stop influxdb
root@openhabian:/# influxd
8888888           .d888 888                   8888888b.  888888b.
   888            d88P"  888                   888  "Y88b 888  "88b
   888            888    888                   888    888 888  .88P
   888   88888b.  888888 888 888  888 888  888 888    888 8888888K.
   888   888 "88b 888    888 888  888  Y8bd8P' 888    888 888  "Y88b
   888   888  888 888    888 888  888   X88K   888    888 888    888
   888   888  888 888    888 Y88b 888 .d8""8b. 888  .d88P 888   d88P
 8888888 888  888 888    888  "Y88888 888  888 8888888P"  8888888P"

2021-10-08T14:37:49.771197Z	info	InfluxDB starting	{"log_id": "0X45GXIl000", "version": "1.8.9", "branch": "1.8", "commit": "d9b56321d579"}
2021-10-08T14:37:49.771269Z	info	Go runtime	{"log_id": "0X45GXIl000", "version": "go1.13.8", "maxprocs": 4}
2021-10-08T14:37:49.874680Z	info	Using data dir	{"log_id": "0X45GXIl000", "service": "store", "path": "/var/lib/influxdb/data"}
2021-10-08T14:37:49.874942Z	info	Compaction settings	{"log_id": "0X45GXIl000", "service": "store", "max_concurrent_compactions": 2, "throughput_bytes_per_second": 50331648, "throughput_bytes_per_second_burst": 50331648}
2021-10-08T14:37:49.875125Z	info	Open store (start)	{"log_id": "0X45GXIl000", "service": "store", "trace_id": "0X45GXhl000", "op_name": "tsdb_open", "op_event": "start"}
2021-10-08T14:37:49.893451Z	info	Opened file	{"log_id": "0X45GXIl000", "engine": "tsm1", "service": "filestore", "path": "/var/lib/influxdb/data/_internal/monitor/29/000000002-000000002.tsm", "id": 0, "duration": "0.987ms"}
…
…
…

But when I stop this “Influxd” with “contr. + C” than also Influx DB stops.

Further marks:

When Influx DB is running I am sometimes not able to go in to Influx:

root@openhabian:/# influx

Failed to connect to http://localhost:8086: Get http://localhost:8086/ping: dial tcp [::1]:8086: connect: connection refused
Please check your connection settings and ensure 'influxd' is running.

Another worst thing is: with the above-mentioned process Influx DB was 10 days running. I was able to see all data in Grafana. After reboot of the Rasp. all data were lost.

Here I found also good Information (but w/o success):

root@openhabian:/# influxdb.service
bash: influxdb.service: command not found

root@openhabian:/# systemctl list-units | grep influxdb
  opt-zram-influxdb.bind.mount                                                                        loaded active mounted   /opt/zram/influxdb.bind                                                                      
  var-lib-influxdb.mount                                                                              loaded active mounted   /var/lib/influxdb  

Additionally, I had the problem that frotail hangs up. Here I just solve it with a reboot. But this is may be another problem!?

Hope some of you can help me…

As you already tried by shutting down mosquitto.service this

means that mosquitto already is running after a reboot.

I would suggest to have a look at the mosquitto log /var/log/mosquitto/mosquitto.log to see if the connection trial from OH. It looks like ( CONNECT failed as CONNACK contained an Error Code: NOT_AUTHORIZED ) there is a misconfiguration like user/password do not match.
=> compare your thing setup against the mosquitto setup.

Thank you for the feedback Wolfgang!
I have found two log files: mosquitto.log.1.gz (Oct 08) and mosquitto.log.2.gz. (Aug 28)
In both I did not find issues with “CONNECT”, “failed”, “CONNACK” or “NOT_AUTHORIZED”.
I Just have the message from a request of IO-broker which is running on 192.168.178.12 (OH is on 192.168.178.113)

1630736423: mosquitto version 1.5.7 starting
1630736423: Config loaded from /etc/mosquitto/mosquitto.conf.
1630736423: Opening ipv4 listen socket on port 1883.
1630736423: Opening ipv6 listen socket on port 1883.
1630739347: New connection from 192.168.178.12 on port 1883.
1630739347: Socket error on client <unknown>, disconnecting.
1630739347: New connection from 192.168.178.12 on port 1883.
1630739347: Socket error on client <unknown>, disconnecting.
1630739347: New connection from 192.168.178.12 on port 1883.
1630739347: Socket error on client <unknown>, disconnecting.
...
...
...

…but I guess this has nothing to do with my issue.

Hello,
I have found in OPENHAB-CONF the following influxdb.cfg (in “services” folder):

url=http://192.168.178.113:8086
user=openhab
password=myPW
db=openhab_db
retentionPolicy=autogen

and in things folder an MQTT-thing-file with this content:

Bridge mqtt:broker:Mqtt_Home "MQTT Broker Home" @ "MQTT Home" [ 
  host="192.168.178.113",
  port=1883,
  secure="AUTO",
  qos=0,
  retain=false,
  clientid="adf3c1ed152744c090ad23ce584a94d9",
  keep_alive_time=30000,
  reconnect_time=60000,
  username="myUserName",
  password="myPW"
]

I have also seen, that this message

2021-10-23 16:00:00.491 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '192.168.178.113' with clientid 331ff2f6-a84c-4903-81c5-c18780588b74

in frontail has an other client ID.

Could it be, that this is causing my failures???

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.