Knowledgebase:
Changing forest state to "Flash Backup" your forests
05 March 2021 01:49 PM

Introduction: When you may need to change the state of forests

In most cases, all forests in your MarkLogic cluster will be configured to allow all (any) updates to be made.

If we consider running the following example in Query Console:

In the majority of cases, calling the above function should return "all", indicating that the forest is in a state to allow incoming queries to read data from the forest and to allow queries to update content (and to add new content) into that forest.

At any given time, a forest can be configured to be in one of four different states:

  • all
  • read-only
  • delete-only
  • flash-backup

You may want to change the state of the forests in a given database for several reasons

read-only
To run your application in maintenance mode where data can be read but no data on-disk can be changed
delete-only
In a situation where you are migrating data from a legacy database or removing data from a given forest
flash-backup
In a situation where you need to quiesce all forests in a given database for long enough to allow you to make a file level backupĀ of the forest data.

Forest states explained

Sample state management module

Below is an example template for modifying the state of all forests in a given database:

Further reading

Forest States
http://docs.marklogic.com/guide/admin/forests#id_43487
Setting Forests to "read only"
http://docs.marklogic.com/guide/admin/forests#id_72520
Setting Forests to "delete only"
http://docs.marklogic.com/guide/admin/forests#id_20932

Link to Example Code

flash-backup.xqy

(4 vote(s))
Helpful
Not helpful

Comments (0)