FAQ › Installation and system operation

How to back up Redmine data

Created on 2010-12-05  •  MAEDA Go

This page explains how to back up and recover the data stored in Redmine.

What to back up

To protect the Redmine data, back up the following.

  • The files directory under the Redmine installation directory
    This directory contains the files attached to issues and wiki pages.
  • The database
    The database contains all information other than attached files.

How to back up the files directory

Copy the files directory (the directory that stores attached files) directly under the Redmine installation directory.

If the files directory is empty, the directory that stores attached files may have been changed. Check the attachments_storage_path setting in the config/configuration.yml file.

How to back up the database

If you use MySQL

Run the mysqldump command to get a dump of the database.

You can find the MySQL user name, MySQL password, and database name in username, password, and database in config/database.yml.

mysqldump -u MYSQL_USER_NAME -pMYSQL_PASSWORD REDMINE_DATABASE_NAME > OUTPUT_FILE_NAME

Note: Do not put a space between -p and the MySQL password.

If you use PostgreSQL

Run the pg_dump command to get a dump of the database.

You can find the PostgreSQL user name, host name, database name, and PostgreSQL password in username, host, database, and password in config/database.yml. The pg_dump command asks you for the database password when you run it.

pg_dump -U POSTGRESQL_USER_NAME -h HOST_NAME -Fc --file=DUMP_FILE_NAME REDMINE_DATABASE_NAME

Depending on how PostgreSQL is installed, you may not need the host name.

If you use SQLite

Copy the SQLite database file (the file specified by database in config/database.yml).

How to recover

Install the same version of Redmine as the one that you backed up. Then restore the files directory and the database data from the backup.

Recovering the files directory

Copy the content of the files directory that you backed up into the files directory of Redmine, without any changes.

Recovering the database

For MySQL

Load the dump that you took at backup time into an empty MySQL database.

mysql -u MYSQL_USER_NAME -pMYSQL_PASSWORD REDMINE_DATABASE_NAME < DUMP_FILE_NAME

For SQLite

Copy the SQLite database file that you backed up.

For PostgreSQL

To import a PostgreSQL dump, use the pg_restore command.

pg_restore -h DATABASE_SERVER_IP_ADDRESS -U DATABASE_USER_NAME -d DATABASE_NAME --clean --if-exists --no-owner xxxxxxxx.sqlc

Note: The parameters to specify depend on your environment.