Failed to connect with mysql using google data fusion - google-cloud-data-fusion

I failed to connect to MySQL from google data fusion
the step:
First, I add the connector
https://dev.mysql.com/downloads/file/?id=462850
Second, I try to add a connection (failed)
screenshot of the MySQL:
Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
**** Edit **** I think this is associated with allowing data fusion to access to our production data
my second question is:
How can I know what is the Google Data Fusion IP address?
if someone can help me that will be wonderful
thank you

This error indicates that Cloud Data Fusion is unable to connect to mysql via JDBC with the given credentials (Host/port/User). You will need to ensure that the user provided can connect from any host. To trouble shoot this further, please do the following:
SSH to the mysql box and run netstat -tln and confirm if the port where mysql is running on is 3306
Login to mysql using Mysql CLI or a workbench tool and run the following
SHOW DATABASES to list all the Databases in mysql and see if the one you are accessing is present
Ensure that the user that is accessing mysql from Data Fusion can access from any hosts by running SHOW GRANTS FOR 'username'#'%'
Here are some additional articles that might help with troubleshooting. https://serverfault.com/questions/89955/unable-to-connect-to-mysql-through-jdbc-connector-through-tomcat-or-externally

Even if you try to access via public IP it'll not work. I had the same issue. Because you have to enable VPC peering between the Datafusion tenant project id with your VPC.
Detailed steps are here: https://cloud.google.com/data-fusion/docs/how-to/create-private-ip

Related

Connect Cloud Run to Cloud SQL Server Instance in C#

If I understand the "Cloud SQL Connections" tab in Cloud Run should instantiate the Cloud SQL Proxy.
What is the sql server connectionstring that I should use to make this work?
Setup : (All in the the same GCP Project):
1. Create a Cloud Sql instance of SQL Server
2. Upload your docker image to Google Container registry.
Written using .netcore with code to connect to the SQL Server created in step 1
2. Create a Service instance in Google Cloud Run.
3. Specify Cloud SQL Connections and select your sql server instance from the list and deploy.
I've not tried this using Cloud Run and SQL Server but ...
The proxy should make a connection available to your .NET client on 127.0.0.1:1443 (link)
Assuming you're using a database client similar to the Google example, your connection string will be:
"ConnectionString": "User Id=[[USER]];Password=[[PASS]];Server=127.0.0.1;Database=[[DB]];"
If I understand correctly, the default port is 1443.
NB Per other commenters, your question would be improved with more details. When you write that you're completing steps, please include the links. When you reference your configuration, please include snippets. Folks answering your questions benefit from having to assume as little as information as possible from questions.
I do not think it is supported yet. There is no documentation for Cloud SQL Server.
According to the official documentation :
Once correctly configured, you can connect your service to your Cloud
SQL instance's unix domain socket using the format:
/cloudsql/INSTANCE_CONNECTION_NAME.
Note: Cloud Run (fully managed) does not support connecting to the
Cloud SQL instance using TCP. Your code should not try to access the
instance using an IP address such as 127.0.0.1 or 172.17.0.1.
Also:
Note: The Cloud SQL Proxy does not support Unix sockets on Windows.
I tried to do it using Cloud SQL Proxy with tcp and got:
System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (111): Connection refused 127.0.0.1:1433

Connecting to Google Cloud SQL from my machine

I'm trying to connect to Google Cloud SQL from my machine (Ubuntu) using this command:
mysql --host='Public IP' --user='' --password
However, I'm getting this error:
ERROR 2003 (HY000): Can't connect to MySQL server on 'Public IP' (110)
I need any help resolving my issue.
First you need to let the Cloud SQL instance which IP addresses it can accept. You can do that without SSL by following the instructions here. However, to be more secure, I would recommend you using SSL. More info on that here.
Probably the easiest way to securely connect from your local machine to a public ip of a cloud SQL instance is to download and use the proxy, following the instructions here:
https://cloud.google.com/sql/docs/mysql/connect-admin-proxy
What you have to do is add a network to the public ip section, under the connections tab after selecting your Cloud SQL instance.
See Cloud SQL Connections Tab here
So, for the name input you put firstname-lastname kind of thing to denote whose ip it is. Then input your IP address 1.2.3.4/32 into the network input.
After doing so and saving you will be able to connect.
Yes, you can add SSL and use certificates. That is all best practice and what should be done for a production stack. But if this is just getting off the ground and in rapid development, that's all you need to do in the beginning.

