一、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
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.
阅读(13249) | 评论(0) | 转发(0) |