Note |
---|
This feature is still not available in the trunk as of Sept-5-2013.And will be available soonavailable from 1.4.1. |
Code Block |
---|
language | python |
---|
title | 1. get the client object |
---|
firstline | 1 |
---|
linenumbers | true |
---|
|
client = AmbariClient("localhost", 8080, "admin", "admin", version=1)
print client.version
print client.host_url
print"\n"
|
Code Block |
---|
language | python |
---|
title | 2. get the clusterModel object of cluster |
---|
firstline | 1 |
---|
linenumbers | true |
---|
|
mycluster = client.get_cluster('test46')
print mycluster
print mycluster.to_json_dict()
print"\n" |
Code Block |
---|
language | python |
---|
title | 3. create service |
---|
firstline | 1 |
---|
linenumbers | true |
---|
|
s2 = mycluster.create_service(services_name"ZOOKEEPER")
print s2 |
Code Block |
---|
language | python |
---|
title | 4. create a new config |
---|
firstline | 1 |
---|
linenumbers | true |
---|
|
TODO |
...
Code Block |
---|
language | python |
---|
title | 6. add service components |
---|
firstline | 1 |
---|
linenumbers | true |
---|
|
s2 = mycluster.create_service_components("1.3.0", "HDFSZOOKEEPER")
print s2 |
Code Block |
---|
language | python |
---|
title | 7. add host components |
---|
firstline | 1 |
---|
linenumbers | true |
---|
|
host1 = mycluster.get_host('hostname1hostname')
print host1
s4 = host1.assign_role("ZOOKEEPER_SERVER")
print s4
s4 = host1.assign_role("NAMENODE"ZOOKEEPER_SERVER")
print s4
s4 = host1.assign_role("ZOOKEEPER_SERVER")
print s4
s4 = host1.assign_role("ZOOKEEPER_CLIENT")
print s4
|
Code Block |
---|
language | python |
---|
title | 8. Install & Start the service |
---|
firstline | 1 |
---|
linenumbers | true |
---|
|
s2zk = mycluster.get_service("ZOOKEEPER")
print zk
s = zk.stop()
s2print s
s = zk.start()
print s
|
TODO....needs to be updated