ml-gradle icon indicating copy to clipboard operation
ml-gradle copied to clipboard

Initialize all hosts in a cluster

Open rjrudin opened this issue 5 years ago • 0 comments

Sample code courtesy of @derms

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)
        }
    }
}

rjrudin avatar Feb 27 '19 03:02 rjrudin