0

I'm currently using helm charts from bitnami (Here) and trying to use a Cloud SQL instance in GCP. No matter what connection string I build, I get various connection errors connecting to the database. This causes the initial pod startup to fail, and never fully initialize.

It does not appear that spring-cloud-dataflow comes bundled with spring-cloud-gcp so it cannot be configured via Instance Name, so I assume we need to use the Private IP address, which fails every time.

For the below tests, a Cloud SQL MySQL instance was created, and a Cloud SQL Postgresql instance was created.

Chart configuration 1 for MySQL instance: (username and password omitted for brevity)

mariadb.enabled=false
externalDatabase.dataflow.url=jdbc:mysql://<privateip>/dataflow?useSSL=false
externalDatabase.dataflow.username=root
externalDatabase.driver=org.mariadb.jdbc.Driver

Results in (using port 0 or port 3306):

java.sql.SQLNonTransientConnectionException: Could not connect to address=(host=<private IP>)(port=0)(type=master) : Could not connect to <private IP>:0 : unexpected end of stream, read 0 bytes from 4 (socket was closed by server)
Caused by: java.io.EOFException: unexpected end of stream, read 0 bytes from 4 (socket was closed by server)

Chart configuration 2 (postgresql instance):

mariadb.enabled=false
externalDatabase.dataflow.url=jdbc:postgresql://<Private IP>:5432/
externalDatabase.dataflow.username=postgres
externalDatabase.driver=org.postgresql.Driver

Results in:

org.postgresql.util.PSQLException: The connection attempt failed.
Caused by: java.net.SocketException: Connection reset

I've verified that I can reach the databases via jdbc through Squirrel SQL (for postgresql) and MySQL workbench.

Will this never work unless spring-cloud-dataflow ships with spring-cloud-gcp?

fiidim
  • 157
  • 8

1 Answers1

0

You'll need to use the Cloud SQL Proxy or the Cloud SQL Java Connector.

There are a couple of answers here that show how to do that:

Also, if your Cloud SQL instance is private IP only, you'll need to make sure your Data Flow deployment is in the same VPC as your Cloud SQL instance. For Public IP instances, using the Java connector or the proxy alone should be fine.

enocom
  • 1,496
  • 1
  • 15
  • 22