-
Notifications
You must be signed in to change notification settings - Fork 0
Backup Database and syncing
The application uses two different databases:
- embedded h2 in-memory database
- backup MySQL database
The in-memory database is included in the application .war file already. It´s a fast and performant database which runs directly on the executed environment (raspberry pi). After stopping the application, every data inside this in-memory database will get lost.
You can set a backup database, to backup the measured values and configurations of the running application.
When you have configured a backup database, the application will start sync-schedulers, to sync the data between the in-memory database and the backup database, as following...
When you starts the application, the in-memory h2 database will be empty. The following entities will get loaded from the backup database and will get imported to the h2 database:
- TemperatureMeasurement: All temperature measurements will get imported
- ScheduledShutterMovements: All defined timings for the shutter movements will get imported
After starting the application, a database sync-job will get triggered, which performs every 1 minute. The following entities will get backuped:
- TemperatureMeasurement: Get the date of the latest measurement of the backup-db, then search for newer entries after this date inside the embedded-db and copy these to the backup-db
- ScheduledShuttermovements: Just delete all entries of the backup-db and insert all entries of the embedded-db