Skip to Content
Data TransmissionSource is MongoDBMongoDB

MongoDB

UDTS supports mutual migration among single node, replica set, and sharded cluster for MongoDB (self-built/UDB MongoDB/standard MongoDB services provided by other cloud vendors).

Source and target database versions supported range from 3.0 to 6.0. Due to cross-version feature compatibility issues, cross-major version migration is not supported. For example, migrating from 3.x to 5.x requires creating an intermediate library with version 4.x, migrating from 3.x to 4.x first, and then from 4.x to 5.x.

Functional Limitations

  1. Does not migrate system built-in databases: config/local/admin
  2. When the source or target MongoDB version is lower than 3.6, incremental migration does not support DDL
  3. When the source database is a sharded cluster, incremental migration does not support DDL
  4. Incremental migration requires the source database to enable oplog

Migration of Replica Sets

  1. When the source database address is a single address, after the primary-secondary switch of the source database cluster, the task can temporarily run, but it cannot be started after failure/stop and restart.
  2. When the target database address is a single address, after the primary-secondary switch of the target database cluster, the task may run abnormally, and it cannot be started after failure/stop and restart.
  3. When the source/target database is a replica set, it is recommended to fill in both the primary and secondary addresses in the address, such as primary:port,secondary:port. In this way, after the primary-secondary switch of the source/target database, the task will automatically switch to the new primary node to continue running.
  4. When the source/target database is a UMongoDB NVMe type, provide all addresses in the access address.

Migration of Sharded Clusters

  1. When the source database is a sharded cluster, provide the mongos address, all shard addresses, and Config Server node addresses.
  2. When the target is a sharded cluster, fill in the mongos routing address for migration.
  3. Disable the Balancer on the source database before migration.
  4. Clean up orphan documents in the source database to prevent ID conflicts during migration.
  5. When both the source and target databases are sharded clusters, the shard keys in the source database will also be migrated by default.

Notes

  1. MongoOplogTs should be filled with UTC time (8 hours behind CST). For example, if the expected sync point is Beijing time 2021-03-01 20:10:10, 2021-03-01T12:10:10Z should be entered.
  2. UDB MongoDB replica set filling example, fill in all addresses
  1. For cross-version migration, be aware of any features in the source database that may be incompatible with the target database.

MongoDB Form Filling

Explanation for Filling Form when Source is a Replica Set or Single Node

Parameter NameDescription
AddressProvide intranet, extranet, and dedicated line addresses. For intranet addresses, fill in VPC and subnet information. For extranet addresses, both IP and domain name are supported.
For replica sets, fill in all node addresses, such as: 192.168.1.100:27017,192.168.1.120:27017,192.168.1.130:27017
Authorized DBAuthorized database name, UDB MongoDB defaults to admin
CollectionCollection, MongoDB documents group. If not filled, it defaults to migrating all collections in the specified database. To specify a single collection for transmission, fill in the collection name. To specify multiple collections for transmission, input each collection name separated by commas.
Database NameMongoDB database name. To transfer the entire database (excluding system databases), fill in *. To specify a single database for transfer, fill in the database name. To specify multiple databases for transfer, input each database name separated by commas.
UsernameMongoDB connection username
PasswordCorresponding user password for the MongoDB database
MongoOplogTs(Only for incremental tasks) The oplog position where the increment starts, i.e., the incremental sync point, formatted as 1970-01-01T00:00:00Z (UTC time)

Explanation for Filling Form when Source is a Sharded Cluster

Parameter NameDescription
Data Node IP and PortFor sharded cluster source databases, fill in the addresses of all shards. Each shard takes one line, such as: 192.168.1.100:27017,192.168.1.120:27017,192.168.1.130:27017
For multiple shards, fill in line by line. For example, for three shards, fill in three lines:
192.168.1.100:27017,192.168.1.120:27017,192.168.1.130:27017
192.168.1.101:27017,192.168.1.121:27017,192.168.1.131:27017
192.168.1.102:27017,192.168.1.122:27017,192.168.1.132:27017
Routing Node AddressMongos address of the sharded cluster, such as: 192.168.2.126:27017,192.168.2.136:27017
Config Node AddressConfig server address of the sharded cluster, such as: 192.168.1.200:27017,192.168.1.220:27017,192.168.1.230:27017
Authorized DBAuthorized database name, UDB MongoDB defaults to admin
CollectionCollection, MongoDB documents group. If not filled, it defaults to migrating all collections in the specified database. To specify a single collection for transmission, fill in the collection name. To specify multiple collections for transmission, input each collection name separated by commas.
Database NameMongoDB database name. To transfer the entire database (excluding system databases), fill in *. To specify a single database for transfer, fill in the database name. To specify multiple databases for transfer, input each database name separated by commas.
UsernameMongoDB connection username (fill in for the same username and password, fill in separately for each role if different)
PasswordCorresponding user password for the MongoDB database (fill in for the same username and password, fill in separately for each role if different)

Form Filling for Target as Replica Set or Sharded Cluster

Parameter NameDescription
AddressProvide intranet address.
For replica sets, fill in all node addresses, such as: 192.168.1.100:27017,192.168.1.120:27017,192.168.1.130:27017
For sharded clusters, fill in the mongos routing address, such as: 192.168.1.100:27017,192.168.1.120:27017
Authorized DBAuthorized database name, UDB MongoDB defaults to admin
UsernameMongoDB connection username
PasswordCorresponding user password for the MongoDB database