admin.forestSetForeignReplicas( config as element(configuration), forest-id as (Number|String), foreign-replicas as element(as.foreignReplica)[] ) as element(configuration)
This function writes the specified replica forest configuration into the database replication configuration. Any forest-level configuration will override the database level-configuration. This function must be executed on the master cluster.
http://marklogic.com/xdmp/privileges/admin/database
http://marklogic.com/xdmp/privileges/admin/database/{id}
http://marklogic.com/xdmp/privileges/admin/database/replication
http://marklogic.com/xdmp/privileges/admin/database/replication/{id}
const admin = require('/MarkLogic/admin.xqy'); const cfg = admin.getConfiguration() const fcl = admin.clusterGetForeignClusterId(cfg, "ClusterA") const fdb = admin.databaseForeignReplicaGetDatabaseId( admin.databaseGetForeignReplicas(cfg, xdmp.database("Documents"))) const fforest = admin.forestForeignReplica(fcl, fdb , 2331251018938912591) admin.forestSetForeignReplicas(cfg, xdmp.forest("Documents2"), fforest) //Returns a configuration element that includes the specified foreign replica //forests.//Use admin.saveConfiguration to save the changes to the configuration //or pass the configuration to other Admin API functions to make other changes.
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.