Jira迁库-由Hsql迁到Mysql

  • Post author:
  • Post category:mysql



目录


一、Jira版本与Mysql版本匹配问题


二、Mysql版本与mysql驱动版本匹配问题


三、以Jira6.4.11为例,介绍Jira迁库到Mysql5.6.44


0.安装VC++2010


1.安装Mysql


2.下载mysql驱动


3.备份jira系统的数据为xml格式


4.停掉Jira服务,修改数据库配置


5.恢复数据


6.验证


一、Jira版本与Mysql版本匹配问题

官网地址:

https://confluence.atlassian.com/jira064/supported-platforms-720411857.html


Supported platforms for JIRA 6.4

Supported platform(s) Supported version(s) Notes

Java platforms
Oracle JDK / JRE (formerly Sun JDK / JRE)
  • Java 7
  • Java 8

Operating systems
Microsoft Windows
  • JIRA is a pure Java-based application and should run on any supported operating system, provided that the JDK / JRE requirements are satisfied.
  • Please see here for information on

    Anti-Virus in JIRA applications
Linux / Solaris
  • JIRA is a pure Java-based application and should run on any supported operating system, provided that the JDK / JRE requirements are satisfied.
  • Atlassian only officially supports JIRA running on x86 hardware and 64-bit derivatives of x86 hardware. If you are

    installing JIRA from an archive

    , you should

    create a dedicated user account

    on the operating system to run JIRA, since JIRA runs as the user it is invoked under and therefore can potentially be abused.
  • Although the

    JIRA Linux Installer

    is designed to install successfully on all ‘flavours’ of Linux,

    we only test the JIRA Linux Installer on


    CentOS Linux

    . If you encounter problems with the JIRA Linux Installer on your particular flavour of Linux, we recommend

    installing JIRA on Linux from an archive file

    .
  • Network storage locations are

    not supported

    due to Lucene requirements (such as NFS mounts). Please see the

    IndexWriter

    docs for further info.

Virtualisation
VMware
  • Please read our

    Virtualizing JIRA (JIRA on VMware)

    guide for information on the required configuration of VMWare.
  • We are

    unable to provide any support

    for VMWare itself.
  • All of the operating systems listed in the ‘Operating systems’ rows above are supported for VMware.

Application servers
Apache Tomcat
  • 7.0.55
  • Deploying multiple Atlassian applications in a single Tomcat container is

    not supported

    . Please see

    Deploying Multiple Atlassian Applications in a Single Tomcat Container

    for reasons why we do not support this configuration.
  • Whilst JIRA may work with other versions of Apache Tomcat 6 & 7, it has not been tested on them and may cause problems. We recommend using these versions.
Mail servers
  • SMTP servers must be able to support the multipart content type.
Database encoding UTF-8
  • More explicit details on collation can be found on the individual configuration documentation for each database.

Databases
Oracle
  • Using Advanced Compression Option (ACO) is not supported.
MySQL
  • We support 5 series GA releases from 5.1 to 5.6.x
  • The MySQL driver is

    no longer bundled with JIRA

    , as of JIRA 5.2. Please see the

    JIRA 5.2 Upgrade Notes

    for reasons why we do not bundle this driver.
  • MySQL 5.0.x is not supported as it is essentially

    EOL

    and only covered under Oracle Sustaining Support.
  • Neither MariaDB nor PerconaDB are supported. Both are proven to cause problems with JIRA applications.
  • We recommend running MySQL in strict mode.
  • JIRA does not support 4 byte characters, regardless of MySQL version.

    • If you must use 4 byte characters, we recommend you use PostgreSQL.
PostgreSQL
Microsoft SQL Server
  • Express Editions are

    not supported

    .
HSQLDB

  • Supported for evaluation use only
  • JIRA ships with a built-in database (HyperSQL DataBase or HSQLDB). While this database is suitable for evaluation purposes, it is susceptible to data loss during system crashes. Hence, for production environments we

    strongly recommend

    that you configure JIRA to use an

    external database

    .

Web Browsers
Chrome
  • Latest stable version supported
  • Minimum screen resolution of 1024 x 768 (when browsers are maximised).
  • Please refer to our

    Security Bugfix Policy

    on fixing browser issues.
Microsoft Internet Explorer
  • 9.0
  • 10.0
  • 11.0
  • Minimum screen resolution of 1024 x 768 (when browsers are maximised).
  • Please refer to our

    Security Bugfix Policy

    on fixing browser issues.
  • ‘Compatibility View’ is

    not supported

    .

  • JIRA Agile gadgets

    do not work in Internet Explorer 9.0. We recommend that you upgrade to Internet Explorer 10.0 or later, as we will remove support for the rest of JIRA Agile on Internet Explorer 9.0 soon.

Mozilla Firefox

  • Latest stable version supported
  • Minimum screen resolution of 1024 x 768 (when browsers are maximised).
  • Please refer to our

    Security Bugfix Policy

    on fixing browser issues.

Safari

  • Latest stable version supported on Mac OS X only
  • Minimum screen resolution of 1024 x 768 (when browsers are maximised).
  • Please refer to our

    Security Bugfix Policy

    on fixing browser issues.
Mobile
  • Mobile Safari (iOS, iPod touch and iPhone only) — Latest stable version
  • Android — The default browser on Android 4.0.3 (Ice Cream Sandwich)
Mobile devices are only supported on the Mobile views.

二、Mysql版本与mysql驱动版本匹配问题

官网文档地址:


https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-versions.html

(Connector/J Versions 5.1)


https://dev.mysql.com/doc/connector-j/6.0/en/connector-j-versions.html

(Connector/J Versions 6.0)


