|
|
admin:database-foreign-replica(
|
|
$foreign-cluster-id as xs:unsignedLong,
|
|
$foreign-database-id as xs:unsignedLong,
|
|
$connect-forests-by-name as xs:boolean,
|
|
$lag-limit as xs:unsignedInt
|
| ) as element(db:foreign-replica) |
|
 |
Summary:
This function returns a replica database configuration. Use the output of this function
in the admin:database-set-foreign-replicas function to place the
replica database configuration into the cluster configuration.
|
Parameters:
$foreign-cluster-id
:
The id of the foreign cluster containing the replica database.
|
$foreign-database-id
:
The id of the replica database.
|
$connect-forests-by-name
:
Boolean that indicates whether to connect to forests by name. If
fn:true, forests will automatically connect to/from foreign
forests of the same name. If false, forests must be individually
configured to replicate to/from foreign forests. Individual forest settings
override the database level setting.
|
$lag-limit
:
This parameter controls how far (in seconds) the replica may fall behind before the
master stops accepting updates.
If contact with the foreign cluster is lost, a warning will be logged and
master forests will permit updates to proceed with no enforcement of the lag limit.
|
|
Example:
xquery version "1.0-ml";
import module namespace admin = "http://marklogic.com/xdmp/admin"
at "/MarkLogic/admin.xqy";
let $fdb := 7746794057802787479
let $cfg := admin:get-configuration()
let $fcl := admin:cluster-get-foreign-cluster-id($cfg, "ClusterA")
return admin:database-foreign-replica($fcl, $fdb, fn:true(), 300)
(: Returns the replica database configuration. Use the
admin:database-set-foreign-replicas function to set
the confirguration. :)
|
|
|
|
admin:forest-add-foreign-replicas(
|
|
$config as element(configuration),
|
|
$forest-id as xs:unsignedLong,
|
|
$foreign-replicas as element(as:foreign-replica)*
|
| ) as element(configuration) |
|
 |
Summary:
This function adds the replica forest that is associated with the specified master
forest to the database replication configuration. This function must be executed
on the master host.
|
Parameters:
$config
:
A configuration specification, typically as returned
from one of the Admin module functions.
|
$forest-id
:
The id of the forest on the master host to be replicated.
|
$foreign-replicas
:
The element returned by the admin:forest-foreign-replica
function that specifies the configuration for the replica forest. More
than one forest replica configuration elements may be specified in a one-to-many
replication scheme.
|
|
Example:
xquery version "1.0-ml";
import module namespace admin = "http://marklogic.com/xdmp/admin"
at "/MarkLogic/admin.xqy";
let $cfg := admin:get-configuration()
let $fcl := admin:cluster-get-foreign-cluster-id($cfg, "ClusterA")
let $fdb := admin:database-foreign-replica-get-database-id(
admin:database-get-foreign-replicas($cfg, xdmp:database("Documents")))
let $mforest := xdmp:forest("Documents2")
let $fforest := admin:forest-foreign-replica($fcl, $fdb , 2863600501631949400)
return admin:forest-add-foreign-replicas($cfg, $mforest, $fforest)
(: Adds the foreign forest, 'Document2', to the forests used by the replica database,
'Documents'. Use admin:save-configuration to save the changes to the configuration
or pass the configuration to other Admin API functions to make other changes. :):)
|
|
|