diff --git a/docs/guides/redis/backup/kubestash/customization/backup/passing-args.yaml b/docs/guides/redis/backup/kubestash/customization/backup/passing-args.yaml index a2e0e8245..baa671142 100644 --- a/docs/guides/redis/backup/kubestash/customization/backup/passing-args.yaml +++ b/docs/guides/redis/backup/kubestash/customization/backup/passing-args.yaml @@ -35,4 +35,4 @@ spec: tasks: - name: logical-backup params: - args: --clean \ No newline at end of file + args: "-db 1" \ No newline at end of file diff --git a/docs/guides/redis/backup/kubestash/customization/backup/passing-database.yaml b/docs/guides/redis/backup/kubestash/customization/backup/passing-database.yaml deleted file mode 100644 index 554ed4023..000000000 --- a/docs/guides/redis/backup/kubestash/customization/backup/passing-database.yaml +++ /dev/null @@ -1,39 +0,0 @@ -apiVersion: core.kubestash.com/v1alpha1 -kind: BackupConfiguration -metadata: - name: sample-redis-backup - namespace: demo -spec: - target: - apiGroup: kubedb.com - kind: Redis - namespace: demo - name: sample-redis - backends: - - name: gcs-backend - storageRef: - namespace: demo - name: gcs-storage - retentionPolicy: - name: demo-retention - namespace: demo - sessions: - - name: frequent-backup - scheduler: - schedule: "*/5 * * * *" - jobTemplate: - backoffLimit: 1 - repositories: - - name: gcs-redis-repo - backend: gcs-backend - directory: /redis - encryptionSecret: - name: encrypt-secret - namespace: demo - addon: - name: redis-addon - tasks: - - name: logical-backup - params: - backupCmd: rd_dump - args: testdb \ No newline at end of file diff --git a/docs/guides/redis/backup/kubestash/customization/common/gcs-backupstorage.yaml b/docs/guides/redis/backup/kubestash/customization/common/gcs-backupstorage.yaml index 5972fd3a3..553562477 100644 --- a/docs/guides/redis/backup/kubestash/customization/common/gcs-backupstorage.yaml +++ b/docs/guides/redis/backup/kubestash/customization/common/gcs-backupstorage.yaml @@ -7,11 +7,10 @@ spec: storage: provider: gcs gcs: - bucket: kubestash-qa + bucket: neaj-demo prefix: demo secretName: gcs-secret usagePolicy: allowedNamespaces: from: All - default: false - deletionPolicy: WipeOut \ No newline at end of file + deletionPolicy: Delete \ No newline at end of file diff --git a/docs/guides/redis/backup/kubestash/customization/common/s3-backupstorage.yaml b/docs/guides/redis/backup/kubestash/customization/common/s3-backupstorage.yaml index c87d26f7e..ac6ca8271 100644 --- a/docs/guides/redis/backup/kubestash/customization/common/s3-backupstorage.yaml +++ b/docs/guides/redis/backup/kubestash/customization/common/s3-backupstorage.yaml @@ -7,11 +7,11 @@ spec: storage: provider: s3 s3: - bucket: kubestash - region: us-east-1 - endpoint: us-east-1.linodeobjects.com + bucket: neaj-new + region: ap-south-1 + endpoint: ap-south-1.linodeobjects.com secretName: s3-secret - prefix: sunny + prefix: backup usagePolicy: allowedNamespaces: from: All diff --git a/docs/guides/redis/backup/kubestash/customization/common/sample-postgres.yaml b/docs/guides/redis/backup/kubestash/customization/common/sample-redis.yaml similarity index 67% rename from docs/guides/redis/backup/kubestash/customization/common/sample-postgres.yaml rename to docs/guides/redis/backup/kubestash/customization/common/sample-redis.yaml index ce97b5a41..891f43306 100644 --- a/docs/guides/redis/backup/kubestash/customization/common/sample-postgres.yaml +++ b/docs/guides/redis/backup/kubestash/customization/common/sample-redis.yaml @@ -4,15 +4,13 @@ metadata: name: sample-redis namespace: demo spec: - version: "16.1" - replicas: 3 - standbyMode: Hot - streamingMode: Synchronous + version: 7.4.0 storageType: Durable storage: + storageClassName: "standard" accessModes: - ReadWriteOnce resources: requests: storage: 1Gi - deletionPolicy: WipeOut \ No newline at end of file + deletionPolicy: Delete \ No newline at end of file diff --git a/docs/guides/redis/backup/kubestash/customization/index.md b/docs/guides/redis/backup/kubestash/customization/index.md index 4ac814220..314c75bbc 100644 --- a/docs/guides/redis/backup/kubestash/customization/index.md +++ b/docs/guides/redis/backup/kubestash/customization/index.md @@ -1,6 +1,6 @@ --- -title: PostgreSQL Backup Customization | KubeStash -description: Customizing PostgreSQL Backup and Restore process with KubeStash +title: Redis Backup Customization | KubeStash +description: Customizing Redis Backup and Restore process with KubeStash menu: docs_{{ .version }}: identifier: guides-rd-backup-customization-stashv2 @@ -21,9 +21,9 @@ In this section, we are going to show you how to customize the backup process. H ### Passing arguments to the backup process -KubeStash PostgreSQL addon uses the [rd_dumpall](https://www.redisql.org/docs/current/app-rd-dumpall.html) command by default for backups. However, you can change the dump command to [rd_dump](https://www.redisql.org/docs/current/app-rddump.html) by setting the `backupCmd` parameter under the `addon.tasks[*].params` section. You can pass supported options for either `rd_dumpall` or `rd_dump` through the `args` parameter in the same section. +KubeStash Redis addon uses [redis-dump-go](https://github.com/yannh/redis-dump-go) for backup. You can pass arguments to the redis-dump-go through args parameter under `addon.tasks[*].params` section. -The below example shows how you can pass the `--clean` to include SQL commands to clean (drop) databases before recreating them. +The below example shows how you can pass the `-db 1` to take backup only the database with index 1. ```yaml apiVersion: core.kubestash.com/v1alpha1 @@ -63,60 +63,9 @@ spec: tasks: - name: logical-backup params: - args: --clean + args: "-db 1" ``` - -### Passing a target database to the backup process - -KubeStash PostgreSQL addon uses the [rd_dumpall](https://www.redisql.org/docs/current/app-rd-dumpall.html) command by default for backups. If you want to back up a single database, you’ll need to switch the command to [rd_dump](https://www.redisql.org/docs/current/app-rddump.html). You can do this by setting `backupCmd` to `rd_dump` under the `addon.tasks[*].params` section and specifying the database name using the `args` parameter in the same section. - -The below example shows how you can set `rd_dump` and pass target database name during backup. - -```yaml -apiVersion: core.kubestash.com/v1alpha1 -kind: BackupConfiguration -metadata: - name: sample-redis-backup - namespace: demo -spec: - target: - apiGroup: kubedb.com - kind: Redis - namespace: demo - name: sample-redis - backends: - - name: gcs-backend - storageRef: - namespace: demo - name: gcs-storage - retentionPolicy: - name: demo-retention - namespace: demo - sessions: - - name: frequent-backup - scheduler: - schedule: "*/5 * * * *" - jobTemplate: - backoffLimit: 1 - repositories: - - name: gcs-redis-repo - backend: gcs-backend - directory: /redis - encryptionSecret: - name: encrypt-secret - namespace: demo - addon: - name: redis-addon - tasks: - - name: logical-backup - params: - backupCmd: rd_dump - args: testdb -``` - -> **WARNING**: Make sure that your provided database has been created before taking backup. - ### Using multiple backends You can configure multiple backends within a single `backupConfiguration`. To back up the same data to different backends, such as S3 and GCS, declare each backend in the `.spe.backends` section. Then, reference these backends in the `.spec.sessions[*].repositories` section. @@ -277,11 +226,11 @@ spec: ## Customizing Restore Process -`KubeStash` uses [psql](https://www.redisql.org/docs/current/app-psql.html) during the restore process. In this section, we are going to show how you can pass arguments to the restore process, restore a specific snapshot, run restore job as a specific user, etc. +`KubeStash` uses `redis-cli` during the restore process. In this section, we are going to show how you can pass arguments to the restore process, restore a specific snapshot, run restore job as a specific user, etc. ### Passing arguments to the restore process -You can pass any supported `psql` arguments to the restore process using the `args` field within the `addon.tasks[*].params` section. This example demonstrates how to specify a database `testdb` to connect to during the restore process. +Similar to the backup process, you can pass arguments to the restore process through the `args` field within the `addon.tasks[*].params` section. Here, we have passed --pipe-timeout argument to the redis-cli. ```yaml apiVersion: core.kubestash.com/v1alpha1 @@ -306,7 +255,7 @@ spec: tasks: - name: logical-backup-restore params: - args: --dbname=testdb + args: "--pipe-timeout 300" ``` ### Restore specific snapshot @@ -316,10 +265,10 @@ You can also restore a specific snapshot. At first, list the available snapshot ```bash $ kubectl get snapshots.storage.kubestash.com -n demo -l=kubestash.com/repo-name=gcs-redis-repo NAME REPOSITORY SESSION SNAPSHOT-TIME DELETION-POLICY PHASE AGE -gcs-redis-repo-sample-redis-backup-frequent-backup-1725257849 gcs-redis-repo frequent-backup 2024-09-02T06:18:01Z Delete Succeeded 15m -gcs-redis-repo-sample-redis-backup-frequent-backup-1725258000 gcs-redis-repo frequent-backup 2024-09-02T06:20:00Z Delete Succeeded 13m -gcs-redis-repo-sample-redis-backup-frequent-backup-1725258300 gcs-redis-repo frequent-backup 2024-09-02T06:25:00Z Delete Succeeded 8m34s -gcs-redis-repo-sample-redis-backup-frequent-backup-1725258600 gcs-redis-repo frequent-backup 2024-09-02T06:30:00Z Delete Succeeded 3m34s +gcs-redis-repo-sample-redis-backup-frequent-backup-1725257849 gcs-redis-repo frequent-backup 2024-09-02T06:18:01Z Delete Succeeded 15m +gcs-redis-repo-sample-redis-backup-frequent-backup-1725258000 gcs-redis-repo frequent-backup 2024-09-02T06:20:00Z Delete Succeeded 13m +gcs-redis-repo-sample-redis-backup-frequent-backup-1725258300 gcs-redis-repo frequent-backup 2024-09-02T06:25:00Z Delete Succeeded 8m34s +gcs-redis-repo-sample-redis-backup-frequent-backup-1725258600 gcs-redis-repo frequent-backup 2024-09-02T06:30:00Z Delete Succeeded 3m34s ``` The below example shows how you can pass a specific snapshot name in `.spec.dataSource` section. diff --git a/docs/guides/redis/backup/kubestash/customization/restore/passing-args.yaml b/docs/guides/redis/backup/kubestash/customization/restore/passing-args.yaml index d8193107f..a829fe3d3 100644 --- a/docs/guides/redis/backup/kubestash/customization/restore/passing-args.yaml +++ b/docs/guides/redis/backup/kubestash/customization/restore/passing-args.yaml @@ -20,4 +20,4 @@ spec: tasks: - name: logical-backup-restore params: - args: --dbname=testdb \ No newline at end of file + args: "--pipe-timeout 300" \ No newline at end of file