MarkLogic Server 11.0 Product Documentation
flexrep.configurationTargetSetEnabled

flexrep.configurationTargetSetEnabled(
   cfg as element(flexrep.configuration),
   target-id as (Number|String),
   val as Boolean
) as element(flexrep.configuration)

Summary

This function enables or disables the specified replication target.

Parameters
cfg The replication configuration.
target-id The ID of the replication target.
val A value of true enables the replication target and a value of false disables the replication target.

Example

const flexrep = require('/MarkLogic/flexrep');

  declareUpdate();
  // Obtain the domain ID from the database used by the Master to enable CPF.
  const domain = xdmp.eval(
    'const dom = require("/MarkLogic/cpf/domains");' +
      'fn.data(dom.get("Default Master").xpath("//dom:domain-id"));',
       null,
         {
          'database' : xdmp.database('Triggers')
         });

  const config = flexrep.configurationGet(domain, true);
  const targetId = flexrep.configurationTargetGetId(config, 'Replica');

  const cfg = flexrep.configurationTargetSetEnabled(
   config,
     targetId,
       false);

   flexrep.configurationInsert(cfg); 

   // Disables push replication on the Master database.
      
   
Powered by MarkLogic Server | Terms of Use | Privacy Policy