Bitnami-redmine Server Migration

Source: Internet
Author: User
Tags redmine

1. Background

In the Redmine server migration process, if the same version of the previous two redmine, things are simple, if the version is different, it is possible to face two version of the database is incompatible, it is more troublesome. This article is intended to describe how to migrate redmine when the database is incompatible. This is a tiger-balm approach, and if you have mastered it, you can do it easily, regardless of which version of Redmine is upgraded to.

2. Environment

My redmine is installed on a Linux server with Bitnami-redmine. You are now migrating from Server A (version bitnami-redmine-2.3.0-0) to Server B (version bitnami-redmine-3.0.3-0). In these two versions, the database is changed.

3. Database backup (Legacy server) 3.1. View database user name and password

View the Redmine-2.3.0-0/apps/redmine/htdocs/config/database.yml file, write down the username and password, and wait for it to be used.

$

$ CD redmine-2.3.0-0/

$ cat./apps/redmine/htdocs/config/database.yml

# Default Setup is given to MySQL with ruby1.9. If you ' re running Redmine

# with MySQL and ruby1.8, replace the adapter name with ' MySQL '.

# Examples for PostgreSQL, SQLite3 and SQL Server can is found at the end.

# line indentation must is 2 spaces (no tabs).

Production

Adapter:mysql2

Database:bitnami_redmine

Host:localhost

port:3306

Username:bitnami

Password: "87783b9008"

Encoding:utf8

3.2. Backing up the database

Back up the database to the current directory of the Bitnami_redmine_old.sql file

./mysql/bin/mysqldump-ubitnami-p ' 87783b9008 ' bitnami_redmine > Bitnami_redmine_old.sql

4. Database backup (new server) 4.1. Install new version Redmine

Install bitnami-redmine-3.0.3-0 on the new server and how to install it is not within the scope of this article. When the installation is complete, start the service.

4.2. View the database user name and password

As in the previous operation, record the username and password, and so on need to use.

#

#cd redmine-3.0.3-0/

#cat./apps/redmine/htdocs/config/database.yml

---

# Default Setup is given to MySQL with ruby1.9.

# Examples for PostgreSQL, SQLite3 and SQL Server can is found at the end.

# line indentation must is 2 spaces (no tabs).

Production

Adapter:mysql2

Database:bitnami_redmine

Host:localhost

Username:bitnami

Password:9f30a3f2ea

Encoding:utf8

4.3. Backing Up the database

Back up the database to the current directory of the Bitnami_redmine_new.sql file

./mysql/bin/mysqldump-ubitnami-p ' 9f30a3f2ea ' bitnami_redmine > Bitnami_redmine_new.sql

5. Compare Database differences

There are differences between the old and new databases, so what is the difference?

Here is a method, the overall idea is: to restore the new and old database files just back up (to MySQL Server), and then use the Navicat for MySQL graphical interface, "table" to compare differences, and finally integrated a copy of the new server requirements of the database files.

Before you begin, install the MySQL server and the MySQL client. I completed the database consolidation in Windows XP, the environment is as follows:

Operating system

Windows XP SP3

MySQL Service side

MySQL Server 5.1

MySQL Client

Navicat for MySQL (version 9.0.15)

How to install, not within the scope of this article.

5.1. Restore the old and new databases on the MySQL server

In order to compare the needs, we need to restore the Bitnami_redmine_old.sql, bitnami_redmine_new.sql two database files out of three databases, as shown below.

Database file name

On the MySQL server

The restored database name

Description

Bitnami_redmine_new.sql

Bitnami_redmine_new

New Server database

Bitnami_redmine_old.sql

Bitnami_redmine_old

Old Server database

Bitnami_redmine_old.sql

Bitnami_redmine_merge

The merged database

The following is an example of recovering bitnami_redmine_new, other than the same, no longer a statement.

① using client Navicat for MySQL to connect to MySQL server

Run Navicat for MySQL, select File > New Connection ... Menu

Figure 1 Creating a new connection

② new database, named Bitnami_redmine_new

Figure 2 Creating a new database Bitnami_redmine_new

Figure 3 Creating a database Bitnami_redmine_new

③ Importing database files Bitnami_redmine_new.sql

Figure 4 Importing a database file

Figure 5 Selecting a database file

Figure 6 Starting the import

④ Refresh Tables

Figure 7 Refresh Tablses

After three databases are restored, as shown in:

Chart 8 restored three databases

