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
Commits
b1cb22c7
Commit
b1cb22c7
authored
1 year ago
by
Rémi PAILHAREY
Browse files
Options
Downloads
Patches
Plain Diff
feat: updated backup doc
parent
a4666a2a
No related branches found
No related tags found
1 merge request
!37
feat: updated backup doc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/ecolyo-agent/technical/backup.md
+8
-14
8 additions, 14 deletions
docs/ecolyo-agent/technical/backup.md
with
8 additions
and
14 deletions
docs/ecolyo-agent/technical/backup.md
+
8
−
14
View file @
b1cb22c7
...
...
@@ -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
`
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment