Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Database Migration Wizard Tests Fail Connecting To Postgres

Jeremy Flint February 1, 2018

I am in the process of migrating our Bitbucket Server (v4.14.0)

from Windows to Linux. My plan is to spin up a Postgres DB on the linux box and migrate the database to that, then move the home folder content.

When I try to test the db migration wizard, I get the following errors:

The configuration entered is not valid. A database connection could not be established. Please check your configuration and try again.
	com.atlassian.stash.internal.db.DefaultDatabaseManager.validateConfiguration(DefaultDatabaseManager.java:217)
	com.atlassian.stash.internal.migration.DefaultMigrationService.validateConfiguration(DefaultMigrationService.java:85)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	...
Could not get JDBC Connection; nested exception is org.postgresql.util.PSQLException: Connection to 192.168.123.35:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
	org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
	com.atlassian.stash.internal.db.DefaultDatabaseValidator.validate(DefaultDatabaseValidator.java:44)
	com.atlassian.stash.internal.db.DefaultDatabaseManager.validateConfiguration(DefaultDatabaseManager.java:214)
	...
Connection to 192.168.123.35:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
	org.postgresql.Driver$ConnectThread.getResult(Driver.java:358)
	org.postgresql.Driver.connect(Driver.java:282)
	java.sql.DriverManager.getConnection(Unknown Source)
	...
Connection refused: connect
	java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
	java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
	java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
	...

 

1 answer

0 votes
Edwin Kyalangalilwa
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 1, 2018

Hi Jeremy,

Check that Postgres is running and that it is listening/accepting connections on port 5432.

So on server 192.168.123.35, check port 5432 is open. And the server you're connecting from can reach this server.

Jeremy Flint February 1, 2018

Thanks! Ok, I got the database migrated. I am working on migrating Bitbucket to a new server. So I have:

  • Migrated the database.
  • Stopped the service on the current server (Windows)
  • Migrated the home directory to the new server
  • Installed BitBucket on the new server (Linux)
  • Ran installer as an upgrade to existing.

When I try to put in the info for the new DB, it tells me there is already data there (duh). How can I get it to use the data already in the DB? Or do I need to install to a clean DB then switch it to use the migrated DB post installation?

Edwin Kyalangalilwa
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 2, 2018

An option is to download the tar or zip option, edit the necessary files to point Bitbucket to the current database and home directory then startup. After this, then run the upgrade option.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events