Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
self_data_technical_doc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
Factory
LLLE_Project
self_data_technical_doc
Merge requests
!37
feat: updated backup doc
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
feat: updated backup doc
backup-doc
into
master
Overview
0
Commits
1
Pipelines
0
Changes
1
Merged
Rémi PAILHAREY
requested to merge
backup-doc
into
master
1 year ago
Overview
0
Commits
1
Pipelines
0
Changes
1
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
b1cb22c7
1 commit,
1 year ago
1 file
+
8
−
14
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
docs/ecolyo-agent/technical/backup.md
+
8
−
14
Options
@@ -2,26 +2,20 @@
## Principles
In the docker-compose.yml, there is a service called "database-backup" whose only purpose is to run automatic backups of the database.
It is running a crontab that execute the backup.sh script every day at midnight.
The dump of the database are stored in folders name like this : "ecolyo-agent-YEAR-MONTH-DAY-HOUR-MINUTE-SECOND". Only the 14 last days are stored.
The location of the backup folder on the server is specified in the volumes of the "database-backup" service, in the docker-compose file.
Backups are scheduled automatically with the help of CronJobs on Openshift.
## Backup manually
To backup manually, run this command :
To backup manually,
use
`oc login`
and
`oc project`
to authenticate to the correct namespace, then
run this command :
```
sh
d
oc
ker
exec
-it
ecolyo-agent_database-backup_1 sh /etc/cron.d/backup.sh
oc
create job
--from
cronjob/mysql-dump-cronjob-hourly nom_du_job
```
## Restore manually
To restore a specific dump, run this command replacing YEAR etc.. by the date of the wanted backup :
```
sh
docker
exec
-it
ecolyo-agent_database-backup_1 sh /etc/cron.d/restore.sh ecolyo-agent-YEAR-MONTH-DAY-HOUR-MINUTE-SECOND
``
`
-
Monter un pod du déploiement "database-restore"
-
Rentrer dans le terminal de ce pod
-
Aller dans le dossier des dumps horaires
`cd /dump/hourly`
ou journaliers
`cd /dump/hourly`
ou hebdomadaires
`cd /dump/weekly`
-
Décompresser le dump souhaité
`gzip -d YYYY-MM-dd_hh:mm:ss.sql.gz`
-
Restorer ce dump (remplacer seulement YYYY-MM-dd_hh:mm:ss.sql)
`mysql -uroot -p$MYSQL_ROOT_PASSWORD -h$DATABASE_HOST $MYSQL_DATABASE < YYYY-MM-dd_hh:mm:ss.sql
`
Loading