Bitbucket備份恢復


我們需要備份什么?

home directory:contains  repository data, log files, plugins, and so on.

database:contains data about pull requests, comments, users, groups, permissions, and so on.

備份的策略

 
Zero Downtime Backup
DIY Backup
Backup Client
Summary A technique that eliminates downtime completely using internally consistent database snapshots and block-level filesystem snapshots A technique that minimizes downtime using incremental copy or vendor-specific snapshot technology

Simple but unsuitable for use in high availability environments.

An external utility which locks a Bitbucket Server instance and backs up its entire home directory and database in a vendor-independent format.

Downtime (tick) Zero at backup time.

(warning) Low. Only needs to lock Bitbucket briefly to create a consistent snapshot. Downtime can be as low as a few seconds.

(error) High. Bitbucket is locked for the entire duration of the backup process, which may take several minutes or longer, especially in large organizations.

Minimum product version Bitbucket 4.8+

Stash 2.12+

Bitbucket 4.0+

Stash 2.7+

Bitbucket 4.0+

Bitbucket Server (tick) Supported. Bitbucket tolerates (but does not attempt to resolve) any inconsistencies between the home directory and database after restoring. (tick) Supported (tick) Supported
Bitbucket Data Center (tick) Supported. Bitbucket can perform an integrity check at restore time to scan for inconsistencies between the home directory and database,and resolve them. (tick) Supported (error) Not supported, even if you are running on one cluster node.
Minimum requirements
  • Requires you to use the snapshot tools of your file system and database vendor. Example scripts are provided.
  • Requires your home directory to be on a file system volume capable of atomic (block level) snapshots, for example, Amazon EBSLVMNetAppXFS, or ZFS.
  • Minimizing the time between database andfilesystem snapshots (or using vendor-specific point-in-time recovery) reduces the chances of inconsistencies occurring

Requires you to use the snapshot tools of your file system and database vendor. Example scripts are provided.

No special requirements. "Just works" out of the box.
Backup format Vendor-specific database snapshot and block level file system snapshot of the entire disk volume. Vendor-specific database dump and file system snapshot.

Database vendor-independent.

Documentation Using Bitbucket zero downtime backup Using Bitbucket Server DIY Backup Using the Bitbucket Server Backup Client

我們這邊采用第三種方式進行備份。

備份包括:

  • the database Bitbucket Server is connected to (either the internal or external DB)
  • managed Git repositories
  • the Bitbucket Server audit logs
  • installed plugins and their data

不包括:

  • export/*
  • log/* (except for the audit logs)
  • shared/data/db* (HSQL data in the DB is backed up, but the files on disk are not)
  • tmp
  • the plugins directory (except for the installed-plugins directory)  

下載指定備份插件: release of the Bitbucket Server Backup Client that is compatible with your Bitbucket Server instance

解壓下載的插件包,進行相關配置(編輯 backup-config.properties 文件)

#備份

bitbucket.home=/var/atlassian/application-data/Bitbucket  #bitbucket家目錄

bitbucket.user=bitbucket # bitbucker備份的賬戶

bitbucket.password=xxxxx #賬戶密碼

bitbucket.baseUrl=http://localhost:7990 #bitbucket地址

backup.home=/S3/bitbucket #  備份的路徑

#恢復

jdbc.override=true

jdbc.driver=org.postgresql.Driver #配置引擎為postgresql

jdbc.url=jdbc:postgresql://localhost:5432/bitbucket    #postgresql 中Bitbucket 倉庫數據庫地址

jdbc.user=bitbucket # postgresql 中 Bitbucket 賬戶

jdbc.password=xxxxx  #密碼

 

#備份命令

java -jar /path/to/bitbucket-backup-client.jar

#恢復命令  需先清空數據庫和bitbucket家目錄中的數據

停掉Bitbucket服務

rm -rf /var/atlassian/application-data/bitbucket

su - postgres ; psql ; drop database bitbucket;create database bitbucket

java -jar /path/to/bitbucket-restore-client.jar  /S3/bitbucket/backup/bitbucket-xxxxx.tar

chown -R atlbitbucket.atlbitbucket /var/atlassian/application-data/bitbucket

 

參考鏈接:https://confluence.atlassian.com/bitbucketserver0414/using-the-bitbucket-server-backup-client-895368009.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM