Difference between revisions of "Kubernetes Backup and Restore"
(9 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
==Acessing your cluster== | ==Acessing your cluster== | ||
Use your credentials to access the worker node of the kubernetes deployment. All the data of the deployment is stored on ~\mount and all underneath directory. Please refer the below diagram. | |||
<syntaxHighlight source lang=shell> | |||
~\mount | |||
| | |||
|- backup | |||
|- images | |||
|- mariadb | |||
|- restore | |||
|- images | |||
|- mariadb | |||
|- images | |||
|- mariadb | |||
</syntaxHighlight> | |||
Please noted that backup files are stored in ~\mount\backup\, and files as the result of the backup process will be stored in respective folder. | |||
==Performing the Backup== | ==Performing the Backup== | ||
To perform the backup, please log-in into master node of your kubernetes deployment using your credentials, and navigate to folder ~\CleanSlate\k8s_dep. At this folder you will find .\db-backup.sh shell script. This script will perform the backup process from mariadb and mediawiki pod and put the backup result on the worker's node folder as stated in above section. | |||
When you issue the command | |||
./db-backup.sh | |||
--------------------------------------------------- | |||
This script will create database backup on folder | |||
~/mount/backup/mariadb/cleanslate_bak_08_29_2021_1548.sql.gz | |||
~/mount/backup/images/mediafile_08_29_2021_1548.zip | |||
--------------------------------------------------- | |||
The script will create files as shown above, once the process is complete, you can inspect the files in worker's node generated by issuing ls command | |||
ls ~/mount/backup/images | |||
ls ~/mount/backup/mariadb | |||
which will show you the files generated as the backup script displayed. | |||
==Performing the Restore== | ==Performing the Restore== | ||
To perform the restore, please log-in into master node of your kubernetes deployment using your credentials, and navigate to folder ~\CleanSlate\k8s_dep. At this folder you will find .\db-restore.sh shell script. This script will perform the restore process from mariadb and mediawiki pod from stated file. File location will be supplied from shell script parameters. | |||
Backup script must be supplied with two parameter | |||
# Database backup filename | |||
# Images file backup filename | |||
below are the example of the restore script command | |||
./db-restore.sh mediafile0809.zip backup0809.sql.gz | |||
meaning, that the restore script will take ~\mount\restore\images\mediafile0809.zip to restore all media file, and ~\mount\restore\mariadb\backup0809.sql.gz as database file. | |||
When you issue the command, below are the sample output. | |||
<syntaxHighlight lang=shell> | |||
--------------------------------------------------- | |||
This script will restore: | |||
database file : /mount/restore/mariadb/mediafile0809.zip | |||
images file : /mount/restore/images/backup0809.sql.gz | |||
Caution, existing content will be replaced | |||
--------------------------------------------------- | |||
Press any key to continue or ctrl-C to cancel | |||
</syntaxHighlight> | |||
After the process is completed, please inspect the mediaWiki content by accessing your mediaWiki landing page URL. Please also noted that you must perform the backup of all the data before performing the restoration process, since it will replaced you current data. |
Latest revision as of 16:08, 29 August 2021
Foreword
This document is prepared as administrator's guide of MediaWiki implementation on kubernetes to perform backup and restore. Backup and restore will cover for both database stored in mySQL and image media stored in MediaWiki file system.
What you need to perform the task is the console access to worker node of kubernetes' deployment.
Acessing your cluster
Use your credentials to access the worker node of the kubernetes deployment. All the data of the deployment is stored on ~\mount and all underneath directory. Please refer the below diagram.
~\mount
|
|- backup
|- images
|- mariadb
|- restore
|- images
|- mariadb
|- images
|- mariadb
Please noted that backup files are stored in ~\mount\backup\, and files as the result of the backup process will be stored in respective folder.
Performing the Backup
To perform the backup, please log-in into master node of your kubernetes deployment using your credentials, and navigate to folder ~\CleanSlate\k8s_dep. At this folder you will find .\db-backup.sh shell script. This script will perform the backup process from mariadb and mediawiki pod and put the backup result on the worker's node folder as stated in above section.
When you issue the command
./db-backup.sh --------------------------------------------------- This script will create database backup on folder ~/mount/backup/mariadb/cleanslate_bak_08_29_2021_1548.sql.gz ~/mount/backup/images/mediafile_08_29_2021_1548.zip ---------------------------------------------------
The script will create files as shown above, once the process is complete, you can inspect the files in worker's node generated by issuing ls command
ls ~/mount/backup/images ls ~/mount/backup/mariadb
which will show you the files generated as the backup script displayed.
Performing the Restore
To perform the restore, please log-in into master node of your kubernetes deployment using your credentials, and navigate to folder ~\CleanSlate\k8s_dep. At this folder you will find .\db-restore.sh shell script. This script will perform the restore process from mariadb and mediawiki pod from stated file. File location will be supplied from shell script parameters.
Backup script must be supplied with two parameter
- Database backup filename
- Images file backup filename
below are the example of the restore script command
./db-restore.sh mediafile0809.zip backup0809.sql.gz
meaning, that the restore script will take ~\mount\restore\images\mediafile0809.zip to restore all media file, and ~\mount\restore\mariadb\backup0809.sql.gz as database file. When you issue the command, below are the sample output.
---------------------------------------------------
This script will restore:
database file : /mount/restore/mariadb/mediafile0809.zip
images file : /mount/restore/images/backup0809.sql.gz
Caution, existing content will be replaced
---------------------------------------------------
Press any key to continue or ctrl-C to cancel
After the process is completed, please inspect the mediaWiki content by accessing your mediaWiki landing page URL. Please also noted that you must perform the backup of all the data before performing the restoration process, since it will replaced you current data.