Managed VM not running Cloud SQL Proxy

2019-09-09 06:21发布

问题:

Launching a Managed VM with a Java application, the following appengine-web.xml

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
    <application>thmadmin-ben</application>
    <version>master</version>
    <threadsafe>true</threadsafe>
    <vm>true</vm>
    <manual-scaling>
        <instances>1</instances>
    </manual-scaling>
</appengine-web-app>

I don't appear to have a Cloud SQL proxy running on the managed VM. Do I need to add an app.yaml file or define something else in appengine-web.xml?

回答1:

Per the documentation, you need to specify the instances which you will be connecting to as follows and redeploy your application.

When using appengine-web.xml, the syntax would be:

<beta-settings>
  <setting name="cloud_sql_instances" value="<PROJECT-ID>:<REGION-NAME>:<SQL-INSTANCE-NAME>[, ...]" />
</beta-settings>

If this setting is not present, the Cloud SQL Proxy won't start.