MarkLogic 9 Product Documentation
cma:generate-configcma:generate-config(
[$config as (binary()|node())?],
[$config-options as map:map?],
[$default-params as map:map?],
[$format as xs:string?],
[$scenario as xs:string?]
) as (binary()|node())
Summary
Retrieve an individual resource, set of resources, or full cluster
configuration; generate a configuration from scenarios.
Parameters |
config |
A zip file or xml|json
configuration which filters resource configurations returned by the function. |
config-options |
Configuration options
control how the configuration is created. This function supports the following configuration
options:
- name
- The configuration profile name, for example
"myClusterTestConfig" .
- desc
- The configuration description, for example
"Test configuration for my
cluster" .
- embed-tokens
- Embed replacement tokens (ex. %%sometoken%%) in configuration. The allowed values
are
true or false . The default value is false
for xml|json format and true for zip format.
- include-properties
- Include resource properties in the configuration. By default, all resource
properties are provided. If set
false - only resource name and identifier
are provided. The allowed values are true or false . The
default value is true .
- format
- The response format; the value supplied in the
$format parameter of the
function overrides this value. The allowed values are xml | json | zip .
The default value is xml .
- scenario
- The scenario to generate configuration from; the value supplied in the
$scenario parameter of the function overrides this value. The allowed
values are: "ha-local", "ha-shared" .
- installer
- The type of the installer script to include (with a configuration in
zip format). Currently the only supported value is
"ml-gradle" .
- resource-type
- The resource type - for selecting/filtering resources by type. The allowed values
are:
"forest", "database", "server", "group", "user", "role" .
- resource-id
- The list of resources' identifiers to select specific resources. The value is string
array, for example:
["resource-id1", "resource-id2", ...] .
- resource-name
- The regular expression to select specific resources by their names, for example
"ha-*" .
|
default-params |
Scenario-specific default
values for parameters to be embedded into the configuration. See Usage Notes for details. |
format |
The response format. The
allowed values are xml | json | zip . The default value is xml . |
scenario |
The scenario to generate the
configuration from. The allowed values are: "ha-local", "ha-shared" .
|
Usage Notes
This function retrieves selected resource(s) configuration or generates a configuration
from scenarios. Configuration options define how the configuration is generated.
The default namespace for configuration packages is
http://marklogic.com/manage/config
.
XML root element:
<configuration xmlns="http://marklogic.com/manage/config">
The available core scenarios are summarized below. The details on each scenario follow.
HA Local Failover
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
- Create forests on hosts in the same zone. The allowed values are
true
or
false
. The default value is true
.
master-database
- Create if does not exist, add replicas (if none exist). The value is string, for
example
"myHADatabase"
.
triggers-database
- Create if does not exist, add replicas (if none exist). The value is string, for
example
"myHATriggers"
.
schemas-database
- Create if does not exist, add replicas (if none exist). The value is string, for
example
"myHASchemas"
.
security-database
- When defined, will attempt to add replicas to xdmp:security-database() (if none
exist) if create-security-database-replicas is set to
true
.
add-replica-to-existing-forests
- When set to
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
. create-security-database-replicas
- When set to
true
, will create replicas for security database. Note that
this is particularly dangerous when uninstalling a package. The default value is
false
. number-of-master-forests
- Calculated number of master forests. The value is positive integer.
number-of-ancillary-forests
- Number of master forests for ancillary databases (e.g. triggers and schemas
databases). The value is positive integer.
number-of-replicas-per-master-forest
- Calculated number of replicas per master forest. The value is positive integer.
number-of-replicas-per-ancillary-forest
- Calculated number of replicas per ancillary forest. The value is positive
integer.
number-of-master-forests-per-host
- When set overrides
number-of-forests-per-host
, arbitrarily setting
absolute number of master forests per host. The value is positive integer. number-of-forests-per-host
- Calculated based on number of available hosts, equally balance forests across hosts.
The value is positive integer.
master-data-directory
- Data directory used by master forests. The value is string, for example
"/tmp"
(e.g. returned by xdmp:data-directory())
function
call).
master-fast-data-directory
- Fast directory used by master forests. The value is string, for example
"/tmp"
.
master-large-data-directory
- Large directory used by master forests. The value is string, for example
"/tmp"
.
master-replica-data-directory
- Data directory used by master forest replicas. The value is string, for example
"/tmp"
.
master-replica-fast-data-directory
- Fast directory used by master forest replicas. The value is string, for example
"/tmp"
.
master-replica-large-data-directory
- Large directory used by master forest replicas. The value is string, for example
"/tmp"
.
Example
(: Generate configuration of the entire cluster. :)
xquery version "1.0-ml";
import module namespace cma="http://marklogic.com/manage/config"
at "/MarkLogic/cma.xqy";
cma:generate-config()
Example
(: Generate configuration of the entire cluster without properties - just resource names and identifiers. :)
xquery version "1.0-ml";
import module namespace cma="http://marklogic.com/manage/config"
at "/MarkLogic/cma.xqy";
cma:generate-config((),map:new()=>map:with("include-properties",false()),(),"xml",())
Example
(: Generate forests configuration. :)
xquery version "1.0-ml";
import module namespace cma="http://marklogic.com/manage/config"
at "/MarkLogic/cma.xqy";
cma:generate-config((),map:new()=>map:with("resource-type","forest"),(),"xml",())
Example
(: Generate configuration XML of ha-local scenario. :)
xquery version "1.0-ml";
import module namespace cma="http://marklogic.com/manage/config"
at "/MarkLogic/cma.xqy";
cma:generate-config((),(),(),"xml","ha-local")
Example
(: Generate configuration ZIP of ha-local scenario. :)
xquery version "1.0-ml";
import module namespace cma="http://marklogic.com/manage/config"
at "/MarkLogic/cma.xqy";
cma:generate-config((),(),(),"zip","ha-local")
Copyright © 2024 MarkLogic Corporation. MARKLOGIC is a
registered trademark of MarkLogic Corporation.