Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Migrate Postgres on a VM to CloudSQL

Hi,
I am trying to migrate my Postgres data on vm to cloud sql. I follwed all the steps that were shown in Qwiklabs.
I was able to create a migration job, but it is getting failed with an error:
"Failed to Start migration job postgres-job - error code: 9, error message: finished setup replication with errors: [postgres]: error creating subscription on replica: error creating subscription: pq: could not connect to the postgresql server in replication mode: FATAL: no pg_hba.conf entry for replication connection from host "ip_addr", user "migration_admin", SSL off ; [testdb]: error creating subscription on replica: error creating subscription: pq: could not connect to the postgresql server in replication mode: FATAL: no pg_hba.conf entry for replication connection from host "ip_addr", user "migration_admin", SSL off"
Here the host is cloud sql outgoing ip_addr. Shouldn't it be the VM private IP addr where the postgres is situated? 
I am not able to understand why I am getting this error and how to fix it.

Thanks

@ms4446 

1 2 202
2 REPLIES 2

Hello @VisheshVictor  ,Welcome on Google Cloud Community.

This error indicates that you Cloud SQL Instance is not able to establish replication connection to your VMs, where you have Postgres. Most probably, FW on your VM is blocking such flow. 
The pg_hba.conf controls which hosts and users are allowed to connect. What you have to do is:
1. configure your VM's firewall to allow incoming connections from the Cloud SQL instance. You can check connectivity by following https://cloud.google.com/sql/docs/postgres/manage-connectivity-tests


2. update the pg_hba.conf file on your VM's Postgres instance to allow connections from the Cloud SQL instance's private IP address.

I found also documentation with troubleshooting steps for migration : https://cloud.google.com/database-migration/docs/postgres/diagnose-issues

--
cheers,
DamianS
LinkedIn medium.com Cloudskillsboost

Hello,

Thank you for your engagement regarding this issue. We haven’t heard back from you regarding this issue for sometime now. Hence, I'm going to close this issue which will no longer be monitored. However, if you have any new issues, Please don’t hesitate to create a new issue. We will be happy to assist you on the same.

Regards,
Jai Ade