0

I'm trying to create a simple dag that dumps mysql to a bucket like this:

extract = MySqlToGoogleCloudStorageOperator(
    task_id='extract_data',
    mysql_conn_id='mysql_instance_connection',
    google_cloud_storage_conn_id='google_cloud_storage_default',
    sql='SELECT * FROM guestbook.entries',
    bucket='gs://bucketname',
    filename='guestbook.dump',
    dag=dag)

I create a MySQL connection called mysql_instance_connection with the ip address for the host, database name for the schema, login and password that I setup when creating the database online, and port as 3306.

When I run the dag I get the following error:

_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on '[IP_ADDRESS]' (110)")@-@{"task-id": "extract_data", "execution-date": "2018-08-21T16:35:59.161183", "workflow": "extractMysqlData"}

What do I need to do to give composer permission to access my MySQL database?

Rob
  • 3,333
  • 5
  • 28
  • 71
  • https://cloud.google.com/sql/docs/mysql/connect-kubernetes-engine I've gone through this tutorial and still can't figure out how to get airflow to connect through the proxy – Rob Aug 21 '18 at 22:10
  • Rob, I understand you are running Google Cloud Composer in Kubernetes? It's what I understand from your last comment but you didn't mentioned this in your original message. May you specify where and how exactly are you trying to connect? – Temu Aug 22 '18 at 13:25
  • I also understand it is a Cloud SQL Second Generation instances, right? – Temu Aug 22 '18 at 13:32
  • I am trying to create a dag that uses my cloudsql instance – Rob Aug 22 '18 at 13:50
  • I mentioned it in the title of my post – Rob Aug 22 '18 at 13:51
  • I am trying to connect using `MySqlToGoogleCloudStorageOperator` – Rob Aug 22 '18 at 13:51
  • Are there any errors logged in Stackdriver? You mentioned going through the tutorial, was there a specific point it stopped working? – Christopher P Aug 28 '18 at 15:50
  • @Rob did you manage to get this to work? – Anthony Keane Jan 04 '19 at 01:21

0 Answers0