Loading TOC...

MarkLogic 12 EA 2 Product Documentation
admin:forest-add-replica

admin:forest-add-replica(
   $config as element(configuration),
   $master-id as xs:unsignedLong,
   $replica-id as xs:unsignedLong
) as element(configuration)

Summary

This function adds a forest replica to a master forest. Note that adding a replica forest will take the master forest offline for a period ranging between a few seconds to a few minutes.

Parameters
config A configuration specification, typically as returned from one of the Admin module functions.
master-id The ID of the master forest to which to add the replica forest (for example, xdmp:forest("MasterForest") ).
replica-id The ID of the replica forest to add to the master forest (for example, xdmp:forest("ReplicaForest") ).

Required Privileges

This operation requires at least one of the following privileges:

http://marklogic.com/xdmp/privileges/admin/database

http://marklogic.com/xdmp/privileges/admin/database/{id}

http://marklogic.com/xdmp/privileges/admin/forest

http://marklogic.com/xdmp/privileges/admin/forest/{id}

Example


  xquery version "1.0-ml";

  import module namespace admin = "http://marklogic.com/xdmp/admin"
      at "/MarkLogic/admin.xqy";

  let $config := admin:get-configuration()
  let $forest := xdmp:forest("Documents")
  let $replica-forest := xdmp:forest("my-replica")

  return admin:forest-add-replica($config, $forest, $replica-forest)

  (: returns the new configuration element --
     use admin:save-configuration to save the changes to the
     configuration or pass the configuration to other
     Admin API functions to make other changes.  :)


    

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.