Some thoughts: you may not get all your requirements met by one service (especially lightweight and all the functionality you want); keep in my mind that persistence may do a lot of writing, so if you run your RPI with an SD-card, this will wear out your card faster, you may need a NAS, SSD, or HD connected to your RPI.
- one of the most popular solution seems to be grafana and influxDB (there are tutorials: InfluxDB+Grafana persistence and graphing), however, this combo may be a little heavy on a RPI, but it is possible and there is a lot of help available in the forum; OpenHabian comes preconfigured with influxDB, I believe, otherwise there is more work to install the database
- personally, as I have only very modest graphing needs, I am using mapdb for restoring values on startup (mapdb stores all item values irrespective of the type, but only one value per item, so is not suitable for graphing or anything else really; but come with OH2, just activate persistence, write a strategy and you are done. For all others I am using rrd4j; I like the idea of a fixed database size; but rrd4j does only store numerical values; also here no need to install a separate database
- MySQL and MariaDB is also frequently used, just search the forum; but again considered too heavy for the RPI (at least if you persist a lot and for a long time)