reactive-tech / kubegres

Kubegres is a Kubernetes operator allowing to deploy one or many clusters of PostgreSql instances and manage databases replication, failover and backup.
https://www.kubegres.io
Apache License 2.0
1.32k stars 74 forks source link

Feature Request: Incremental backup feature in kubegres #77

Closed NiniiGit closed 2 years ago

NiniiGit commented 2 years ago

Hello All,

First of all, thank you so much for this wonderful project. I have a feature request :)

I was not able to find anywhere in documentation if does Kubegres provide incremental backup facility(just the way it is available in PostgreSQL). If not, can we please have this feature added as it would be quite helpful

Regards, Ninad

alex-arica commented 2 years ago

Thank you for your suggestion and your kind feedback about Kubegres.

Could you please provide more details about how you would see the incremental backup working if you had to do it manually?

For example, which binary would you use and the options you would pass to it?

NiniiGit commented 2 years ago

Hello @alex-arica ,

I am not much from Postgres DB background, but below links I believe could help to provide better information about how in general Postgres DB backup is been taken with example.

1) https://stackoverflow.com/questions/5529603/best-method-for-postgresql-incremental-backup

2) https://mkyong.com/database/postgresql-point-in-time-recovery-incremental-backup/#:~:text=PostgreSQL%20%E2%80%9CPoint%2Din%2Dtime,or%20may%20be%20archive%20backup.&text=This%20mechanism%20use%20the%20history,since%20last%20database%20full%20backup. Hope that helps!

Regards, Ninad

alex-arica commented 2 years ago

Thank you for those 2 links.

As per the PostgreSql documentation page that you shared, you can configure incremental backup using WAL archiving by modifying PostgreSql configuration file postgres.conf (you set a value for archive_command in that file) and by running the SQL commands SELECT pg_start_backup and SELECT pg_stop_backup.

Kubegres allows you to override postgres.conf, as explained here: https://www.kubegres.io/doc/override-default-configs.html

Please let me know if that helps.

NiniiGit commented 2 years ago

Hello Alex-arica,

Thanks for the details. Let me check if this serve my purpose and come back

Regards, Ninad

NiniiGit commented 2 years ago

Hello @alex-arica ,

Based on the content of configmap base-kubegres-config/backup_database.sh, it looks like it does but still could you confirm if Kubegres uses the db-dump mechanism which is based on the pg_dump utility of Postgres?

Regards, Ninad

alex-arica commented 2 years ago

Yes by default Kubegres uses the db-dump mechanism which is based on the pg_dump, as per the script here: https://github.com/reactive-tech/kubegres/blob/main/controllers/spec/template/yaml/BaseConfigMapTemplate.yaml#L113

NiniiGit commented 2 years ago

okay, that's great. Then I guess we can close this issue since this already has what I was looking for