Reputation: 1556
I am trying to retrieve data from Cloud SQL via Cloud Composer DAG to GCS.
MySQLdb._exceptions.OperationalError: (2003, "Can't connect to MySQL server on 'xx.xxx.xx.x' (110)")
MySQLdb._exceptions.OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1' (111)") 3. Enabled the Private IP & selected the network the same as cloud composer network. still same issue.
ping has no response to Private IP in cloud shell. ping has response to Public IP in cloud shell.
Can anyone help on the same? like what should be done for a composer dag to access the tables in cloud sql?
Upvotes: 0
Views: 540
Reputation: 1552
In order to connect Cloud Composer to Cloud SQL via private IP, please enable Export custom routes in the VPC peering between your VPC network and Cloud SQL's VPC network.
Once the exporting of custom routes is enabled, the VPC network of the Cloud SQL instance knows where to route the pod traffic and connection can be successfully established
You can achieve this by following these steps:
Cloud Console Main Menu > VPC Network > VPC network peering > servicenetworking-googleapis-com > edit > enable the export custom route.
You can refer to this doc for more information.
Upvotes: 0