Loading TOC...

MarkLogic 12 EA 1 Product Documentation
admin.databaseForeignReplica

admin.databaseForeignReplica(
   foreign-cluster-id as (Number|String),
   foreign-database-id as (Number|String),
   connect-forests-by-name as Boolean,
   lag-limit as Number,
   [replication-enabled as Boolean],
   [queue-size as Number]
) as element(db.foreignReplica)

Summary

This function returns a replica database configuration. Use the output of this function in the admin.databaseSetForeignReplicas 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.
replication-enabled This parameter controls if replication is enabled. Set to true to enable, false to disable.
queue-size This parameter specifies the number of frames in the queue for foreign replication, or the number of fragments if you are doing bulk replication. The default is 10.

Example

  
  const admin = require('/MarkLogic/admin.xqy');
  const fdb = 7746794057802787479
  const cfg = admin.getConfiguration()
  const fcl = admin.clusterGetForeignClusterId(cfg, "ClusterA")
  admin.databaseForeignReplica(fcl, fdb, fn.true(), 300)

   //Returns the replica database configuration. Use the
//admin.databaseSetForeignReplicas function to set the confirguration. 
    

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