RedmineBackupRestore » History » Version 1

Go MAEDA, 2018-01-10 15:08
Made dedicated page from [[RedmineInstall#Backups]] and [[RedmineUpgrade#Step-2-Backup]]

1 1 Go MAEDA
h1. Backing up and restoring Redmine
2 1 Go MAEDA
3 1 Go MAEDA
{{>toc}}
4 1 Go MAEDA
5 1 Go MAEDA
h2. Backup
6 1 Go MAEDA
7 1 Go MAEDA
Redmine backups should include:
8 1 Go MAEDA
* Database
9 1 Go MAEDA
* Attachments (stored in the @files@ directory of your Redmine install)
10 1 Go MAEDA
11 1 Go MAEDA
h3. Backing up database
12 1 Go MAEDA
13 1 Go MAEDA
h4. MySQL
14 1 Go MAEDA
15 1 Go MAEDA
The @mysqldump@ command can be used to backup the contents of your MySQL database to a text file. For example:
16 1 Go MAEDA
<pre>
17 1 Go MAEDA
/usr/bin/mysqldump -u <username> -p<password> <redmine_database> > /path/to/backup/db/redmine.sql
18 1 Go MAEDA
</pre>
19 1 Go MAEDA
20 1 Go MAEDA
h4. PostgreSQL
21 1 Go MAEDA
22 1 Go MAEDA
The @pg_dump@ command can be used to backup the contents of a PostgreSQL database to a text file. Here is an example:
23 1 Go MAEDA
<pre>
24 1 Go MAEDA
/usr/bin/pg_dump -U <username> -Fc --file=redmine.sqlc <redmine_database>
25 1 Go MAEDA
</pre>
26 1 Go MAEDA
27 1 Go MAEDA
h4. SQLite
28 1 Go MAEDA
29 1 Go MAEDA
SQLite databases are all contained in a single file, so you can back them up by copying the file to another location.
30 1 Go MAEDA
31 1 Go MAEDA
h3. Backing up attachments
32 1 Go MAEDA
33 1 Go MAEDA
All file uploads are stored in the @files/@ directory. You can copy the contents of this directory to another location to easily back it up.
34 1 Go MAEDA
35 1 Go MAEDA
h3. Sample backup script
36 1 Go MAEDA
37 1 Go MAEDA
Here is a simple shell script that can be used for daily backups (assuming you're using a MySQL database):
38 1 Go MAEDA
39 1 Go MAEDA
<pre>
40 1 Go MAEDA
# Database
41 1 Go MAEDA
/usr/bin/mysqldump -u <username> -p<password> <redmine_database> | gzip > /path/to/backup/db/redmine_`date +%Y-%m-%d`.gz
42 1 Go MAEDA
43 1 Go MAEDA
# Attachments
44 1 Go MAEDA
rsync -a /path/to/redmine/files /path/to/backup/files
45 1 Go MAEDA
</pre>
46 1 Go MAEDA
47 1 Go MAEDA
48 1 Go MAEDA
h2. Restore
49 1 Go MAEDA
50 1 Go MAEDA
TODO