Skip to content

Commit

Permalink
Add MySQL backup/restore process by using KubeStash (#668)
Browse files Browse the repository at this point in the history
Signed-off-by: Anisur Rahman <[email protected]>
  • Loading branch information
anisurrahman75 authored Sep 25, 2024
1 parent dc4d44c commit 2af21a5
Show file tree
Hide file tree
Showing 80 changed files with 3,648 additions and 38 deletions.
2 changes: 1 addition & 1 deletion docs/guides/mysql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ aliases:
## User Guide

- [Quickstart MySQL](/docs/guides/mysql/quickstart/index.md) with KubeDB Operator.
- [Backup & Restore](/docs/guides/mysql/backup/overview/index.md) MySQL databases using Stash.
- [Backup & Restore](/docs/guides/mysql/backup/stash/overview/index.md) MySQL databases using Stash.
- Initialize [MySQL with Script](/docs/guides/mysql/initialization/index.md).
- Monitor your MySQL database with KubeDB using [out-of-the-box Prometheus operator](/docs/guides/mysql/monitoring/prometheus-operator/index.md).
- Monitor your MySQL database with KubeDB using [out-of-the-box builtin-Prometheus](/docs/guides/mysql/monitoring/builtin-prometheus/index.md).
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/mysql/autoscaler/compute/cluster/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ spec:
Let's create the `MySQL` CRO we have shown above,

```bash
$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/mysql/autoscaler/compute/cluster/examples/sample-druid.yaml
$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/mysql/autoscaler/compute/cluster/examples/sample-mysql.yaml
mysql.kubedb.com/sample-mysql created
```

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/mysql/autoscaler/storage/cluster/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ spec:
Let's create the `MySQL` CRO we have shown above,

```bash
$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/mysql/autoscaler/storage/cluster/examples/sample-druid.yaml
$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/mysql/autoscaler/storage/cluster/examples/sample-mysql.yaml
mysql.kubedb.com/sample-mysql created
```

Expand Down
10 changes: 10 additions & 0 deletions docs/guides/mysql/backup/kubestash/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Backup & Restore MySQL | KubeStash
menu:
docs_{{ .version }}:
identifier: guides-mysql-backup-stashv2
name: KubeStash (aka Stash 2.0)
parent: guides-mysql-backup
weight: 50
menu_name: docs_{{ .version }}
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: core.kubestash.com/v1alpha1
kind: BackupConfiguration
metadata:
name: sample-mysql-backup
namespace: demo
spec:
target:
apiGroup: kubedb.com
kind: MySQL
namespace: demo
name: sample-mysql
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-mysql-repo
backend: gcs-backend
directory: /mysql
encryptionSecret:
name: encrypt-secret
namespace: demo
addon:
name: mysql-addon
tasks:
- name: manifest-backup
- name: logical-backup
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: storage.kubestash.com/v1alpha1
kind: BackupStorage
metadata:
name: gcs-storage
namespace: demo
spec:
storage:
provider: gcs
gcs:
bucket: kubestash-qa
prefix: demo
secretName: gcs-secret
usagePolicy:
allowedNamespaces:
from: All
default: true
deletionPolicy: Delete
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: core.kubestash.com/v1alpha1
kind: RestoreSession
metadata:
name: restore-sample-mysql
namespace: demo
spec:
manifestOptions:
mySQL:
db: true
restoreNamespace: dev
dataSource:
repository: gcs-mysql-repo
snapshot: latest
encryptionSecret:
name: encrypt-secret
namespace: demo
addon:
name: mysql-addon
tasks:
- name: logical-backup-restore
- name: manifest-restore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: storage.kubestash.com/v1alpha1
kind: RetentionPolicy
metadata:
name: demo-retention
namespace: demo
spec:
default: true
failedSnapshots:
last: 2
maxRetentionPeriod: 2mo
successfulSnapshots:
last: 5
usagePolicy:
allowedNamespaces:
from: All
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: kubedb.com/v1
kind: MySQL
metadata:
name: sample-mysql
namespace: demo
spec:
version: "8.2.0"
replicas: 3
topology:
mode: GroupReplication
storageType: Durable
storage:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Mi
deletionPolicy: WipeOut
Loading

0 comments on commit 2af21a5

Please sign in to comment.