redmine数据备份,迁移与恢复

一、redmine的完整备份与恢复

1. 备份

Bitnami的Redmine本身就是自包含的,可以很简单地进行全备份。

操作如下:

进入备份数据要存放的目录

$ cd /your/folder

停掉所有服务

$ sudo /opt/bitnami/ctlscript.sh stop

创建备份文件

$ sudo tar -pczvf application-backup.tar.gz /opt/bitnami

重启所有服务

$ sudo /opt/bitnami/ctlscript.sh start

将备份文件application-backup.tar.gz存放到安全的地方。

2.恢复

Bitnami的redmine是自包含的,只需解压备份文件即可,

操作如下:

进入备份数据存放的目录

$ cd /your/folder

停止所有服务

$ sudo /opt/bitnami/ctlscript.sh stop

重命名原目录并存储

$ sudo mv /opt/bitnami /opt/bitnamiBackup

解压备份文件到原目录

$ sudo tar -pxzvf application-backup.tar.gz -C /

启动所有服务

$ sudo /opt/bitnami/ctlscript.sh start

IMPORTANT:

When restoring, remember to maintain the original permissions for the files and folders.

For example, if you originally installed the stack as ‘root‘,

make sure that the restored files are owned by ‘root‘.

如果只想备份数据库,则可以用下面的操作。

二、数据库备份与恢复

1. 数据库备份

如果只想备份数据库的数据,则可以使用 "mysqldump"工具来创建数据库的备份文件

$ mysqldump -u root -p database_name > backup.sql

这个操作依赖于数据的大小,可能要耗费些时间。

database_name: 是你想备份的数据库。

例如,如果你想备份WordPress数据库,那么数据库的名字就是"bitnami_wordpress".

2. 数据库恢复

如果有数据库备份文件,就可以做恢复了。

$ mysql -u root -p database_name < backup.sql

If you want to restore the database and the database schema does not exist,

it is necessary to first follow the steps described below.

As a side note, you can find the value for BITNAMI_USER_PASSWORD

below in the application configuration file.

This depends on the application and you can find this information in the application page itself.

$ mysql -u root -p

mysql> create database database_name;

mysql> grant all privileges on database_name.* to ‘bitnami‘@‘localhost‘

identified by ‘BITNAMI_USER_PASSWORD‘;

mysql> flush privileges;

mysql> exit;

$ mysql -u root -p database_name < backup.sql

NOTE :

the steps previously described will only back up the state of your database.

Other files that you should take into account when performing a backup are files

that have been uploaded to theapplication.

These files are stored in the application folder itslef

so you can copy this folder to have a backup of your uploaded files.

三、Redmine升级

It is strongly recommended that you create a backup before starting the update process.

If you have important data, it is advisable that you create and try to restore a backup

to ensure that everything works properly. You can get more info about

how to create a full backup here.

Of course, before executing any command, you have to start the

bitnami_console script or the shortcut on Windows before typing the following commands.

There are two different ways to upgrade your application.

If you want to upgrade the application and all Stack components PHP, Ruby, MySQL, Apache…

You can follow the steps described at How to upgrade the full Stack migrating the data?

In case you only want to upgrade the application code without modifying any other Stack components.

You can find below the steps to upgrade only the Redmine application.

In the Redmine case, these are the steps to migrate the database from an old version to a new one.

You can launch a new Redmine version instance or

download the latest Redmine installer from http://bitnami.com/stack/redmine.

Note this guide uses "/opt/bitnami" as the default installation directory,

you can use a different one if you have installed it in a different folder.

Copy the database backup to the new Bitnami version server.

Stop all servers and start only MySQL. Note that the installation directory could be different.

This is the default installation directory for Virtual Machines and Cloud images.

$ sudo /opt/bitnami/ctlscript.sh stop

$ sudo /opt/bitnami/ctlscript.sh start mysql

Remove the previous database and create the new one.

You can configure the database user password with a secure password.

$ mysql -u root -p

Password: ****

mysql> drop database bitnami_redmine;

mysql> create database bitnami_redmine;

mysql> grant all privileges on bitnami_redmine.* to ‘bn_redmine‘@‘localhost‘ identified by ‘DATABASE_PASSWORD‘;

Restore the new database:

$ mysql -u root -p bitnami_redmine < backup.sql

Edit the Redmine configuration file to update the database user password

(the same that you set previously) "/opt/bitnami/apps/redmine/htdocs/config/database.yml"

production:

adapter: mysql2

database: bitnami_redmine

host: localhost

username: bn_redmine

password: "DATABASE_PASSWORD"

encoding: utf8

Migrate the database to the latest version:

$ cd /opt/bitnami/apps/redmine/htdocs

$ ruby bin/rake db:migrate RAILS_ENV=production

Troubleshooting:

If you see the following error, go to your database

and remove the specified table and run the migrate command again.

Mysql::Error: Table ‘changeset_parents‘ already exists:

CREATE TABLE `changeset_parents` (`changeset_id` int(11) NOT NULL, `parent_id` int(11) NOT NULL) ENGINE=InnoDB

$ mysql -u root -p

mysql> use bitnami_redmine;

mysql> drop table changeset_parents;

Copy the ""/opt/bitnami/apps/redmine/htdocs/files" folder from the old installation to the new one.

If you have installed plugins in the previous version, copy the folders

from "vendor/plugins" directory into new installation directory, in "plugins" folder.

Check the plugins also support this new version and run the following command

$ ruby bin/rake redmine:plugins RAILS_ENV="production"

Finally you should clean the cache and the sessions:

$ ruby bin/rake tmp:cache:clear

$ ruby bin/rake tmp:sessions:clear

Restart the servers and you can access to your new Redmine.

