This feature is available from 1.4.1.

1. get the client object
client = AmbariClient("localhost", 8080, "admin", "admin", version=1)
print client.version
print client.host_url
print"\n"
2. get the cluster
mycluster = client.get_cluster('test46')
print mycluster
print mycluster.to_json_dict()
print"\n"
3. create service
s2 = mycluster.create_service("ZOOKEEPER")
print s2
4. create a new config
TODO
5. add the config
TODO
6. add service components
s2 = mycluster.create_service_components("1.3.0", "ZOOKEEPER")
print s2
7. add host components
host1 = mycluster.get_host('hostname')
print host1
s4 = host1.assign_role("ZOOKEEPER_SERVER")
print s4
s4 = host1.assign_role("ZOOKEEPER_SERVER")
print s4
s4 = host1.assign_role("ZOOKEEPER_SERVER")
print s4
s4 = host1.assign_role("ZOOKEEPER_CLIENT")
print s4
8. Install & Start the service
zk = mycluster.get_service("ZOOKEEPER")
print zk
    
s = zk.stop()
print s

s = zk.start()
print s

TODO....needs to be updated

  • No labels