Using my old oh2 influxdb database for oh3?

Hello,

Can somebody explain me if it is possible to use the old influxdb database feeded by openHAB2 with the new openHAB3? I want to take over all the old item names, but I get the impression by reading here in the forum that this is not possible. Am I right or is there no problem to do it?

Thank you!

Early on in the first milestone releases of OH 3 there was a bug in the new influxdb add-on. That bug has long since been fixed. You should be able to use your old database with OH 3.

Ok, thank you, I will give it a try. Which database version is used for oh2? influxdb1 or influxdb2?

Ok, I have tried to configure a connection but I get the following error:

2020-12-17 11:37:39.927 [WARN ] [rnal.influx1.InfluxDB1RepositoryImpl] - database error: java.net.ConnectException: Failed to connect to /192.168.2.110:8086

org.influxdb.InfluxDBIOException: java.net.ConnectException: Failed to connect to /192.168.2.110:8086

	at org.influxdb.impl.InfluxDBImpl.ping(InfluxDBImpl.java:395) ~[bundleFile:?]

	at org.openhab.persistence.influxdb.internal.influx1.InfluxDB1RepositoryImpl.checkConnectionStatus(InfluxDB1RepositoryImpl.java:86) [bundleFile:?]

	at org.openhab.persistence.influxdb.internal.influx1.InfluxDB1RepositoryImpl.connect(InfluxDB1RepositoryImpl.java:72) [bundleFile:?]

	at org.openhab.persistence.influxdb.InfluxDBPersistenceService.activate(InfluxDBPersistenceService.java:112) [bundleFile:?]

	at org.openhab.persistence.influxdb.InfluxDBPersistenceService.modified(InfluxDBPersistenceService.java:149) [bundleFile:?]

	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]

	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]

	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]

	at org.apache.felix.scr.impl.inject.methods.BaseMethod.invokeMethod(BaseMethod.java:228) [bundleFile:?]

	at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41) [bundleFile:?]

	at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:664) [bundleFile:?]

	at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:510) [bundleFile:?]

	at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:317) [bundleFile:?]

	at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:307) [bundleFile:?]

	at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeModifiedMethod(SingleComponentManager.java:836) [bundleFile:?]

	at org.apache.felix.scr.impl.manager.SingleComponentManager.modify(SingleComponentManager.java:791) [bundleFile:?]

	at org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(SingleComponentManager.java:709) [bundleFile:?]

	at org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(SingleComponentManager.java:673) [bundleFile:?]

	at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.configurationUpdated(ConfigurableComponentHolder.java:435) [bundleFile:?]

	at org.apache.felix.scr.impl.manager.RegionConfigurationSupport.configurationEvent(RegionConfigurationSupport.java:316) [bundleFile:?]

	at org.apache.felix.scr.impl.manager.RegionConfigurationSupport$2.configurationEvent(RegionConfigurationSupport.java:118) [bundleFile:?]

	at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:1709) [bundleFile:?]

	at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:1651) [bundleFile:?]

	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:138) [bundleFile:?]

	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:105) [bundleFile:?]

	at java.lang.Thread.run(Thread.java:834) [?:?]

Caused by: java.net.ConnectException: Failed to connect to /192.168.2.110:8086

	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:265) ~[bundleFile:?]

	at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:183) ~[bundleFile:?]

	at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.java:224) ~[bundleFile:?]

	at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.java:108) ~[bundleFile:?]

	at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.java:88) ~[bundleFile:?]

	at okhttp3.internal.connection.Transmitter.newExchange(Transmitter.java:169) ~[bundleFile:?]

	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:41) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) ~[bundleFile:?]

	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) ~[bundleFile:?]

	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) ~[bundleFile:?]

	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) ~[bundleFile:?]

	at org.influxdb.impl.BasicAuthInterceptor.intercept(BasicAuthInterceptor.java:22) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) ~[bundleFile:?]

	at org.influxdb.impl.GzipRequestInterceptor.intercept(GzipRequestInterceptor.java:42) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) ~[bundleFile:?]

	at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:152) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) ~[bundleFile:?]

	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:229) ~[bundleFile:?]

	at okhttp3.RealCall.execute(RealCall.java:81) ~[bundleFile:?]

	at retrofit2.OkHttpCall.execute(OkHttpCall.java:188) ~[bundleFile:?]

	at org.influxdb.impl.InfluxDBImpl.ping(InfluxDBImpl.java:381) ~[bundleFile:?]

	... 26 more