$ sudo /opt/bitnami/ctlscript.sh restart

Troubleshooting:

If you upgrade it from a 1.x version and you see something similar to this error creating an issue:

MysqlStatement::Error Value for field `value` cannot be NULL INSERT INTO custom_value ...

Go to your custom values in the admin panel,

try to edit and save them again. That should fix the issue.

时间: 2024-10-14 13:34:14

redmine数据备份,迁移与恢复的相关文章

Git系列七之备份迁移 升级 恢复管理

0.Gitlab安装 1.安装和配置必要的依赖关系在CentOS7,下面的命令将在系统防火墙打开HTTP和SSH访问. yum install curl openssh-server postfix systemctl enable sshd postfix systemctl start sshd postfix firewall-cmd --permanent --add-service=http systemctl reload firewalld 2.添加gitlab包服务器安装包 cu

Redis数据备份和重启恢复

一.对Redis持久化的探讨与理解 目前Redis持久化的方式有两种: RDB 和 AOF 首先,我们应该明确持久化的数据有什么用,答案是用于重启后的数据恢复. Redis是一个内存数据库,无论是RDB还是AOF,都只是其保证数据恢复的措施. 所以Redis在利用RDB和AOF进行恢复的时候,都会读取RDB或AOF文件,重新加载到内存中. RDB就是Snapshot快照存储,是默认的持久化方式. 可理解为半持久化模式,即按照一定的策略周期性的将数据保存到磁盘. 对应产生的数据文件为dump.rd

数据爆发式增长 数据备份成‘刚需’

4G时代来临的背景下,企业数据面临爆炸式增长,传统的企业数据备份业务由于存在备份方式落后.备份成本昂贵的问题,早已无法满足大多数企业的需求.同时,随着云备份应用在中小企业领域和个人消费市场的快速渗透,越来越多的个人站长和中小企业开始将各种数据转移到容量更大.安全性更高.操作更为简单的云平台进行备份,企业数据备份迁移已成为'刚需'. 许多企业认为数据备份就像买保险一样,所以都不太愿意投注一部份金钱在上面,所以也很明显的没有意识到数据备份并不只是为了预防一时故障,更是为了防止突如其来的导致数据部分丢

ELK数据备份,迁移及恢复

由于公司的elasticsearch集群只是用了两台服务器.只要一台服务器数据丢失elasticsearch将丢失一半数据.所以数据的备份恢复就相当重要.elasticsearch 快照和恢复模块可以创建单个索引或者整个集群的快照到远程的仓库实现数据的备份及恢复. 下面以备份恢复.kibana索引为例 数据备份及恢复 1.修改elasticsearch配置文件 vim elasticsearch.yml 添加 path.repo: ["/mnt/bak"] #设置仓库路径 备注如果你有

Bitnami-Redmine备份迁移恢复

事情起因 Redmine 作为一款项目管理软件,曾经很是流行,现如今风光不在,不过依然在某些场景下受到欢迎. 常见的 Redmine 使用方式为:Redmine + markdown + svn/git ,这种组合可以满足项目进度管理.代码管理.文档管理的需求. 在使用过程中,最为头疼的莫过于 markdown 的集成,官方给出的插件太过陈旧,而第三方插件,或多或少都会引起 redmine 访问不稳定,还会导致CPU跑满,机器宕掉,这一度让小伙伴的情绪处于失控的边缘,于是乎,就下决心动动这个老古

monogdb之数据备份恢复与数据的导入导出

### 备份方式和恢复方式 备份全部数据库 mkdir /bak mongodump 备份指定数据库 mkidr /bak mongodump -d admin 备份一个数据库中的某个集合 mkdir /bak mongodump -d admin -c student 恢复全部数据库 mongorestore --drop  # --drop是为了防止数据重复 恢复某个数据库 mongorestore -d dbname --drop 恢复某个数据库的某个集合 mongorestore -d

三种VMware数据备份和恢复方法

服务器虚拟化,尤其是VMware形式的服务器虚拟化使IT人员获益良多,这么说一点也不为过.据我们所见,服务器虚拟化能解决服务器扩张.资源消耗.服务器扩张.能源消耗.高可用性等相关问题.服务器虚拟化也使我们有更多的时间解决其它的迫切问题,如企业资源预案升级.存储项目再三迁移. 尽管VMware提供封装技术和抽象技术,使我们受益匪浅,但数据保护领域发生的基本变革也带来了各项挑战.即使出现了VMware虚拟化,备份人员依然是牢骚最多的IT人员.最大的挑战在于保证数据的一致性,解决VMware物理资源过

mysql大数据备份及恢复(一)

Mysql大数据备份和恢复一 MySQL备份一般采取全库备份.日志备份:MySQL出现故障后可以使用全备份和日志备份将数据恢复到最后一个二进制日志备份前的任意位置或时间:mysql的二进制日志记录着该数据库的所有增删改的操作日志还包括了这些操作的执行时间 Binlog的用途:主从同步.恢复数据库 使用binlog工具备份 查看binlog是否开启,因为默认是关闭的 从上图可知off为关闭状态,一般logbin为只读,在/etc/my.cnf下开启 重启数据库 重启后在目录下查看是否生成bin日志

MySQL-06 数据备份和恢复

学习目标 数据备份 数据恢复 数据库迁移 导入和导出 数据备份 系统意外崩溃或者服务器硬件损坏都有可能导致数据库丢失,因此生产环境中数据备份非常重要. MySQLdump命令备份 该命令可以将数据库备份成一个文件文件,该文件包含了数据定义语句和数据操纵语句,可以执行重新创建数据库表并插入数据. 语法格式: mysqldump -u User -h Host -pPassword DBname[TableName,[TableName...]] > [dump file.sql] 示例:备份mys