Cannot connect to on-prem SQL Server with Google Cloud Data Fusion

I am trying to test a connection using Cloud Data Fusion to connect to an on-prem SQL Server. Our GCP Project does not use the default network but rather a custom VPC.
It's important to note that security is very important as this database contains healthcare data.
We currently have App Engine Flex code that uses pymssql to query the database on this SQL Server through the VPC, and want to test using Data Fusion.
I have copied and added the generated data fusion service account to IAM with role Cloud Data Fusion API Service Agent.
I have configured in Data Fusion
system.profile.properties.network = <VPC name>
I have verified that the username and password for authentication to SQL Server are valid for the database.
THE VPC network allows port 22 and 1433.
At this point I am just trying to get a successful connection to query a table in the database.
Here is the error message I get:
Connect timed out. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.
Thoughts?
It looks like you can access SQL Server from GCP (via AppEngine Flex Py code) but having trouble connecting through Data Fusion. It also looks like authentication doesnt seem to be a problem (as the error message is around connection).
One area I can think of is to try Cloud Data Fusion private IP, that allows you to securely connect to your VPC from Cloud Data Fusion. This is a new feature and you will need Data Fusion product team support to leverage this feature.

MySQL Workbench cannot connect from home to Google Cloud SQL

I cannot connect to my Google Cloud SQL database from my Macbook Pro using MySQL Workbench.
I have read the help file here:
https://cloud.google.com/sql/docs/mysql/admin-tools
I have added an authorized IP address for my IP per
https://cloud.google.com/sql/docs/mysql/configure-ip#add
I created a user for the database with it set to allow to connect from any host. I get the error "Can't connect to MySQL server on 'XX.XXX.XX.XXX' (60)
I have also attempted to telnet and get a consistent error that I am unable to connect to the remote host
As far as I know, I've followed all the steps but it really seems I'm getting blocked even before the server. I am trying to connect from home and I don't believe my home firewall is blocking things. I am wondering if there's something I need to open up on the GCE firewall but I have successfully connected to this database from other outside tools (e.g., Zapier).
Your best action right now would be to create a proxy with public IP address.
https://cloud.google.com/sql/docs/mysql/connect-external-app
This link will walk you through that process. If this doesn’t solve your issue, then taking your question to ServerFault (Stackoverflow sister site) might give you a better idea of how to fix your issue.

Google Cloud Data Fusion 1. Does not connect to oracle 2. When the pipeline is running I get 'default' network port error

I installed oracle-jdbc thin driver to connect with On prem oracle DB but when I test the connection I get network adapter error
I tried the changing the host but still same
When running the pipeline from GCS-BQ I getting network port error. Can we change the VPC the pipeline is running on ?
Regarding the oracle db connection error, is the db available on the public network for connection? Currently wrangler service in Cloud Data Fusion cannot talk to the on-prem db over a private connection and we are actively working towards it.
However if the db is available on the public network then it seems like the issue with the oracle db configurations. Can you please take a look at this answer and see if it helps - Oracle SQL Developer: Failure - Test failed: The Network Adapter could not establish the connection?
Also are you able to connect to the oracle db through some other query tool such as SqlWorkbench?
Breaking down your question:
1. Connecting to on-prem databases
It is possible nowadays to connect to on-premise databases. Make sure you created an interconnect between the on-prem network and the network used by Data Fusion instance and make sure you applied the right firewall rules (seems you are getting firewall issues by the logs). I suggest trying to connect directly in the database first to confirm that the network setup works.
2. Change network configurations on the Data Fusion job.
You can specify parameters for your job. There are options to change the network and subnetwork that the job will be executed under Configure > Compute config > Customize option. If you use shared VPC you can also specify the Host project.