-
Notifications
You must be signed in to change notification settings - Fork 132
Error connecting with MySQL Google Cloud #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for report. The issue doesn't look like a Spring Data issue but rather either an environmental issue or a driver issue. Reporting it (after making sure it's a driver issue) at https://github.com/jasync-sql/jasync-sql makes more sense. I assume using R2DBC MySQL (https://github.com/mirromutth/r2dbc-mysql) will result in the same issue. Out of curiosity, what's required for a regular MySQL Connector/J to connect to MySQL? Do you need to include any specific parameters to make it work? |
Hello Mark, Thank you for your quick response. Actually, not really, you don't need anything else to make it work. It seems working in my local environment. In Google Cloud, I followed the official documentation(https://cloud.google.com/sql/docs/mysql/connect-app-engine). So, should I have to raise a ticket in https://github.com/jasync-sql/jasync-sql? I can do a test using https://github.com/mirromutth/r2dbc-mysql as well just for checking if it produces the same problem. Kind regards, Jose |
Thanks for the pointer. These are definitively issues between the driver and Google Cloud. As GCP SQL also touches Postgres, the R2DBC Postgres driver is affected, too. Do you have a contact to GCP folks so we could elaborate on a potential approach? Paging @mirromutth @oshai @meltsufin Frankly, I have no idea what happens inside of https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory so we would require some details from GCP folks to understand what happens there and what a driver would need to consider. Also, we need to consider that all this needs to happen in a non-blocking way. Related ticket in R2DBC Postgres: pgjdbc/r2dbc-postgresql#43 Because we have currently no better place to discuss matters, I'm leaving this ticket open. |
@blecua84
cc/ @saturnism |
Hi @meltsufin I haven't tried with a private IP because I didn't know I could. I will try it. Are you sure this option is working with reactive drivers? Thank you! Jose |
@meltsufin I'd like to explore the |
@mp911de does R2DBC not work with the Private IP option? |
Last I heard from @saturnism, Private IP works, at least with the postgresql R2DBC driver. |
Ok @meltsufin I will check it for mysql R2DBC driver. Thank you! |
/cc @saturnism |
afaik, the socket factory does this:
It seems like most of the common logic is captured in https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/tree/master/core/src/main/java/com/google/cloud/sql/core And produces a |
Hi @saturnism , I found the sample of Node.js and Python in the Connecting to Cloud SQL from App Engine. See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/cloud-sql/mysql/sqlalchemy/main.py , and https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/cloud-sql/mysql/mysql/server.js . Looks like they just need set a unix socket path in connection options to work properly, isn't it? If that so, we should use BTW, what is the difference between Java implementation and Node.js/Python implementations? Sure, maybe the implementations of Node.js/Python can't be called "implementation" because they're just an option parameter in the sample code. Thanks for your time. |
Independently of the Google integration, it would make sense to provide unix domain socket connectivity for MySQL and Postgres drivers. |
See also pgjdbc/r2dbc-postgresql#191. |
Unix Domain Socket and SSL Context customization are now in place for R2DBC Postgres. I was trying to make the integration work using https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory. It turns out that we require access to R2DBC uses netty so we cannot use a regular It would make sense to extend the GCP support, ideally by wrapping Postgres and MySQL drivers in an R2DBC facade ( Happy to guide whoever wants to pick up on that end to enable R2DBC Postgres with GCP. I assume that we will see similar support in the R2DBC MySQL driver (/cc @mirromutth). |
@mp911de So does it mean even after the release of r2dbc-postgresql 0.8.0.RELEASE and support of Unix Domain Socket, we still can not connect to gcp postgres ? It's really disapponting as it will stop us and many other from using r2dbc in production |
R2DBC Postgres exposes all features so that the GCP team can provide an extension. All integration happens in the scope of GoogleCloudPlatform/cloud-sql-jdbc-socket-factory#164 and will likely be shipped as add-on to R2DBC Postgres. GCP folks outlined several access methods to connect even without the add-on to GCP database instances. You might want to leave a comment in the linked ticket so they know about your use case. |
Thanks for the info. I did. |
Closing this ticket as the concern is being handled in the scope of the GCP ticket. |
Thanks @mp911de for helping w/ the hooks! |
R2DBC is GA so you can consume Postgres and MySQL drivers directly from Maven Central. |
Hello,
I'm facing problems with my microservice built with spring-data-r2dbc and jasync-r2dbc-mysql. I'm following the proposed nomenclature for creating a ConnectionFactory object:
Deploying this configuration in my local, hitting my SQL Instance in Google Cloud works perfectly, but when I deploy it in my Google Cloud project, trying to hit the same SQL Instance in the same Google Cloud project, I've got is this error:
Failed to obtain R2DBC Connection; nested exception is io.netty.channel.ConnectTimeoutException: connection timed out: XX.XXX.XXX.XX:3306
I haven't found yet any other documentation about this error and I was wondering if I'm doing something wrong and if you guys have more information about.
Thanks in advance.
Jose
The text was updated successfully, but these errors were encountered: