bitbucket灾难恢复或者服务迁移指南

Sophiya0 2020-01-31

?


注意:
本教程适合bitbucket的灾难恢复或者服务迁移

前提条件
已经使用bitbucket backup client 做了备份

环境说明

* centos 7
* SQL Server 2012
* Java 1.8
* Bitbucket

old edition - Atlassian Bitbucket v6.3.0
new edition - Atlassian Bitbucket v6.10.0

术语
bitbucket.home 指bitbucket的数据目录
例如: /var/atlassian/application-data/bitbucket
bitbucket 运行目录,指应用目录
例如: /opt/atlassian/bitbucket/[version]


参考文档:
[Using the Bitbucket Server Backup Client](https://confluence.atlassian.com/bitbucketserver/using-the-bitbucket-server-backup-client-776640064.html)

操作步骤:

> 1 - Create a new empty home directory using the user account that will be used to run Bitbucket Server.
```shell
chown atlbitbucket:atlbitbucket /path/to/[bitbucket.home]
```
> 2 - Create the 2 emtpy databases for importing old database and the new one
It should have the configuration described in the ‘ Create the Bitbucket Server database‘ section of the relevant page here:
MySQL
Oracle
PostgreSQL
SQL Server

**Even the new one will be retird but it will be used in restore process.**


> 3 - Run the Restore Client. See the following section for details.

here is an exmaple,
```shell
java -Djdbc.override=true -Djdbc.driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" -Djdbc.url="jdbc:sqlserver://192.168.0.22:1433;databaseName=bit2_db;" -Djdbc.user="bit_user" -Djdbc.password="*****" -Dbitbucket.home="/disk2/atlassian/application-data/bitbucket" -jar bitbucket-restore-client.jar /root/bitbucket-20200130-225735-289.tar
```

> 4 - starting to install toally new one of bitbucket

*Install Bitbucket server on the new server by following the instructions on Running the Bitbucket Server installer. Point the installation to an empty directory and install it as a service in case you used to have that in your previous server.*

Make sure your new installation is up and running - refer to Starting and stopping Bitbucket Server. At this stage you should see Bitbucket server guiding you for a configuration from scratch (i.e. it will ask you for license details, admin user etc.) and that‘s expected.

> 5 -Stop the newly installed instance.

```shell
su - atlbitbucket
cd /opt/atlassian/bitbucket/[version]/bin
sh stop-bitbucket.sh

```
> 6 - rename the new installed HOME directory & rename the old one to the HOME

be careful, change the owner of the HOME directory
```shell
chown atlbitbucket:atlbitbucket /path/to/HOME
```

> 7 - start bitbucket seeing step 5th;

sh start-bitbucket.sh


> 启动后,可能有多种原因无法启动:


1. 在HOME下面的shared bitbucket.properties 数据库连接需要配置为登录到老的数据库
2. 注意: app_property表,与新建的实例的数据库比较,更新为新的实例的一样。
* instance.home
* license
* server.id

再重启,正常了。

?

?

?

?

?

相关推荐