RedmineBackupRestore » History » Version 3
Go MAEDA, 2018-01-11 05:18
Described attachment_storage_path setting in "Backing up attachments" section.
1 | 1 | Go MAEDA | h1. Backing up and restoring Redmine |
---|---|---|---|
2 | |||
3 | {{>toc}} |
||
4 | |||
5 | h2. Backup |
||
6 | |||
7 | Redmine backups should include: |
||
8 | * Database |
||
9 | * Attachments (stored in the @files@ directory of your Redmine install) |
||
10 | |||
11 | h3. Backing up database |
||
12 | |||
13 | h4. MySQL |
||
14 | |||
15 | The @mysqldump@ command can be used to backup the contents of your MySQL database to a text file. For example: |
||
16 | <pre> |
||
17 | 2 | Go MAEDA | /usr/bin/mysqldump -u <username> -p<password> -h<hostname> <redmine_database> > /path/to/backup/db/redmine.sql |
18 | 1 | Go MAEDA | </pre> |
19 | |||
20 | 2 | Go MAEDA | You can find @<username>@, @<password>@, @<hostname>@, and @<redmine_database>@ in the file @config/database.yml@. @<host_name>@ may not be required depending on your installation of the database. |
21 | |||
22 | 1 | Go MAEDA | h4. PostgreSQL |
23 | |||
24 | The @pg_dump@ command can be used to backup the contents of a PostgreSQL database to a text file. Here is an example: |
||
25 | <pre> |
||
26 | 2 | Go MAEDA | /usr/bin/pg_dump -U <username> -h <hostname> -Fc --file=redmine.sqlc <redmine_database> |
27 | 1 | Go MAEDA | </pre> |
28 | |||
29 | 2 | Go MAEDA | You can find @<username>@, @<hostname>@, and @<redmine_database>@ in the file @config/database.yml@. @<hostname>@ may not be required depending on your installation of the database. The @pg_dump@ command will prompt you to enter the password when necessary. |
30 | |||
31 | 1 | Go MAEDA | h4. SQLite |
32 | |||
33 | SQLite databases are all contained in a single file, so you can back them up by copying the file to another location. |
||
34 | 2 | Go MAEDA | |
35 | You can determine the file name of SQLite database by looking at @config/database.yml@. |
||
36 | 1 | Go MAEDA | |
37 | h3. Backing up attachments |
||
38 | |||
39 | 3 | Go MAEDA | All file uploads are stored in @attachments_storage_path@ (defaults to the @files/@ directory). You can copy the contents of this directory to another location to easily back it up. |
40 | |||
41 | WARNING: @attachments_storage_path@ may point to a different directory other than @files/@. Be sure to check the setting in @config/configuration.yml@ to avoid making a useless backup. |
||
42 | 1 | Go MAEDA | |
43 | h3. Sample backup script |
||
44 | |||
45 | Here is a simple shell script that can be used for daily backups (assuming you're using a MySQL database): |
||
46 | |||
47 | <pre> |
||
48 | # Database |
||
49 | /usr/bin/mysqldump -u <username> -p<password> <redmine_database> | gzip > /path/to/backup/db/redmine_`date +%Y-%m-%d`.gz |
||
50 | |||
51 | # Attachments |
||
52 | rsync -a /path/to/redmine/files /path/to/backup/files |
||
53 | </pre> |
||
54 | |||
55 | |||
56 | h2. Restore |
||
57 | |||
58 | TODO |