5.2. Start comparing Database differences

For database comparison convenience, navicat to open multiple windows at the same time, the default is not allowed to open multiple windows, you must first in Navicat Tools > Options ... menu, make the following settings.


Chart 9 run Navicat open multiple windows

The next amount of work will be larger, comparing the new and old databases with each "table", each "item", and their attributes. is a test of patience and careful work. Requires basic operations involving the database, including new/deleted tables, new/Deleted Items, and so on.

In contrast to the users table as a description, other similar, no longer be described. Run Navicat three processes. As shown in the following:

Chart 10 Open three processes

The database we are going to change is bitnami_redmine_merge, and Bitnami_redmine_old and bitnami_redmine_new are meant to be used for comparison. Open the Users table for both Bitnami_redmine_old and bitnami_redmine_new, view its fields, select the Users right-click designtable to view the fields, as shown in.

Figure 11 Viewing The fields of the Users table

Through the following comparison, you can see the opposite sex, a new version of the database as a standard, against these differences to modify the Bitnami_redmine_merge database.

Variance of Chart 12users table

From bitnami-redmine-2.3.0-0 upgrade to bitnami-redmine-3.0.3-0, the differences in database Bitname_redmine are summarized as follows:

? The comments field of the Changesets table, and the type is changed from text to Longtext.

? Custom_fields table, more than two fields Format_store and description.

? More custom_fields_roles tables.

? More email_addresses tables.

? More quesries_roles tables.

? Queries table, less is_public field, two more fields visibility and options.

? Repositorys table, more fields created_on.

? Roles table, more fields users_visibility.

? Trackers table, more fields default_status_id.

? Users table, less field mail, two more fields must_change_passwd and passwd_changed_on.

? Wiki_redirects table, more fields redirects_to_wiki_id.

? issue_statuses table, less field is_default.

5.3. Export the merged database file

All the differences were compared, the Bitnami_redmine_merge database was modified, and the Bitnami_redmine_merge database export file Bitnami_redmine_merge.sql was finally exported.

Select Bitnami_redmine_merge database, right click on data Transfer ... menu, as shown below:

Figure 13 Exporting a database to a file

Set the exported file name, set the encoding format, click Start to begin exporting.

Chart 14 Export to database

See the following tips to indicate a successful export.

Chart 15 Successful export file

6. Database recovery (new server) 6.1. Clean up the Bitnami_redmine database

Using the MySQL command to clean up the Bitnami_redmine database, see the following red font commands.

#

# ./mysql/bin/mysql-ubitnami-p ' 9f30a3f2ea '

Welcome to the MySQL Monitor. Commands End With; or \g.

Your MySQL Connection ID is 9

Server version:5.5.42 MySQL Community Server (GPL)

Copyright (c), Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of the Oracle Corporation and/or its

Affiliates. Other names trademarks of their respective

Owners.

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

mysql> DROP DATABASE bitnami_redmine;

Query OK, Wuyi rows affected (0.04 sec)

mysql> CREATE DATABASE bitnami_redmine;

Query OK, 1 row Affected (0.00 sec)

mysql> quit

Bye

#

6.2. Recovering a merged database

Upload the Bitnami_redmine_merge.sql file to the redmine-3.0.3-0 directory and restore the database

./mysql/bin/mysql-ubitnami-p ' 9f30a3f2ea ' Bitnami_redmine < Bitnami_redmine_merge.sql

6.3. Restart the Redmine service

Restart the Redmine service, open the browser, login to see if it is done. If there is an error in the browser, the database comparison is missing, go back and review it again.

7. File attachment migration (Legacy server)

Copy all files under/apps/redmine/htdocs/files to the same directory as the new server.

8. Plugin migration (Legacy server)

Copy all files under/apps/redmine/htdocs/plugins to the same directory as the new server.

9. Done

At this point, the migration work is completed, the browser access to the new Redmine, confirm the function is normal.

10. Summary

To make a summary, migration redmine, if the old and new server version is different, the difficulty is to migrate the database, the steps to migrate the database are as follows:

? Backing up old server database files (bitnami_redmine_old.sql)

? Back up the new server database file (bitnami_redmine_new.sql)

? Compare/merge databases, and export files (bitnami_redmine_merge.sql)

? Restore the merged database files to the new server

The merging process, with MySQL server and client navicat for MySQL (graphical operation for easy comparison).

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Bitnami-redmine Server Migration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.