Caused by: java.net.ConnectException: Connection refused (Connection refused)

	at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:?]

	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399) ~[?:?]

	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242) ~[?:?]

	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224) ~[?:?]

	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403) ~[?:?]

	at java.net.Socket.connect(Socket.java:609) ~[?:?]

	at okhttp3.internal.platform.Platform.connectSocket(Platform.java:130) ~[bundleFile:?]

	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:263) ~[bundleFile:?]

	at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:183) ~[bundleFile:?]

	at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.java:224) ~[bundleFile:?]

	at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.java:108) ~[bundleFile:?]

	at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.java:88) ~[bundleFile:?]

	at okhttp3.internal.connection.Transmitter.newExchange(Transmitter.java:169) ~[bundleFile:?]

	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:41) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) ~[bundleFile:?]

	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) ~[bundleFile:?]

	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) ~[bundleFile:?]

	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) ~[bundleFile:?]

	at org.influxdb.impl.BasicAuthInterceptor.intercept(BasicAuthInterceptor.java:22) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) ~[bundleFile:?]

	at org.influxdb.impl.GzipRequestInterceptor.intercept(GzipRequestInterceptor.java:42) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) ~[bundleFile:?]

	at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:152) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) ~[bundleFile:?]

	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) ~[bundleFile:?]

	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:229) ~[bundleFile:?]

	at okhttp3.RealCall.execute(RealCall.java:81) ~[bundleFile:?]

	at retrofit2.OkHttpCall.execute(OkHttpCall.java:188) ~[bundleFile:?]

	at org.influxdb.impl.InfluxDBImpl.ping(InfluxDBImpl.java:381) ~[bundleFile:?]

	... 26 more 

user ,password and db is the same like in my OH2 config… what is the problem here?

Thank you for your help!

The host part of the error message looks a bit strange

as I am not quite sure if this ( the leading slash ) is normal or not I would suggest to check if the host definition is correct.

You are right, but I have tried it with a few spaces in front of the http and than you can see the right address in the log but with the same error. Also the same with text file configuration. Seems like a bug of the logging.

Have you tried to manually connect to the influxdb to check if it is up and running?

influx -username YourAccount -password YourPassword -host YourHost -port YourPort -database YourDB

To show the databases ( needs to be executed with admin privileges ):

show databases;

The connection was refused… is it possible that only one connection per user to influx is possible? Oh2 is connected and writes data to the openhab database…

I did a minor modification to my previous post.
As far as I can see privileges are required to run “show databases”.
To connect as normal user to a database the db needs to be a separate parameter.
I connected two times with normal user privleges to an openhab influxdb at the same time.

connection still refused, even if I stop oh2.

In one of your answers you wrote ( as least that’s how I understand your reply ) that the host contains the http string. The influx command arguments that I provided do not have http in the host name.
e.g. I use

influx -username openhab -password habopen -database openhab_db -host localhost -port 8086

to test the connection to the db on localhost.

I am still getting this error for switch items.

2020-12-18 15:27:01.772 [ERROR] [org.influxdb.impl.BatchProcessor ] - Batch could not be sent. Data will be lost
org.influxdb.InfluxDBException$FieldTypeConflictException: partial write: field type conflict: input field “value” on measurement “Network_Rpi_Audio_Attic” is type integer, already exists as type float dropped=1
at org.influxdb.InfluxDBException.buildExceptionFromErrorMessage(InfluxDBException.java:144) ~[bundleFile:?]
at org.influxdb.InfluxDBException.buildExceptionForErrorState(InfluxDBException.java:173) ~[bundleFile:?]
at org.influxdb.impl.InfluxDBImpl.execute(InfluxDBImpl.java:827) ~[bundleFile:?]
at org.influxdb.impl.InfluxDBImpl.write(InfluxDBImpl.java:460) ~[bundleFile:?]
at org.influxdb.impl.OneShotBatchWriter.write(OneShotBatchWriter.java:22) ~[bundleFile:?]
at org.influxdb.impl.BatchProcessor.write(BatchProcessor.java:340) [bundleFile:?]
at org.influxdb.impl.BatchProcessor$1.run(BatchProcessor.java:287) [bundleFile:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]

I am running on RC1 with the same influxdb version i used with OH2.
Am i missing something?

Ok, thank you, I think we are coming closer to the problem. On my oh2 machine and your expression with localhost I can connect, but if I am using the ip adress the connection is refused:

Failed to connect to http://192.168.2.110:8086: Get http://192.168.2.110:8086/ping: dial tcp 192.168.2.110:8086: connect: connection refused
Please check your connection settings and ensure ‘influxd’ is running.

Is it possible that the ip has to be bind to the influx port or something like that?

Thank you for your help!

I think you have to configure this in the influxdb server

Does this ( of course you need to adapt the parameters to you local environment ) work from your remote
computer ?

curl -G http://YourComputer:8086/query?db=openhab_db -u openhab:habopen --data-urlencode "q=SHOW series"

This should show the items that are ‘tracked’ in influxdb.

Yeah, now it is running, I had to reconfigure the parameter bind address in the influxdb.conf. Now I can use my old database. Thank you very much!

@ysc: I have data from the last 2 years in my database and I can use them for the charts. The last 2 Months and the last 4 Months are running, with loading time, but a plot of a larger time period end with a complete reload of the chart with the predefined time period ( in my case 2 weeks). In grafana the plot is no Probleme and very fast… Do you have any idea what’s the matter?

Didn’t you have the Problem with Switch types. Converting from int to float while using the old Database?

Is this a failure you get in the log when a switch is changing his state?

yes,
reported here as well:
https://github.com/openhab/openhab-addons/issues/9037

Hello,
Can somebody explain how to transfer the influxdb database from openHAB2.5 to openHAB3?
All posts above are about the error, but can’t find the exact steps how to transfer?

Kind regards, Hans