0

I want to migrate a database from one cluster to another. The source and destination are withing the same VPC, but I keep getting Unknown, Last error: connection() error occured during connection handshake error.

mongomirror --host "Replicaset-Name/host-0.domain.com:27017,host-1.domain.com:27017,host-2.domain.com:27017" \
   --username "<username>" \
   --password "<password>" \
   --authenticationDatabase "admin" \
   --destination "Replicaset-Name/mongodb-0.mongodb-svc.mongodb.svc.cluster.local:27017,mongodb-1.mongodb-svc.mongodb.svc.cluster.local:27017,mongodb-2.mongodb-svc.svc.cluster.local:27017" \
   --destinationUsername "<username>" \
   --destinationPassword "<password>"

Output:

mongomirror version: 0.12.5
git version: 6e5a5489944845758420e8762dd5e5a89d2e8654
Go version: go1.16.9
   os: linux
   arch: amd64
   compiler: gc
2022-08-16T16:53:29.353+0000    Source isMaster output:  {IsMaster:true MinWireVersion:0 MaxWireVersion:7 Hosts:[host-0.domain.com:27017 host-1.domain.com:27017 host-2.domain.com:27017}
2022-08-16T16:53:29.353+0000    Source buildInfo output: {Version:4.0.12 VersionArray:[4 0 12 0] GitVersion:5776e3cbf9e7afe86e6b29e22520ffb6766e95d4 OpenSSLVersion: SysInfo: Bits:64 Debug:false MaxObjectSize:16777216}
2022-08-16T16:55:29.356+0000    Error initializing mongomirror: could not initialize destination connection: could not connect to server: server selection error: server selection timeout, current topology: { Type: ReplicaSetNoPrimary, Servers: [{ Addr: mongo-1.mongo-svc.mongodb.svc.cluster.local:27017, Type: Unknown, Last error: connection() error occured during connection handshake: EOF }, { Addr: mongo-0.mongo-svc.mongodb.svc.cluster.local:27017, Type: Unknown, Last error: connection() error occured during connection handshake: EOF }, { Addr: mongo-2.mongo-svc.mongodb.svc.cluster.local:27017, Type: Unknown, Last error: connection() error occured during connection handshake: EOF }, ] }

I've tested the connection with mongosh. It has no issues while establishing the connection.

mongosh --host mongodb-1.mongodb-svc.mongodb.svc.cluster.local:27017 --username <username>

So what might I have missed here?

Thanks!

1 Answers1

0

Is the target cluster running with TLS. If not you can try it after creating a self-signed certificate for the cluster and make it run with TLS. See the below thread: Mongomirror from atlas to local replica setup

Or if it is a dev machine then you can try running mongomirror after adding --noTLS. Full command:

    mongomirror --host "Replicaset-Name/host-0.domain.com:27017,host-1.domain.com:27017,host-2.domain.com:27017" \
   --username "<username>" \
   --password "<password>" \
   --authenticationDatabase "admin" \
   --destination "Replicaset-Name/mongodb-0.mongodb-svc.mongodb.svc.cluster.local:27017,mongodb-1.mongodb-svc.mongodb.svc.cluster.local:27017,mongodb-2.mongodb-svc.svc.cluster.local:27017" \
   --destinationUsername "<username>" \
   --destinationPassword "<password>"
   --noTLS