Missed Team ’24? Catch up on announcements here.

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

Migrating BBDD to external PostgreSQL database

Idoia
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 29, 2019

Hello! I'm trying to connect Bitbucket to a external postgresql database and I get the following error:

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.db.DefaultDatabaseManager.prepareDatabase(DefaultDatabaseManager.java:183) com.atlassian.stash.internal.maintenance.SpringMaintenanceTaskFactory.migrationTask(SpringMaintenanceTaskFactory.java:132) ... Failed to obtain JDBC Connection; nested exception is org.postgresql.util.PSQLException: Connection to 172.18.10.230: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:81) com.atlassian.stash.internal.db.DefaultDatabaseValidator.validate(DefaultDatabaseValidator.java:44) com.atlassian.stash.internal.db.DefaultDatabaseManager.validateConfiguration(DefaultDatabaseManager.java:214) ... Connection to 172.18.10.230: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:405) org.postgresql.Driver.connect(Driver.java:263) java.sql.DriverManager.getConnection(DriverManager.java:664)

I have checked that I am listening at that port and it is true. I have also added at pg_hba.conf file the following
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 172.18.0.0/16 trust

I have also added at postgresql.conf the following
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = 5432 # (change requires restart)

I am configuring something wrong but i don't know where. Could you please help me?



 

1 answer

0 votes
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 30, 2019

Hello Idoia and welcome to the Community!

Thanks for including your log output and your configuration for PostgreSQL. From looking at your log output and your notes, there is an issue with the Database connection with Bitbucket. There are a few things we’d like to verify, please check the following:

  • Ensure Postgres is actually running;
    • ps -f -u postgres
  • Check that Postgres is listening;
    • psql -h 172.18.10.230 -p 5432
  • Ensure there is no firewall blocking incoming or outgoing connections from the Bitbucket server.

If you’re still having issues after running through and verifying the above please reach out and let us know.

Regards,
Stephen Sifers

Idoia
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 3, 2019

Thank you Stephen!

It works!!! My firewall was blocking outgoing connections from Bitbucket

Like Stephen Sifers likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events