Summary of Connector/J Versions

Connector/J version Driver Type JDBC version MySQL Server version Status
5.1 4 3.0, 4.0, 4.1, 4.2 4.1, 5.0, 5.1, 5.5, 5.6, 5.7 Recommended version
5.0 4 3.0 4.1, 5.0 Released version
3.1 4 3.0 4.1, 5.0 Obsolete
3.0 4 3.0 3.x, 4.1 Obsolete


Summary of Connector/J Versions

Connector/J version JDBC version MySQL Server version JRE Supported JDK Required for Compilation Status
6.0 4.2 5.5, 5.6, 5.7 1.8.x 1.8.x Developer Milestone
5.1 3.0, 4.0, 4.1, 4.2 4.1, 5.0, 5.1, 5.5, 5.6*, 5.7* 1.5.x, 1.6.x, 1.7.x, 1.8.x* 1.5.x and 1.8.x Recommended version

三、以Jira6.4.11为例,介绍Jira迁库到Mysql5.6.44

环境是:Wondows server 2008 R2 Enterprise,64为操作系统,java 1.8.0_65

在迁库之前,自己手动添加几个项目或bug,迁完库之后方便验证

0.安装VC++2010

VC++2010官网下载地址:

https://www.microsoft.com/zh-cn/download/details.aspx?id=14632

下载之后直接运行安装即可

1.安装Mysql

(1)下载mysql

mysql官网下载地址:

https://dev.mysql.com/downloads/

由于我们的Jira是6.4.11,所匹配的MySQL有5.1,5.5,5.6,这里我们选择5.6.44安装,所以在官网我们需要点击previous版本

(2)将mysql.zip解压到D盘

(3)在bin目录下添加my.ini文件,最好将MYSQL的字符集设置为UTF-8,文件内容如下:

[mysqld]
basedir=E:\mysql\mysql-8.0.13-winx64
datadir=E:\mysql\mysql-8.0.13-winx64\data 
port = 3306
character-set-server=utf8
#忘记密码时使用
#skip-grant-tables
#设置协议认证方式
default_authentication_plugin=mysql_native_password
[mysql]
default-character-set=utf8

(4)添加解压目录mysqld.exe所在bin目录到环境变量path中;

(5)在bin目录下打开控制窗口,输入mysqld –install进行mysql安装

(6)去计算机-服务处开启mysql服务

(7)用mysql -u root -p登录系统,一开始安装之后root没有密码,若提示请输入密码,直接回车即可

(8)修改root密码

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');

(9)创建MYSQL数据库jiradb

create database jiradb character set utf8;

有时会出现表情符号无法insert到数据库的情况。原因:UTF-8编码有可能是两个、三个、四个字节。Emoji表情或者某些特殊字符是4个字节,而Mysql的utf8编码最多3个字节,所以数据插不进去。解决:更改数据库的编码为utf8mb4:

ALTER DATABASE {databaseName} CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;


或者改出现问题的表的编码为utf8mb4:

alter table  {tableName}  convert to character set utf8mb4 collate utf8mb4_bin; 


改完之后重新导入备份数据即可

至此mysql5.6.44安装,创建库和用户密码完成。

2.下载mysql驱动

Mysql-connector-java-5.1.47-bin.jar和Mysql-connector-java-5.2.47.jar

官网下载地址:

https://dev.mysql.com/downloads/connector/j/

(由于mysql用的是5.6.44,所以驱动选择5.1.47)

3.备份jira系统的数据为xml格式

用管理员账户登录jira,将其备份,具体如下:系统管理–导入导出–备份数据

4.停掉Jira服务,修改数据库配置

在计算机-服务,停止jira服务

将mysql-connector-java-5.1.47-bin.jar驱动程序和mysql-connector-java-5.1.47.jar驱动程序拷贝到 JIRA\lib 目录下

启动JIRA\bin\config.bat程序,配置Database,配置完成后,测试连接

5.恢复数据

启动jira服务

由于修改了配置,且mysql数据库里的内容为空,所以刚启动jira的时候会提示输入license,创建管理员账户什么的,随便填,只要能过去就行。配置完成后,进入系统管理,进行恢复数据(要求将其备份的zip文件拷贝到其要求的目录下C:\Program Files\Atlassian\Application Data\JIRA\import即可)

导入备份数据后重建索引报sql异常:max key length is 767 bytes,导致打不开一些之前的老的issue

原因:

由于MySQL的Innodb引擎表索引字段长度的限制为767字节,因此对于多字节字符集的大字段或者多字段组合,创建索引时会出现此错误。以utf8mb4字符集字符串类型字段为例,utf8mb4是4字节字符集,则默认支持的索引字段最大长度是191字符(767字节/4字节每字符≈191字符),因此在varchar(255)或char(255)类型字段上创建索引会失败。

解决:

1.1开启数据库的innodb_large_prefix

set global innodb_large_prefix=1;

set global innodb_file_format=BARRACUDA;

创建表的时候指定表的row format格式为Dynamic或者Compressed,示例如下:

create table idx_length_test_02

(

id int auto_increment primary key,

name varchar(255)

)

ROW_FORMAT=DYNAMIC default charset utf8mb4;

对已经创建的表,修改表的row_format格式命令如下:

alter table <表名> row_format=dynamic;

1.2 数据库使用mysql5.7版本

在MySQL5.7里默认 innodb_large_prefix=1 解除了767bytes长度限制,但是单列索引长度最大还是不能超过3072bytes

6.验证

用之前的管理员账户登录jira,查看issue内容,或者用户信息等等,验证成功。



版权声明:本文为Rookie_hh原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。