Loading TOC...

MarkLogic Server 11.0 Product Documentation
flexrep.configurationTargetSetUrls

flexrep.configurationTargetSetUrls(
   cfg as element(flexrep.configuration),
   target-id as (Number|String),
   urls as String[]
) as element(flexrep.configuration)

Summary

This function sets the URLs for the specified replication target.

Parameters
cfg The replication configuration.
target-id The ID of the replication target.
urls One or more URLs for the Replica App Servers.

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.configurationTargetSetUrls(
         config, 
         targetId, 
         'http://server134:8005/');

  flexrep.configurationInsert(cfg);
 
  // Sets the target URL for the 'Replica' target to 'http://server134:8005/'.
   

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