def cluster(): ROOT_HOST = "" print "Starting cluster at "+time.strftime("%H:%M:%S", time.gmtime()) for host in getAvailableHosts(): MarkLogicEC2Lib.configureAuthHttpProcess(getInstance(host).public_dns_name) if ROOT_HOST: args = {'server' : ROOT_HOST, 'joiner' : getInstance(host).public_dns_name, 'pass' : MarkLogicEC2Config.ADMIN_PASSWORD } MarkLogicEC2Lib.httpProcess("Joining Cluster","http://" + getInstance(host).public_dns_name + ":8001/join-cluster.xqy", args) else: ROOT_HOST = getInstance(host).public_dns_name ROOT_HOST = "" for host in getAvailableHosts(): if ROOT_HOST: args = {'server' : ROOT_HOST, 'joiner' : getInstance(host).public_dns_name, 'pass' : MarkLogicEC2Config.ADMIN_PASSWORD} MarkLogicEC2Lib.configureAuthHttpProcess(ROOT_HOST) MarkLogicEC2Lib.httpProcess("Joining Cluster II","http://" + ROOT_HOST + ":8001/transfer-cluster-config.xqy",args) MarkLogicEC2Lib.configureAuthHttpProcess(getInstance(host).public_dns_name) MarkLogicEC2Lib.httpProcess("Restarting...","http://" + getInstance(host).public_dns_name + ":8001/restart.xqy") else: ROOT_HOST = getInstance(host).public_dns_name MarkLogicEC2Lib.configureAuthHttpProcess(ROOT_HOST) MarkLogicEC2Lib.httpProcess("Setting cluster name to "+MarkLogicEC2Config.CLUSTER_NAME,"http://" + ROOT_HOST + ":8001/set-cluster-name.xqy",{"CLUSTER-NAME":MarkLogicEC2Config.CLUSTER_NAME}) print "Finishing cluster at "+time.strftime("%H:%M:%S", time.gmtime())
def nameHost(host): dns_name = getInstance(host).public_dns_name HOST_ARGS = { 'HOST-NAME':dns_name } MarkLogicEC2Lib.configureAuthHttpProcess(dns_name) MarkLogicEC2Lib.httpProcess("Setting host name",MarkLogicEC2Lib.adminURL(dns_name) +"set-host-name.xqy", HOST_ARGS)