Loading TOC...


   $foreign-cluster-id as xs:unsignedLong,
   $foreign-database-id as xs:unsignedLong,
   $connect-forests-by-name as xs:boolean,
   $lag-limit as xs:unsignedInt,
   [$replication-enabled as xs:boolean],
   [$queue-size as xs:unsignedInt]
) as element(db:foreign-replica)


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.

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.


  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 configuration. :)

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