Skip to content
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

Option for compact the database #10

Closed
etofi opened this issue Jun 29, 2020 · 2 comments · Fixed by #11
Closed

Option for compact the database #10

etofi opened this issue Jun 29, 2020 · 2 comments · Fixed by #11

Comments

@etofi
Copy link

etofi commented Jun 29, 2020

Is it possible to add the following two environment variables to make the database smaller?

  1. CONFIG_COMPACT_CRON
    Specifies in the normal cronjob format how often the compression should be executed (for example "* * 1 * *")
    If there is nothing in it, there is no compression.

  2. CONFIG_COMPACT_KEEP_MONTH
    Number of months you want to keep data (for example "12")

Then at the time defined in the variable CONFIG_COMPACT_CRON a script has to be executed which does the following one after the other.

  1. Stop CCU-Historian
  2. java -jar /opt/ccu-historian/ccu-historian.jar -clean $(date -d="CONFIG_COMPACT_KEEP_MONTH month ago" +%Y-%m-%d)
  3. java -jar /opt/ccu-historian/ccu-historian.jar -recalc
  4. java -jar /opt/ccu-historian/ccu-historian.jar -compact
  5. Start CCU-Historian

This would be great.

@jokay
Copy link
Owner

jokay commented Jun 29, 2020

This seems indeed very useful.

I will look into this as soon as I have some spare time 👍

@jokay
Copy link
Owner

jokay commented Jul 19, 2020

I think the main problem would be 1. Stop CCU-Historian as it would stop the container as well.

But may be I could add CONFIG_KEEP_MONTHS only so it can be executed (-clean, -recalc, -compact) before the start of CCU-Historian.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants