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.

Note: The utilities mongodump and mongorestore might not be appropriate for use with a particular MongoDB server instance. Also, use of these utilities is subject to constraints. These constraints are described in MongoDB database tools documentation.

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.

Refer to the following Bash session:
  1. Stops Link using the Link utility shell script.
    1. cd <Link installation directory>
    2. ./Link stop
  2. 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.
    1. mongodump --db=mdb &>> link_mongodump.log
    2. mongodump --db=rdb_<account ID> &>> link_mongodump.log
  3. Restores the dumped databases into the target MongoDB server instance. Standard output and standard error are appended to file link_mongorestore.log.
    1. mongorestore --host=<MongoDB host> &>> link_mongorestore.log
  4. 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.
  5. Starts Link after updating the MongoDB server configuration. The updated values are read.
    1. ./Link start
  6. After confirming that Link operates with the new MongoDB server instance as expected, the dump directory should be removed:
    1. rm -r dump