Approach to migrate mongodb using mongomirror using 2 GCE only

approach to migrate mongodb using mongomirror: Setting up mongodb instace on GCE and then migrate to another on GCE only

  1. setting up 2 GCE on same project
  2. Installed mongodb on both GCE
  3. Installed mongomirror on source vm1
  4. Tried exeuting mongomirror command on source GCE using username and pwd
    ./mongomirror --host rsMigration/SOURCE_IP --username root --password root123 --destination DESTINATION_IP:27017 --destinationUsername admin --destinationPassword admin123

This error has occured has during executing above command:
mongomirror version: 0.12.2 git version: 9b30f320e44f90afec5c0fa792d4c003b71ead6b Go version: go1.16.7 os: linux arch: amd64 compiler: gc 2021-10-27T07:57:03.252+0000 Error initializing mongomirror: could not initialize source connection: could not connect to server: server selection error: server selection timeout, current topology: { Type: ReplicaSetNoPrimary, Servers: [{ Addr: 27017:27017, Type: Unknown, Last error: connection() error occured during connection handshake: dial tcp i/o timeout }, ] }

Could you please help us with this issue?

Welcome to the MongoDB Developer Community Forums @Mohammed_Sahil !

mongomirror is a tool for migrating an existing replica set to a MongoDB Atlas replica set so it has some assumptions about the destination (for example, that this will be a replica set).

I recommend using mongomirror if your destination is an Altas cluster, but for migrating to (or from) a more general destination I suggest using MongoPush.


Thanks a lot Stennie Do you have any solution for the below

  1. We have mongo DB in Azure cloud. We want to migrate to GCP( VM to VM migration thats is un managed DB)

What is the best solution with No down time or less down time?

Do you have any doceumetation for the same

Hi @Mahammad_Fayiz,

Your question is about a variation of non-Atlas migration, so I suggest looking into MongoPush:

MongoPush’s developer, @ken.chen, has written some great blog posts and documentation which are linked from the MongoPush download on DockerHub. Definitely test your migration in a staging environment before production.

Note: this is not a commercially supported too and per the disclaimer in the Readme any usage is at your own risk.


@Stennie_X We have large database (more than 10TB) on azure replica set. We want it to move to another azure replica set, can we use mongomirror. If yes, how? We tried but its not working.