cma:apply-config( $config as (binary()|node())*, [$config-options as map:map?], [$params as map:map?], [$format as xs:string?] ) as (empty-seq|node())
Apply a named configuration, overriding parameters and setting options.
This function applies a named configuration, overriding parameters and setting options.
The default namespace for configuration packages is
http://marklogic.com/manage/config
.
<configuration xmlns="http://marklogic.com/manage/config">
The available core scenarios are summarized below. The details on each scenario follow.
Local disk failover provides High Availability (HA) by replicating forest data to other hosts. When any particular host goes down, forests' replicas will mount on the other hosts.
The parameters for HA Local Failover scenario are:
replica-same-zone-as-master
true
or
false
. The default value is true
.master-database
"myHADatabase"
.triggers-database
"myHATriggers"
.schemas-database
"myHASchemas"
.security-database
"Security"
.add-replica-to-existing-forests
false
- no attempt is made to add replicas; when set to
true
- replicas will be added to the forest, with total summing up to
number-of-replicas-per-forest
. The allowed values are true
or false
. The default value is false
.number-of-master-forests
number-of-replicas-per-forest
number-of-forests-per-host
master-data-directory
"/tmp"
(e.g. returned by xdmp:data-directory())
function
call).master-fast-data-directory
"/tmp"
.master-large-data-directory
"/tmp"
.master-replica-data-directory
"/tmp"
.master-replica-fast-data-directory
"/tmp"
.master-replica-large-data-directory
"/tmp"
.
(: Apply configuration to create three forests. :) xquery version "1.0-ml"; import module namespace cma="http://marklogic.com/manage/config" at "/MarkLogic/cma.xqy"; cma:apply-config( <configuration xmlns="http://marklogic.com/manage/config"> <configs> <config> <forests> <forest> <forest-name>f11</forest-name> </forest> <forest> <forest-name>f21</forest-name> </forest> <forest> <forest-name>f31</forest-name> </forest> </forests> </config> </configs> </configuration>)
(: Apply configuration ZIP. :) xquery version "1.0-ml"; import module namespace cma="http://marklogic.com/manage/config" at "/MarkLogic/cma.xqy"; cma:apply-config($zip)
(: Create server embedding tokens for replacement by parameters. :) xquery version "1.0-ml"; import module namespace cma="http://marklogic.com/manage/config" at "/MarkLogic/cma.xqy"; let $config := <configuration xmlns="http://marklogic.com/manage/config"> <configs> <config> <servers> <server> <server-name>test1</server-name> <server-type>http</server-type> <group-name>Default</group-name> <root>/</root> <port>%%mlFinalPort%%</port> <modules-database>Modules</modules-database> <content-database>Documents</content-database> <authentication>basic</authentication> </server> </servers> </config> </configs> </configuration> let $params := map:new() =>map:with("mlFinalPort", 8011) return cma:apply-config($config,(),$params)
(: Create protected-paths and query-rolesets. :) xquery version "1.0-ml"; import module namespace cma="http://marklogic.com/manage/config" at "/MarkLogic/cma.xqy"; let $config := <configuration xmlns="http://marklogic.com/manage/config"> <configs> <config> <protected-paths> <protected-path> <path-expression>//h</path-expression> <path-namespaces/> <permissions> <permission> <role-name>manage-user</role-name> <capability>read</capability> </permission> </permissions> </protected-path> </protected-paths> <query-rolesets> <query-roleset> <role-name>manage-admin</role-name> </query-roleset> </query-rolesets> </config> </configs> </configuration> return cma:apply-config($config)