MongoDB migration example
This documentation describes example commands for MongoDB server instance migration with a native Linux Link installation.
This example shows commands which could be executed to migrate from a local MongoDB server instance to a remote MongoDB server instance. This example assumes that default configuration properties were used when Link was installed natively on the Linux host.
This example assumes that the target MongoDB server instance has been configured and is accessible using the standard MongoDB port from host <MongoDB host>. It is also assumed that the MongoDB database tools have been installed, so that mongodump and mongorestore are available.
- Stops Link using the Link utility shell script.
- cd <Link installation directory>
- ./Link stop
- Creates a backup of the master database and the resource database. A directory
named dump is created in the Link installation directory by
mongodump. This directory holds the backups. Standard
output and standard errors are appended to file
link_mongodump.log.
- mongodump --db=mdb &>> link_mongodump.log
- mongodump --db=rdb_<account ID> &>> link_mongodump.log
- Restores the dumped databases into the target MongoDB server instance. Standard
output and standard error are appended to file
link_mongorestore.log.
- mongorestore --host=<MongoDB host> &>> link_mongorestore.log
- The configuration file config.yaml in <Link installation directory> must be edited to reflect the change in the location of the MongoDB server. Assuming that the default MongoDB port and a remote host are used, the value of the "host" key of the object value of the top-level "mongo" key (mongo.host) must be set to the remote host.
- Starts Link after updating the
MongoDB server configuration. The updated values are read.
- ./Link start
- After confirming that Link operates
with the new MongoDB server instance as expected, the dump directory should be
removed:
- rm -r dump