Skip to content

Instantly share code, notes, and snippets.

@derms
Created February 26, 2019 22:06
Show Gist options
  • Save derms/823bef4479292cce4d1dd4d1cd9a9196 to your computer and use it in GitHub Desktop.
Save derms/823bef4479292cce4d1dd4d1cd9a9196 to your computer and use it in GitHub Desktop.
MarkLogic Init All Hosts on a Cluster
task initHosts(type: com.marklogic.gradle.task.MarkLogicTask) {
doLast{
def hostManager = new com.marklogic.mgmt.resource.hosts.HostManager(manageClient)
def key = findProperty("mlLicenseKey")
def licensee = findProperty("mlLicensee")
hostManager.hostNames.each{ hostname ->
println "Init ${hostname} with licenseKey=${key} and licensee=${licensee}"
def adminConfig = adminManager.adminConfig
adminConfig.host = hostname
adminManager.adminConfig = adminConfig
adminManager.init(key, licensee)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment