Rrd4j persistence error: 'Failed to open rrd4j database'

Dear community,

I’ve been trying to migrate from openHAB 2.5.12 for several times, but I’m experiencing issues with the rrd4j persistence. My current test system is a recently installed version on openhabian: openHAB 3.4.2 - Release Build

##        Ip = 192.168.0.127
##   Release = Raspbian GNU/Linux 11 (bullseye)
##    Kernel = Linux 6.1.21-v7+
##  Platform = Raspberry Pi 3 Model B Rev 1.2
##    Uptime = 0 day(s). 0:0:55
## CPU Usage = 51.36% avg over 4 cpu(s) (4 core(s) x 1 socket(s))
##  CPU Load = 1m: 2.45, 5m: 0.73, 15m: 0.25
##    Memory = Free: 0.20GB (21%), Used: 0.74GB (79%), Total: 0.94GB
##      Swap = Free: 2.28GB (100%), Used: 0.00GB (0%), Total: 2.28GB
##      Root = Free: 20.58GB (74%), Used: 7.16GB (26%), Total: 28.97GB
##   Updates = 0 apt updates available.
##  Sessions = 1 session(s)
## Processes = 148 running processes of 32768 maximum processes

Configuration
In this case, I did not import any backup file, but configured everything from scratch. Changes on rrd4j.cfg and rrd4j.persist have been done while openhab was not running.

  • Before changing files sudo systemctl stop openhab
  • After changing files sudo systemctl start openhab

To keep the persistence files as small as with openHAB 2 I modified the rrd4j.cfg file:

default_numeric.def=GAUGE,60,U,U,60
default_numeric.archives=LAST,0.5,1,480:LAST,0.5,4,360:LAST,0.5,14,644:LAST,0.5,60,720:LAST,0.5,720,730:LAST,0.5,10080,520

default_quantifiable.def=GAUGE,60,U,U,60
default_quantifiable.archives=AVERAGE,0.5,1,480:AVERAGE,0.5,4,360:AVERAGE,0.5,14,644:AVERAGE,0.5,60,720:AVERAGE,0.5,720,730:AVERAGE,0.5,10080,520

default_other.def=GAUGE,60,U,U,60
default_other.archives=LAST,0.5,1,480:LAST,0.5,4,360:LAST,0.5,14,644:LAST,0.5,60,720:LAST,0.5,720,730:LAST,0.5,10080,520

My rrd4j.persist file:

Strategies {
    // for rrd charts, we need a cron strategy
    everyMinute : "0 * * * * ?"

    // if no strategy is specified for an Item entry below, the default list will be used
    default = everyChange
}

Items {
    // ==================== everyChange, everyMinute ====================
    MQTT2_RAUMXTEMP1,MQTT2_RAUMXHUMID1: strategy = everyChange, everyMinute
    MQTT2_AUSSENTEMP1 : strategy = everyChange, everyMinute
}

The issue
After restarting openhab nothing will be persisted. I get these logs every minute:

2023-04-10 00:58:00.900 [WARN ] [d4j.internal.RRD4jPersistenceService] - Failed to open rrd4j database 'MQTT2_RAUMXHUMID1' to store data (java.lang.IllegalArgumentException: Archive already defined: RRA:LAST:0.5:1:480)

2023-04-10 00:58:00.903 [WARN ] [d4j.internal.RRD4jPersistenceService] - Failed to open rrd4j database 'MQTT2_RAUMXTEMP1' to store data (java.lang.IllegalArgumentException: Archive already defined: RRA:LAST:0.5:1:480)

2023-04-10 00:58:00.906 [WARN ] [d4j.internal.RRD4jPersistenceService] - Failed to open rrd4j database 'MQTT2_AUSSENTEMP1' to store data (java.lang.IllegalArgumentException: Archive already defined: RRA:LAST:0.5:1:480)

The folder /var/lib/openhab/persistence/rrd4j is empty:

pi@DINRASPPI002:/var/lib/openhab/persistence/rrd4j $ ls -l
total 4
-rwxrwxr-x 1 openhab openhab 32 13. Feb 09:59 Readme.txt

I tried '14 | Fix Permissions' with 'sudo openhabian-config'. In addition I performed 'sudo chown -R openhab:openhab /var/lib/openhab'.

I’ve already checked similar posts in the forum. I would appreciate if someone has any idea how to proceed best with further troubleshooting.

Thanks.

Why did you use the “default” names for your custom archive configs? That MIGHT cause trouble and IMHO will not change the default archive settings (which would be used by items automatically).

I suggest to use other names for the three configs and to assign items to those configs.

I tried to do the same thing today (on OH release 4.1.2) and got the same errors. I’m trying to increase the default persistence for all items, without having to specify every item in the persistence config file (and add new ones each time I make a new item).

Let me ask it this way instead: how should users adjust the default persistence settings? (Keeping rrd4j but with different settings.)

I’m sorry for answering that late!

I don’t understand. Could you explain the intended “increase”?
In order to use a custom config for specific items the file "mycustomconfig.items " has to be used. In order to select all items use the “*” should be used . Documentation
However, since rrd4j is sensible for nuneric values only, I’d rather not use it for all items.

I wanted to modify this line, for example:

default_numeric.def=GAUGE,600,U,U,10
default_numeric.archives=LAST,0.5,1,360:LAST,0.5,6,10080:LAST,0.5,90,36500:LAST,0.5,360,43800:LAST,0.5,8640,3650

Since it’s built-in (at the documentation link you shared), but I find that it’s immutable.

The “english” version of what I’m trying to do is to use a bit more storage for items which don’t get any other persistence strategy defined for them. I see your point about the “*” but what I really ought to be doing is specifying what I actually need for each item or category of item. I was just trying to be lazy :slight_smile: