Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Problem

User when When connecting a Private CDF instance to a Private PostgreSQL, you see the following connection.

Connection to :5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

...

  1. Assuming the private CDF instance is create created as per instructions here and also the private Cloud SQL or PostgreSQL is created as required.

  2. Now that both the instances are setupset up, create a private GCE VM (with only internal IP) using the following gcloud command:

Code Block
export PROJECT=<customer-project>
export REGION=<vm-region>
export ZONE=`gcloud compute zones list --filter="name=${REGION}" \
                --limit 1 --uri --project=${PROJECT}| sed 's/.*\///'`
export SUBNET=<customer-vpc-subnet-name>
export NAME=<gce-vm-name>
export MYSQL_CONN=<mysql-instance-connection-name>

# Create the VM
gcloud beta compute --project=${PROJECT} instances create ${NAME} \
   --zone=${ZONE} --machine-type=g1-small --subnet=${SUBNET} \
   --no-address --metadata=startup-script="docker run -d \
   -p 0.0.0.0:33065432:33065432 gcr.io/cloudsql-docker/gce-proxy:1.16 /cloud_sql_proxy \
   -instances=${MYSQL_CONN}=tcp:0.0.0.0:33065432" \
   --maintenance-policy=MIGRATE --scopes=https://www.googleapis.com/auth/cloud-platform \
   --image=cos-69-10895-385-0 --image-project=cos-cloud

# Get the VM internal IP
export IP=`gcloud compute instances describe ${NAME} \
    --zone ${ZONE} | grep "networkIP" | awk '{print $2}'`

# Promote the VM internal IP to static IP
gcloud compute addresses create proxy --addresses ${IP} \
    --region ${REGION} --subnet ${SUBNET}

# Note down the IP to be used in CDF MySQL or PostGreSQL JDBC 
# connection string
echo ${IP}

echo "JDBC Connection strings:"
echo "jdbc:postgresql://${IP}:5432/{PostgreSQL_DB_NAME}"
echo "jdbc:mysql://${IP}:3306/{MySQL_DB_NAME}"

Once the VM is created with a static IP, now use this as the host for the mysql or postgresql database to be accessed from Cloud Data Fusion.

...

Page Properties
hiddentrue

Related issues