Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
Signed-off-by: SK Ali Arman <[email protected]>
  • Loading branch information
sheikh-arman committed Dec 3, 2024
1 parent c474c1a commit 5b73374
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 57 deletions.
17 changes: 11 additions & 6 deletions docs/guides/mysql/pitr/restic/archiver.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ spec:
from: All
deletionPolicy: WipeOut
```
Note: Before applying this yaml, verify that a bucket named `mysql-xtrabackup` is already created

```bash
$ kubectl apply -f backupstorage.yaml
Expand Down Expand Up @@ -106,7 +107,7 @@ retentionpolicy.storage.kubestash.com/mysql-retention-policy created
```

### MySQLArchiver
MySQLArchiver is a CR provided by KubeDB for managing the archiving of MySQL binlog files and performing volume-level backups
MySQLArchiver is a CR provided by KubeDB for managing the archiving of MySQL binlog files and performing physical backups

```yaml
apiVersion: archiver.kubedb.com/v1alpha1
Expand Down Expand Up @@ -166,11 +167,13 @@ stringData:
```bash
$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/mysql/pitr/restic/yamls/mysqlarchiver.yaml
mysqlarchiver.archiver.kubedb.com/mysqlarchiver-sample created
$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/mysql/pitr/restic/yamls/encryptionSecret.yaml
secret/encrypt-secret created
```

# Deploy MySQL
So far we are ready with setup for continuously archive MySQL, We deploy a mysql object referring the MySQL archiver object
We are now ready with the setup for continuous MySQL archiving. We will deploy a MySQL object that references the MySQL archiver object.

```yaml
apiVersion: kubedb.com/v1
Expand Down Expand Up @@ -335,7 +338,7 @@ spec:
name: encrypt-secret
namespace: demo
fullDBRepository:
name: mysql-repository
name: mysql-full
namespace: demo
recoveryTimestamp: "2024-12-02T06:38:42Z"
version: "8.2.0"
Expand Down Expand Up @@ -405,7 +408,7 @@ mysql> select count(*) from demo_table;
The ReplicationStrategy determines how MySQL restores are managed when using the Restic driver in a group replication setup. We support three strategies: `none`, `sync`, and `fscopy`, with `none` being the default.
To configure the desired strategy, set the spec.init.archiver.replicationStrategy field in your configuration. These strategies are applicable only when restoring a MySQL database in group replication mode.
To configure the desired strategy, set the `spec.init.archiver.replicationStrategy` field in your MySQL Database manifest. These strategies are applicable only when restoring a MySQL database in group replication mode.
**Strategies Overview:**
Expand All @@ -419,9 +422,11 @@ The base backup and binlog files are restored exclusively on pod-0. Other replic
***fscopy***
The base backup and binlog files are restored on pod-0. The data is then copied from pod-0's data directory to the data directories of other replicas using file system copy. Once the data transfer is complete, the group replication process begins. Please note that `fscopy` does not support cross-zone operations.
The base backup and binlog files are restored on pod-0. The data is then copied from pod-0's data directory to the data directories of other replicas using file system copy. Once the data transfer is complete, the group replication process begins.
Please note that `fscopy` does not support cross-zone operations.
Choose the replication strategy that best fits your restoration and replication requirements. On this demonstration, we have used the sync replication strategy.
Choose the replication strategy that best fits your restoration and replication requirements. On this demonstration, we have used the `sync` replication strategy.
## Cleaning up
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/mysql/pitr/restic/yamls/mysql-restore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
name: encrypt-secret
namespace: demo
fullDBRepository:
name: mysql-repository
name: mysql-full
namespace: demo
recoveryTimestamp: "2024-12-02T06:38:42Z"
version: "8.2.0"
Expand Down
51 changes: 2 additions & 49 deletions docs/guides/mysql/pitr/restic/yamls/mysqlarchiver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,65 +15,19 @@ spec:
matchLabels:
archiver: "true"
retentionPolicy:
name: rp
name: mysql-retention-policy
namespace: demo
encryptionSecret:
name: "encrypt-secret"
namespace: "demo"
fullBackup:
driver: "Restic"
# driver: "VolumeSnapshotter"
# task:
# params:
## volumeSnapshotClassName: "vs-gke"
# volumeSnapshotClassName: "longhorn-snapshot-vsc"
scheduler:
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 1
schedule: "0 0 * * *"
sessionHistoryLimit: 2
# jobTemplate:
# spec:
# containerSecurityContext:
# allowPrivilegeEscalation: false
# capabilities:
# drop:
# - ALL
# securityContext:
# seccompProfile:
# type: RuntimeDefault
# runAsNonRoot: true
# runAsUser: 999
# runAsGroup: 999
# volumeMounts:
# - mountPath: /var/lib/mysql
# name: data
# affinity:
# podAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# - labelSelector:
# matchLabels:
# kubedb.com/role: primary
# app.kubernetes.io/instance: mysql
# topologyKey: "kubernetes.io/hostname"
# volumes:
# - name: data
# persistentVolumeClaim:
# claimName: data-mysql-0
manifestBackup:
# jobTemplate:
# spec:
# containerSecurityContext:
# allowPrivilegeEscalation: false
# capabilities:
# drop:
# - ALL
# securityContext:
# seccompProfile:
# type: RuntimeDefault
# runAsNonRoot: true
# runAsUser: 999
# runAsGroup: 999
scheduler:
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 1
Expand All @@ -82,5 +36,4 @@ spec:
backupStorage:
ref:
name: "storage"
namespace: "demo"
# subDir: "new_sub2"
namespace: "demo"
2 changes: 1 addition & 1 deletion docs/guides/mysql/pitr/restic/yamls/retention-policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ metadata:
spec:
maxRetentionPeriod: "30d"
successfulSnapshots:
last: 100
last: 10
failedSnapshots:
last: 2

0 comments on commit 5b73374

Please sign in to comment.