I have created a Data Fusion instance and a PostgreSQL database in Google Cloud. When I make the connection from Data Fusion to the database in order to make a pipeline I get the following error:
Failed to create connection to database via connection string: jdbc:postgresql://IP/postgres and arguments: {user=USER}. Error: SocketTimeoutException: connect timed out. Make sure you specify the correct connection properties.
I have tried to modify permissions in IAM but I am not able to solve the problem. In case it was a PostgreSQL problem, I also tried to do it with SQL and I get the same problem.
Could someone please help me?
The "SocketTimeoutException: connect timed out" error while connecting Data Fusion to your PostgreSQL database in Google Cloud suggests a network connectivity issue. Here are some steps to troubleshoot:
1. Verify Connection Details:
JDBC URL: Can you please confirm the JDBC URL you're using in Data Fusion? It should look like this:
jdbc:postgresql://<YOUR_POSTGRESQL_PUBLIC_IP_ADDRESS>/postgres
Replace <YOUR_POSTGRESQL_PUBLIC_IP_ADDRESS>
with the actual public IP address from your Cloud SQL console.
Database Name: Is "postgres" the correct database name you created in Cloud SQL? If you're unsure, you can double-check this in the Cloud SQL console.
Credentials: Are you absolutely certain the USER
username and password you're entering in Data Fusion match the credentials you set up in Cloud SQL?
2. Network Configuration:
Firewall Rules:
Private IP: If you're trying to use the private IP of your Cloud SQL instance, confirm that you're using that private IP in the JDBC URL, not the public IP.
3. PostgreSQL Instance Settings:
Public IP: Please confirm whether you've enabled the "Public IP" option in your Cloud SQL PostgreSQL instance settings. You can find this in the "Connections" tab.
Connectivity: In the Cloud SQL console, check the "Overview" tab for your PostgreSQL instance. Does it show any errors or warnings about connectivity?
4. Data Fusion Instance:
5. IAM Permissions:
roles/cloudsql.client
and roles/compute.networkUser
roles? If not, add them.Additional Steps:
psql
: Let's try this to rule out any Data Fusion-specific issues. On a machine (e.g., Cloud Shell) that has network access to your Cloud SQL instance, try the psql
command I provided. Does this connection succeed?User | Count |
---|---|
4 | |
4 | |
2 | |
1 | |
1 |