Skip to content

Commit 6845255

Browse files
committed
doc: Simplify the use of NFS backup.
1 parent 21f3db7 commit 6845255

File tree

3 files changed

+86
-119
lines changed

3 files changed

+86
-119
lines changed

docs/deploy_backup_restore_nfs.md

Lines changed: 0 additions & 64 deletions
This file was deleted.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Quickstart for NFS backup
2+
## Install NFS server
3+
4+
### 1. Prepare Storage
5+
6+
Create the NFS PV and SC.
7+
8+
```
9+
kubectl apply -f config/samples/nfs_pv.yaml
10+
```
11+
12+
> You can specify the PVC you created by modifying the `persistentVolumeClaim.claimName` in the `config/samples/nfs_server.yaml`.
13+
14+
### 2. Create nfs server
15+
16+
Create ReplicationController and Service.
17+
18+
```
19+
kubectl apply -f config/samples/nfs_server.yaml
20+
```
21+
22+
Get `NFSServerAddress`.
23+
24+
```
25+
# example
26+
kubectl get svc nfs-server --template={{.spec.clusterIP}}
27+
10.96.253.82
28+
```
29+
30+
## Create a NFS backup
31+
32+
### 1. Configure address of NFS Server.
33+
34+
```yaml
35+
# config/samples/mysql_v1alpha1_backup.yaml
36+
NFSServerAddress: "10.96.253.82"
37+
```
38+
39+
### 2. Create a backup
40+
41+
```shell
42+
kubectl apply -f config/samples/mysql_v1alpha1_backup.yaml
43+
```
44+
45+
> Notice: backup cr and mysqlcluster cr must be in the same namespace.
46+
### 3. Verify your backup
47+
48+
You can find the backup folder called `<cluster name>_<timestamp>`.
49+
50+
```
51+
kubectl exec -it <pod name of nfs server> -- ls /exports
52+
index.html initbackup sample_2022419101946
53+
```
54+
55+
## Restore cluster from exist NFS backup
56+
57+
Configure the `mysql_v1alpha1_cluster.yaml`, uncomment the `nfsServerAddress` field and fill in your own configuration.
58+
59+
```yaml
60+
...
61+
restoreFrom: "sample_2022419101946"
62+
nfsServerAddress: 10.96.253.82
63+
```
64+
65+
> Notice: restoreFrom is the folder name of a backup. You can find it on the path mounted in NFS Server.
66+
67+
Create cluster from NFS server backup copy:
68+
69+
```
70+
kubectl apply -f config/samples/mysql_v1alpha1_cluster.yaml
71+
```
72+
73+
## Build your own image
74+
75+
```
76+
docker build -f Dockerfile.sidecar -t acekingke/sidecar:0.1 . && docker push acekingke/sidecar:0.1
77+
docker build -t acekingke/controller:0.1 . && docker push acekingke/controller:0.1
78+
```
79+
> You can replace acekingke/sidecar:0.1 with your own tag
80+
81+
## Deploy your own manager
82+
```shell
83+
make manifests
84+
make install
85+
make deploy IMG=acekingke/controller:0.1 KUSTOMIZE=~/radondb-mysql-kubernetes/bin/kustomize
86+
```

docs/en-us/deploy_backup_restore_s3.md

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -111,58 +111,3 @@ kubectl apply -f config/samples/mysql_v1alpha1_mysqlcluster.yaml
111111
could restore a cluster from the `backup_2021720827 ` copy in the S3 bucket.
112112

113113
if you want backup to NFS server or restore from NFS server, do it as follow:
114-
115-
## Quickstart for NFS backup
116-
117-
### Create NFS server
118-
first create your PVC, such as "neosan1", fill it to `config/samples/nfs_rc.yaml `
119-
```yaml
120-
...
121-
volumes:
122-
- name: nfs-export-fast
123-
persistentVolumeClaim:
124-
claimName: neosan1
125-
```
126-
```shell
127-
# create the nfs pod
128-
kubectl apply -f config/samples/nfs_rc.yaml
129-
# create the nfs service
130-
kubectl apply -f config/samples/nfs_server.yaml
131-
```
132-
if create the nfs server successful, get the then:
133-
134-
## config `mysql_v1alpha1_backup.yaml ` and backup
135-
Add field in `mysql_v1alpha1_backup.yaml ` as follow:
136-
```yaml
137-
BackupToNFS: "IP of NFS server"
138-
```
139-
use commadn as follow to backup
140-
```shell
141-
kubectl apply -f config/samples/mysql_v1alpha1_backup.yaml
142-
```
143-
144-
## Restore cluster from exist NFS backup
145-
first, configure the `mysql_v1alpha1_cluster.yaml`, uncomment the `restoreFromNFS` field:
146-
```yaml
147-
....
148-
restoreFrom: "backup_202196152239"
149-
restoreFromNFS : 10.96.253.82
150-
```
151-
`backup_202196152239` is the nfs server backup path, change it to yours.
152-
the `10.96.253.82` is the NFS server ip, change it to yours.
153-
use command as follow to create cluster from NFS server backup copy:
154-
155-
## build your own image
156-
such as :
157-
```
158-
docker build -f Dockerfile.sidecar -t acekingke/sidecar:0.1 . && docker push acekingke/sidecar:0.1
159-
docker build -t acekingke/controller:0.1 . && docker push acekingke/controller:0.1
160-
```
161-
you can replace acekingke/sidecar:0.1 with your own tag
162-
163-
## deploy your own manager
164-
```shell
165-
make manifests
166-
make install
167-
make deploy IMG=acekingke/controller:0.1 KUSTOMIZE=~/radondb-mysql-kubernetes/bin/kustomize
168-
```

0 commit comments

Comments
 (0)