MarkLogic 9 Product Documentation
flexrep:pull-create

flexrep:pull-create(
   $name as xs:string,
   $domain-id as xs:unsignedLong,
   $target-id as xs:unsignedLong,
   $urls as xs:string+,
   $http-options as element(flexrep:http-options)?
) as element(flexrep:pull)

Summary

This function creates a configuration on a Replica database to pull updates from the Master database. If a configuration already exists for the given target and domain IDs, then the configuration is overwritten.

Parameters
name The name of the pull configuration.
domain-id The ID of the domain containing the replicated content. This value is obtained from the Trigger database used by the Master database.
target-id The ID of the replication target. This value is obtained from the Master database.
urls The URL of the Master App Server.
http-options The HTTP options in XML format.

Example

  (: This query must be executed on a Replica database. :)
  xquery version "1.0-ml"; 

  import module namespace flexrep = "http://marklogic.com/xdmp/flexible-replication" 
      at "/MarkLogic/flexrep.xqy";

  (: Specify the ID of the replicated CPF domain obtained from the Master's 
     Triggers database. :)
  let $domain:= 9535475951259984368

  (: Specify the ID of the replication target obtained from the Master database. :)
  let $target-id := 18130470845627037840

  (: Specify the HTTP options for the replication target. :)
  let $http-options := 
    <flexrep:http-options
     xmlns:flexrep="http://marklogic.com/xdmp/flexible-replication">
      <http:authentication xmlns:http="xdmp:http">
        <http:username>admin</http:username>
        <http:password>admin</http:password>
      </http:authentication>
      <http:client-cert xmlns:http="xdmp:http"/>
      <http:client-key xmlns:http="xdmp:http"/>
      <http:pass-phrase xmlns:http="xdmp:http"/>
    </flexrep:http-options>

  let $pullconfig := flexrep:pull-create(
    "Master",
    $domain,
    $target-id,
    "http://localhost:8010/",
    $http-options)

  (: Insert the pull configuration into the Replica database. :)
  return flexrep:pull-insert($pullconfig) 

  (: Creates a pull replication configuration element for the specified domain. :)
     
Powered by MarkLogic Server | Terms of Use | Privacy Policy