Jira、Confluence的数据迁移
jira简单来说就是缺陷跟踪、客户服务、需求收集、流程审批、任务跟踪、项目跟踪和敏捷管理的系统!!!confluence用来共享信息、文档协作、集体讨论,信息推送!!!这段时间呢公司的日报系统需要从旧机器上将数据迁移到新的机器上,迁移过程中呢也遇到了坑,不过都解决了,在这里呢也是分享一下自己心得体会,让迁移变得更轻松简单
本次简单介绍安装服务,更多的是迁移方法!
在迁移之前先介绍一下这两个在服务器中的结构
'''
centos7.9系统
confluence-6.11.1
jira-software-7.12.1
mysql 5.7.31
以下目录都是软件默认安装的路径,如果有改动请按照自己的路径
'''
#安装目录
opt/atlassian/jira
opt/atlassian/confluence
#数据备份与附件目录
var/atlassian/application-data/jira
var/atlassian/application-data/confluence
#mysql数据库目录
var/lib/mysql
1.安装jira、confluence
新服务器安装java环境(不做介绍)
新服务器安装mysql数据库,和老服务器的版本尽量一致!(直接下载安装,密码什么的都设置好)
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.31-1.el7.x86_64.rpm-bundle.tar
1.新服务器上安装jira
#我的安装包在home中
./atlassian-jira-software-7.12.1-x64.bin
'''
Unpacking JRE …
Starting Installer …
九月 03, 2020 5:53:52 下午 java.util.prefs.FileSystemPreferences$1 run
信息: Created user preferences directory.
九月 03, 2020 5:53:52 下午 java.util.prefs.FileSystemPreferences$2 run
信息: Created system preferences directory in java.home.
This will install JIRA Software 7.4.1 on your computer.
OK [o, Enter], Cancel [c]
'''
输入:o
'''
Choose the appropriate installation or upgrade option.
Please choose one of the following:
Express Install (use default settings) [1], Custom Install (recommended for advanced users) [2, Enter], Upgrade an existing JIRA installation [3]
'''
输入:1
'''
Details on where JIRA Software will be installed and the settings that will be used.
Installation Directory: /opt/atlassian/jira
Home Directory: /var/atlassian/application-data/jira
HTTP Port: 8080
RMI Port: 8005
Install as service: Yes
Install [i, Enter], Exit [e]
'''
输入:i
'''
Extracting files …
Please wait a few moments while JIRA Software is configured.
Installation of JIRA Software 7.4.1 is complete
Start JIRA Software 7.4.1 now?
Yes [y, Enter], No [n]
'''
输入:n (暂时不开启服务)
'''
Please wait a few moments while JIRA Software starts up.
Launching JIRA Software …
Installation of JIRA Software 7.4.1 is complete
Your installation of JIRA Software 7.4.1 is now ready and can be accessed
via your browser.
JIRA Software 7.4.1 can be accessed at http://localhost:8080
Finishing installation …
'''
如果最后一步选择y,那么就停掉jira,因为现在我们并没有设置数据库,jira是不可用的
ps -ef |grep jira
kill jiraID
此时opt文件夹下就会出现atlassian/jira文件夹,var下会出现atlassian/application-data/jira
2.新服务器安装confluence
./atlassian-confluence-6.11.1-x64.bin
'''
Unpacking JRE …
Starting Installer …
九月 03, 2020 8:42:32 下午 java.util.prefs.FileSystemPreferences$2 run
信息: Created system preferences directory in java.home.
This will install Confluence 6.3.1 on your computer.
OK [o, Enter], Cancel [c]
'''
输入:o
'''
Choose the appropriate installation or upgrade option.
Please choose one of the following:
Express Install (uses default settings) [1],
Custom Install (recommended for advanced users) [2, Enter],
Upgrade an existing Confluence installation [3]
'''
输入:1 或者 2 (1是默认路径,2是自定义路径,可以修改安装和数据存放路径和端口)
'''
See where Confluence will be installed and the settings that will be used.
Installation Directory: /opt/atlassian/confluence
Home Directory: /var/atlassian/application-data/confluence
HTTP Port: 8090
RMI Port: 8000
Install as service: Yes
Install [i, Enter], Exit [e]
'''
输入:i
'''
Extracting files …
Please wait a few moments while we configure Confluence.
Installation of Confluence 6.3.1 is complete
Start Confluence now?
Yes [y, Enter], No [n]
'''
输入:n (暂不开启服务)
'''
Please wait a few moments while Confluence starts up.
Launching Confluence …
Installation of Confluence 6.3.1 is complete
Your installation of Confluence 6.3.1 is now ready and can be accessed via
your browser.
Confluence 6.3.1 can be accessed at http://localhost:8090 访问地址
Finishing installation …
'''
此时opt文件夹下就会出现atlassian/confluence文件夹,var下会出现atlassian/application-data/confluence
到这里虽然已经安装好了jira和confluence,但是两者都处于关闭状态
2.备份旧服务器数据
将旧服务器以下文件夹拷贝下来
var/atlassian/application-data/jira
var/atlassian/application-data/confluence
备份mysql数据库,备份出来的是一个sql文件
mysqldump --all-databases -h127.0.0.1 -uroot -p123456 > db_datas.sql
'''
or
'''
mysqldump -h127.0.0.1 -uroot -p123456 --databases jira confluence > db_datas.sql
3.将备份下来的所有数据上传至新服务器
1.现在旧服务器的数据我们备份下来了,现在在新服务器进行替换导入
#旧服务器上我们copy下来的这两个文件夹
var/atlassian/application-data/jira
var/atlassian/application-data/confluence
#替换新服务器的
var/atlassian/application-data/jira
var/atlassian/application-data/confluence
2.导入数据库
#导入数据库
mysql -uroot -p123456 < db_datas.sql
ok,到目前为止,新服务器的jira、confluence缓存与数据库都与旧服务器的相同了,接下来就需要配置一下
4.配置新服务器jira、confluence文件
1.配置备份地址
vim /opt/atlassian/jira/atlassian-jira/WEB-INF/classes/jira-application.properties
#这是默认的路径,如果你改了 请修改你自己备份路径
jira.home = /var/atlassian/application-data/jira
vim /opt/atlassian/confluence/confluence/WEB-INF/classes/confluence-init.properties
#这是默认的路径,如果你改了 请修改你自己备份路径
confluence.home = /var/atlassian/application-data/confluence
2.配置数据库地址
#confluence 配置本地数据库
vim /var/atlassian/application-data/confluence/confluence.cfg.xml
'''
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.isolation">2</property>
<property name="hibernate.connection.password">123456</property>
<property name="hibernate.connection.url">jdbc:mysql://127.0.0.1:3306/confluencefzw2?useUnicode=true&characterEncoding=utf8</property>
<property name="hibernate.connection.username">root</property>
'''
#jira 配置本地数据库
vim /var/atlassian/application-data/jira/dbconfig.xml
'''
<database-type>mysql</database-type>
<jdbc-datasource>
<url>jdbc:mysql://localhost:3306/jira?useUnicode=true&characterEncoding=UTF8&sessionVariables=default_storage_engine=InnoDB</url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<username>root</username>
<password>123456</password>
'''
5.安装mysql驱动
各种配置都完成之后需要安装mysql驱动,在官网下载connector/J驱动程序
# https://dev.mysql.com/downloads/connector/j/
#mysql-connector-java-8.0.22.jar
#将驱动程序包放进以下两个文件夹中
/opt/atlassian/confluence/lib
/opt/atlassian/jira/lib
这样驱动就安装好了
6.启动
到此为止迁移工作就完成了,下面运行jira、confluence
#运行jira
/opt/atlassian/jira/bin/startup.sh
#运行confluence
/opt/atlassian/confluence/bin/startup.sh
jira默认端口为8080,confluence为8090
#浏览器中访问
127.0.0.1:8080 #jira
127.0.0.1:8090 #confluence
此时使用之前的账号密码就可以成功进入系统了,与旧服务器一摸一样,完美!
总结
注意:数据库备份时最好使用root账号,否则可能会出现其他账号没有备份权限的问题
本次迁移亲自测试无错,方法上还是比较方便的,参考需谨慎,把数据搞丢了就太可惜了。本次教程ubuntu、centos7都可以使用,原则上来讲只要是数据库有备份就不怕再挂掉,此方法简单明了