返回介绍

PART Ⅰ : 容器云OPENSHIFT

PART Ⅱ:容器云 KUBERNETES

PART Ⅲ:持续集成与持续部署

PART Ⅴ:日志/监控/告警

PART Ⅵ:基础

PART Ⅶ:数据存储、处理

PART VIII:CODE

PART X:HACKINTOSH

PART XI:安全

redmine的备份与恢复

发布于 2024-06-08 21:16:46 字数 4096 浏览 0 评论 0 收藏 0

要备份的数据类型

  • 数据库中的数据
  • 用户上传的附件

Redmine backups should include:

  • Database
  • Attachments (stored in the files directory under the installation directory by default)

备份数据库数据

  • MySQL

    The mysqldump command can be used to backup the contents of your MySQL database to a text file. For example:

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

    You can find ,, , and in the file config/database.yml. `` may not be required depending on your installation of the database.

  • PostgreSQL

    The pg_dump command can be used to backup the contents of a PostgreSQL database to a text file. Here is an example:

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

    You can find ,, and in the file `config/database.yml`. may not be required depending on your installation of the database. The pg_dump command will prompt you to enter the password when necessary.

  • SQLite

    SQLite databases are all contained in a single file, so you can back them up by copying the file to another location.

    You can determine the file name of SQLite database by looking at config/database.yml.

备份用户上传的附件

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.

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.

备份脚本

Here is a simple shell script that can be used for daily backups (assuming you're using a 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

恢复数据库

  • MySQL

    For example if you have a gziped dump file with the name 2018-07-30.gz, then the database can be restored with the following command:

    gunzip -c 2018-07-30.gz | mysql -u <username> --password <redmine_database>
    Enter password:
    
  • PostgreSQL

    When the option -Fc of the command pg_dump is used like it is at the above example then you need to use the command pg_restore:

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

    otherwise a text file can be restored with psql:

    psql <redmine_database> < <infile>
    
  • SQLite

    Copy the database file from the backup location.

  1. https://www.redmine.org/boards/2/topics/2442?r=18660
  2. https://www.redmine.org/projects/redmine/wiki/RedmineBackupRestore

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文