Skip to content

Commit

Permalink
Fix up the MySQL backup and restore example (#238)
Browse files Browse the repository at this point in the history
The current documentation for this example is missing the steps
necessary to define the custom plans in order to trigger a backup and
a subsequent restore, so this commit adds those.
  • Loading branch information
yankcrime authored and gerred committed May 16, 2019
1 parent 9c8038a commit 706e7ce
Showing 1 changed file with 39 additions and 6 deletions.
45 changes: 39 additions & 6 deletions docs/examples/backups.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Watch the explained demo video of the steps beneath [here](https://youtu.be/e_xU

## MySQL

Create an instance of MySQL using the provided Framework
Create an instance of MySQL using the provided sample Framework:

```bash
$ kubectl apply -f config/samples/mysql.yaml
Expand All @@ -22,7 +22,7 @@ frameworkversion.kudo.k8s.io/mysql-57 created
instance.kudo.k8s.io/mysql created
```

Query the database to show
Query the database to show its schema:

```bash
MYSQL_POD=`kubectl get pods -l app=mysql,step=deploy -o jsonpath="{.items[*].metadata.name}"`
Expand All @@ -41,11 +41,28 @@ kubectl exec -it $MYSQL_POD -- mysql -ppassword -e "select * from example;" kud


## Take a backup
Define and execute a custom plan in order to take a backup:

```bash
kubectl kudo start -n mysql -p backup
cat <<EOF | kubectl apply -f -
apiVersion: kudo.k8s.io/v1alpha1
kind: PlanExecution
metadata:
labels:
framework-version: mysql-57
instance: mysql
name: mysql-backup
namespace: default
spec:
instance:
kind: Instance
name: mysql
namespace: default
planName: backup
EOF
```


## Delete data from the database

```bash
Expand All @@ -54,13 +71,29 @@ kubectl exec -it $MYSQL_POD -- mysql -ppassword -e "select * from example;" kud
```

## Perform a restore
Similar to the backup step, define and execute the restore:

```bash
kubectl kudo start -n mysql -p restore
cat <<EOF | kubectl apply -f -
apiVersion: kudo.k8s.io/v1alpha1
kind: PlanExecution
metadata:
labels:
framework-version: mysql-57
instance: mysql
name: mysql-restore
namespace: default
spec:
instance:
kind: Instance
name: mysql
namespace: default
planName: restore
EOF
```

And then query to see the data from before
And then query to see the data from before:

```bash
kubectl exec -it $MYSQL_POD -- mysql -ppassword -e "select * from example;" kudo
```
```

0 comments on commit 706e7ce

Please sign in to comment.