FAQ
Hi,

I want to use the python API to configure a zookeeper node. Below is an
sample from the python api. So...if I add a host e.g. zk.test.com then
zookeeper will be auto configured? Also...for zookeeper..what are the
options?

what are the role types and names. For eg is it ZOOKEEPER,zookeeper,
Zookeeper etc. Is there an example on how to use the python api to install
a master and slave zk node>

def configure_roles_on_host(api, host):
"""
Go through all the roles on this host, and configure them if they
match the role types that we care about.
"""
for role_ref in host.roleRefs:
# Mgmt service/role has no cluster name. Skip over those.
if role_ref.get('clusterName') is None:
continue

# Get the role and inspect the role type
role = api.get_cluster(role_ref['clusterName'])\
.get_service(role_ref['serviceName'])\
.get_role(role_ref['roleName'])
LOG.debug("Evaluating %s (%s)" % (role.name, host.hostname))

config = None
if role.type == 'DATANODE':
config = DATANODE_CONF
elif role.type == 'TASKTRACKER':
config = TASKTRACKER_CONF
elif role.type == 'REGIONSERVER':
config = REGIONSERVER_CONF
else:
continue

# Set the config
LOG.info("Configuring %s (%s)" % (role.name, host.hostname))
role.update_config(config)

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupscm-users @
categorieshadoop
postedFeb 6, '13 at 4:00p
activeFeb 6, '13 at 4:00p
posts1
users1
websitecloudera.com
irc#hadoop

1 user in discussion

David Montgomery: 1 post

People

Translate

site design / logo © 2022 Grokbase