Bitbucket server trying to re-attach to previous database after losing app server

We lost our server that was hosting Bitbucket on prem.  The database is intact.  I want to install Bitbucket on new server and connect to old database.  What are the right procedures to not lose configuration?  I tried to just point new install to the old database but it wants a clean database. For JIRA, I copied the old home directory on top of the new install.  Updated the database connection info and boom it worked.  Will the same thing work for Bitbucket?  Not sure if I can get to old BItbucket home directory anymore so thought I would ask in here.

1 answer

1 accepted

This widget could not be displayed.

Hi Bryan,

If you backed using one of the methods in Using Bitbucket zero downtime backup or Using Bitbucket Server DIY Backup you can restore by running the restore script as the home and database info will be saved in the backup:

 

./bitbucket.diy-restore.sh

Additionally, if you used the Bitbucket Server Backup Client that will capture the home directory as well and you  can restore using the below directions:

Restoring Bitbucket Server to use the existing DB

This section applies if you are restoring Bitbucket Server to fix a corrupted installation, but are able to use the existing DB that Bitbucket Server was backed up from. This scenario assumes that Bitbucket Server is to be restored to the same server from which Bitbucket Server was originally backed up.

The Restore Client must be run on the machine that Bitbucket Server should be restored to. To ensure restores do not accidentally delete existing data, the Restore Client will only restore into an empty home directory and an empty database.

The Restore Client will use the JDBC connection configuration contained in the backup you are restoring from.

Follow this process:

  1. Stop your Bitbucket Server instance.
  2. Delete the content of the current home directory, so that it is empty.
  3. Drop the existing tables in your database so it is empty. The database still needs to exist with the same user/password, and it should have the configuration described in the 'Create the Bitbucket Server database' section of the relevant page here: 
  4. Run the Restore Client using the following command (replacing 'path/to/bitbucket/home' and '/path/to/original/backup/file' with your own values):

    java -Dbitbucket.home="path/to/bitbucket/home" -jar bitbucket-restore-client.jar /path/to/original/backup/file
  5. If you are restoring Bitbucket Server to fix a corrupted installation, now follow Steps 4 to 6 of the Bitbucket Server upgrade guide. Note that you should use the same version of Bitbucket Server that was used to back up Bitbucket Server.

If you did backup using one of the methods in Using Bitbucket zero downtime backup or Using Bitbucket Server DIY Backup take a look at the articles for more information in regards to the restore.

Cheers,

Branden

Thanks, since I did not follow the procedures for backing up (hangs head in shame) I did not have a restore to perform.  But I did have copies of the old server directories.  I copied the home directory and the directory in Application Data folder.  I then modified the environment variable to point to the old home directory name that I had just copied over.  The database and server were the same so nothing to update for that.  I started it up and it worked.

I will be using Backup Server Client now on a regular basis.  :)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

1,306 views 8 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you