en
Language
  • en
  • de
  • fr
  • es
  • br
  • ru
  • jp
  • kr
AI translation
  • ee
  • ae
  • cn
  • vn
  • id
  • eu
  • il
  • gr
  • no
  • fi
  • dk
  • se
  • tr
  • bg
  • nl
  • it
  • pl
  • hu
  • ro
  • ua
  • cs

How to Backup and Restore the Database in Redmine

1/11/2021
4 minutes
Lukáš Beňa

Redmine is a free project management tool that is written on Ruby on Rails. This open-source web application is one of the best project management tools for issue tracking and time management. Here are some of the methods using which you can backup and restore the database in Redmine.

Whether you consider Redmine as an issue tracker or a project management tool, these web application features are amazing. Many professionals trust this application because Redmine is fully customizable, and you can set user roles and responsibilities for different employees.

This means only employees or teams working on the project can see the details and progress. You can also build a support system as it allows you to create as many forums as possible in one project. Furthermore, anyone can view the threads and forums. Your customers and clients can also include a wiki link or revision code through the issue tracker.

The best part about open-source applications such as Redmine is that you can also add third-party plugins and increase the application's features. For instance, you can also send invoices and estimates to your clients and customers.

All these benefits of Remine highlight how essential this web application can be for your business and facilitate streamlining tasks and processes. Businesses also use this software for document management and customer support.

Now let's get back to the principal question – how to backup and restore the database in Redmine?


1. Backing up the Database


MySQL

You can use the mysqldump command and backup your MySQL database content in a text file. For instance:

/usr/bin/mysqldump -u <username> -p<password> -h <hostname><redmine_database>> /path/to/backup/db/redmine.sql

Visit config/database.yml to find the username, password, Redmine database, and hostname. The hostname is not necessarily needed.


PostgreSQL

If you want to export or backup PostgreSQL database, you can use the command pg_dump. This will export the data into a text file. For instance:

/usr/bin/pg_dump -U <username> -h <hostname> -Fc --file=redmine.sqlc<redmine_database>

Visit config/database.yml to find the username, password, Redmine database, and hostname. The hostname is not necessarily needed. When necessary, you need to enter the password in the pg_dump command.


SQLite

You can easily back up the SQLite databases by copying the same file to another location, which only includes a single file.

Look at config/database.yml and determine the name of the file.


2. Backing up the Attachments

Every file that is attached to the software is stored in a default location files/directory. You can simply visit the location and copy the content and paste the file where you want for the backup.


Sample Backup Script

For daily backups you can use this simple shell script for MySQL database:

# Database

/usr/bin/mysqldump -u <username> -p<password><redmine_database> | gzip> /path/to/backup/db/redmine_`date +%Y-%m-%d`.gz

# Attachments

rsync -a /path/to/redmine/files /path/to/backup/files


3. Restoring the Database


MySQL

For instance, if you have a file that is named as 2020-07-30.gz, then you can restore the database by using the following command:

gunzip -c 2020-07-30.gz | mysql -u <username> --password <redmine_database>

Enter password.


PostgreSQL

You have to use pq_restore command when –Fc option is used in the pg_dump command as an above example:

pg_restore -U <username> -h <hostname> -d <redmine_database>redmine.sqlc

You can also restore the text file through psql command:

psql<redmine_database><<infile>


SQLite

You can copy your database file stored in the location.


Conclusion

Redmine is a complete solution that you need for project management and issue tracking. However, there are various ways in which you can use this application. The features that Redmine offers are user-friendly, and as this application is free, you can save a lot of expense by choosing this software.

You can boost your productivity and save a lot of time by making the right decision and choosing Redmine for your business projects.

The ultimate Redmine upgrade? Easy.

Get all powerful tools for perfect project planning, management, and control in one software.

Try Easy Redmine in 30 days free trial

Full features, SSL protected, daily backups, in your geolocation