I'm trying to use Cloud SQL Proxy for my Kubernetes project.
I follow the guide of Elixir and Phoenix . Under Connect to your Cloud SQL instance , that guide says that running cloud_sql_proxy -dir=/tmp/cloudsql
and psql -h /tmp/cloudsql/[CONNECTION-NAME] -U postgres
will open the proxy.
So I tried to make a new directory with these commands below.
mkdir -p /tmp/cloudsql
chmod +x /tmp/cloudsql
and then I tried to connect to Cloud SQL Proxy.
cloud_sql_proxy -dir=/tmp/cloudsql/ 16:47
2020/10/30 16:47:50 Rlimits for file descriptors set to {&{xxxx xxxxxxxxxxxxxxxxxxx}}
2020/10/30 16:47:51 Using gcloud's active project: [instance-id]
2020/10/30 16:47:54 Listening on /tmp/cloudsql/instance-id:region:instance-name for instance-id:region:instance-name
2020/10/30 16:47:54 Ready for new connections
To connect the proxy, I opened another terminal and entered this psql
command but failed.
psql -U postgres -h /tmp/cloudsql/instance-id:region:instance-name
psql: error: could not connect to server: could not connect to server: Not a directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/cloudsql/instance-id:region:instance-name/.s.PGSQL.5432"?
What should I do additionally for connecting to the proxy?
from what I see you are passing a wrong connection name
wrong --> instance-id:region:instance-name
correct --> PROJECT_ID:region:instance-name
You can find the connection name from the
console --> Cloud SQL --> INSTANCE --> Connect to this instance --> Connection name
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.