Mongosync not able to resolve source and destination mongoDB cluster

Hello,

I was following the article: https://www.mongodb.com/docs/cluster-to-cluster-sync/current/connecting/onprem-to-onprem/#connect-two-self-managed-clusters
to connect two self managed cluster and sync data from source cluster to destination. I am running the utility on my local machine and the source and destination mongoDB clusters are in AKS.

I am stuck at resolving the source and destination cluster IP addresses.

Note: I have port forwarded using kubectl in this manner
localhost:27016 <-> my-db-mongodb-0.my-db-mongodb-headless.default.svc.cluster.local (Source AKS cluster)
localhost:27017 <-> my-db-mongodb-1.my-db-mongodb-headless.default.svc.cluster.local (Source AKS cluster)

localhost:27018 <-> my-db-mongodb-0.my-db-mongodb-headless.default.svc.cluster.local (Destination AKS cluster)
localhost:27019 <-> my-db-mongodb-1.my-db-mongodb-headless.default.svc.cluster.local (Distination AKS cluster)

Why is the utility considering these cluster address, even when I am mentioning the port forwarded address as commandline argument.

Hi @Ashok_manojPhilip welcome to the community!

Why is the utility considering these cluster address, even when I am mentioning the port forwarded address as commandline argument.

This is sort of alluded to in the connection string section in the page you linked to:

Specify the hostnames of the mongod instances the same way that they are listed in your replica set configuration.

Since mongosync uses standard MongoDB driver to perform its function, it needs to connect to all parts of the deployment as specified in the monitoring spec. It takes the list of servers to connect to from the replica set configuration, which is how all supported drivers works currently.

In short, all the nodes in the replica set needs to be reachable by their addresses in the replica set config by mongosync for it to work.

Best regards
Kevin

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.