How to troubleshoot Bamboo connectivity issues with Databases
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
The purpose of this article is to provide steps to troubleshoot Bamboo connectivity issues with Databases. To confirm that Bamboo is not able to connect to the Database below exception messages can be seen in <bamboo-home>logs>atlassian-bamboo.log file.
ERROR [main] [HikariPool] HikariPool-1 - Exception during pool initialization.
org.postgresql.util.PSQLException: Connection to 192.168.130.95:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:342) ~[postgresql-42.6.0.jar:42.6.0]
Environment
The Solution has been tested on Bamboo 9.2.11 and PostgreSQL DB, but the troubleshooting steps can be used for other DB types as well by making applicable changes.
Solution
Investigate if the DB is running properly or not
1) The first step is to make sure whether the Database Instance is running properly or not, for PostgreSQL DB running on Unix OS this can be checked by running the below command.
ps -f -u postgres
2) Second step is to check if port 5432 is open on the server where your instance of Postgres is running? Please run the below command, replace 5432 with any other manually configured port if any.
netstat -ltnp|grep 5432| grep LISTEN
3) Third step is to check if you are able to manually connect to PostgresDB from the Linux command line? Please run the following command.
psql -U <username> -p 5432 <db-name>
If the result of above 3 commands are okay, it means the DB is running properly and is ready to accept connections from Bamboo server, next step is to investigate if the DB Server is reachable properly from Bamboo server.
Investigate if the DB server is reachable from Bamboo server
1) The first step is to validate if the DB server is reachable from Bamboo server, this can be checked by running the below command.
ping 192.168.130.95 or ping dbserverhostname
Here 192.168.130.95 or dbserverhostname can be used, please ping whatever is coming in the log files as error or the configuration inside <bamboo-home>bamboo.cfg.xml file under hibernate.connection.url property.
5432 is the default port used to connect to PostgreSQL, if a different port is used please replace that in the below command
2) If the ping is working fine next step is to check if Bamboo server is able to connect the DB server port by running the below command.
telnet 192.168.130.95:5432
or
curl -v 192.168.130.95:5432
3) If the hostname is used inside <bamboo-home>bamboo.cfg.xml file under hibernate.connection.url property make sure Bamboo server is able to resolve the hostname this can be checked by running the below command
nslookup dbserverhostname
With the above testing you should be able to identify where is the connection being broken and fix it accordingly.