Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Note

This feature is available from 1.4.1.

Code Block
languagepython
title1. get the client object
firstline1
linenumberstrue
client = AmbariClient("localhost", 8080, "admin", "admin", version=1)
print client.version
print client.host_url
print"\n"
Code Block
languagepython
title2. get the cluster
firstline1
linenumberstrue
mycluster = client.get_cluster('test46')
print mycluster
print mycluster.to_json_dict()
print"\n"
Code Block
languagepython
title3. create service
firstline1
linenumberstrue
s2 = mycluster.create_service("ZOOKEEPER")
print s2
Code Block
languagepython
title4. create a new config
firstline1
linenumberstrue
TODO
Code Block
languagepython
title5. add the config
firstline1
linenumberstrue
TODO
Code Block
languagepython
title6. add service components
firstline1
linenumberstrue
s2 = mycluster.create_service_components("1.3.0", "ZOOKEEPER")
print s2
Code Block
languagepython
title7. add host components
firstline1
linenumberstrue
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
Code Block
languagepython
title8. Install & Start the service
firstline1
linenumberstrue
zk = mycluster.get_service("ZOOKEEPER")
print zk
    
s = zk.stop()
print s

s = zk.start()
print s

TODO....needs to be updated