Error migrating to Atlas from a private replica set

I’ve already switched from standalone to replica set doing the steps in this wiki:

I’m able to connect to the replica set (tried it with Compass), and see the data but the migration tool is always failing with this message:

Live Migration encountered an error: could not initialize source connection: could not connect to server: server selection error: server selection timeout current topology: Type: ReplicaSetNoPrimary Servers: Addr: localhost:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: connection(localhost:27017[-9]) connection is closed

I’ve whitelisted all four subnets, I even tried to open it to all IP’s and it still failed

Hi @Gilad_Madar,

If I understand correctly, you’re addressing the node you’re aiming to migrate as “localhost:27017”

Please note that localhost only works from the context of a specific local system. In the case of Live Migration, the Live Migration service needs to be able to reach your MongoDB replica set remotely and cannot use localhost as a hostname. Do you have a full qualified domain name that can be reached from another context? Or even a public IP?

Cheers
-Andrew

1 Like

Thanks Andrew. using the machine hostname instead of localhost solved it.

You mean the IPv4? i am having a hard time trying to connect to Live Migration Service too, been stuck on this part for days too, i thnk my rs.conf had some default parameters including the 127.0.0.1 IP (It’s a one-node local Replica Set = Source ) That would mean that the hostname:port format would look like publicIP:27017 ?

Yes, for Live Migrate to work, the replica set config (you can check it via rs.conf() in the Mongo shell) should be using public IP address(-es). If you’re restricted to private IPs only, you can use the Cloud Manager Migration service - it’s available with the free account: https://www.mongodb.com/docs/atlas/migration-from-com/