Migrating Forests and Partitions
Forests and partitions can be migrated from one storage device to another. For example, a range partition on an SSD has aged to the point where is it less frequently queried and can be moved to a slower, less expensive, storage device to make room for a more frequently queried range partition.
For example, the 2011
range partition on the Documents
database is mounted on a local disk on the host, MyHost
. To migrate the 2011
range partition to the /warm-storage
data directory mounted on a shared disk on the host, OurHost
, use these scripts:
$ cat migrate-partition.xml <migrate xmlns="http://marklogic.com/manage"> <hosts> <host>OurHost</host> </hosts> <data-directory>/warm-storage</data-directory> <options> <option>failover=none</option> <option>local-to-shared</option> </options> </migrate>
$ curl --anyauth --user user:password -X PUT \ -d @migrate-partition.xml -H 'Content-type: application/xml' \ http://MyHost:8002/manage/v2/databases/Documents/partitions/2011
Note
If you do not specify a data-directory
, the default data directory is used.
The tiered storage migration operations allow you to migrate a forest or partition between different types of storage. The following table lists the four migration options. The migration option you select determines the sequence of steps taken by tiered storage during the migration operation.
Migration Option |
Description |
---|---|
(default) |
Indicates that the migration is to move data from local storage to local storage. This is the default if no migration option is specified and the type of storage cannot be derived from the data directory path. |
|
Indicates that the migration is to move data from local storage to shared storage. This type of migration supports changing hosts. |
|
Indicates that the migration is to move data from shared storage to local storage. This type of migration supports changing hosts. |
|
Indicates that the migration is to move data from shared storage to shared storage. This type of migration supports changing hosts. |
You can use the PUT:/manage/v2/forests
resource address to migrate individual forests. For example, the forests 2011-0001
and 2011-0002
, are mounted on a local disk on the host, MyHost
. To migrate these forests to the /warm-storage
data directory mounted on a shared disk on the host, OurHost
, use these scripts:
$ cat migrate-forests.xml <forest-migrate xmlns="http://marklogic.com/manage"> <forests> <forest>2011-0001</forest> <forest>2011-0002</forest> </forests> <host>MyHost</host> <data-directory>/warm-storage</data-directory> <options> <option>local-to-shared</option> </options> </forest-migrate>
$ curl --anyauth --user user:password -X PUT \ -d @migrate-forests.xml -H 'Content-type: application/xml' \ http://MyHost:8002/manage/v2/forests
Note
If failover is configured on your forests, do a full backup of database after a forest or partition migrate operation to ensure that you can recover your data should something go wrong. You may also need to increase the timeout setting on the migrate operation, as it will take longer when failover is configured.