FAQ
Hey David -

The ApiRole <http://cloudera.github.io/cm_api/epydoc/5.0.0/index.html>class
has a *hostRef* attribute which has a hostID that you can then use to
obtain the host object, which has the IP address associated to that role.
An example below...

# Get HBase service
hbase = cdh4.get_service("hbase1")

# Get list of roles in HBase service
roles = hbase.get_all_roles()

# Combine both the role and host object together
hosts_and_roles = [{"role": role, "host":
api.get_host(role.hostRef.hostId)} for role in roles]

# Host objects have the IP address
print(host_and_roles[0]['host'].ipAddress)
u'10.20.53.15'
On Sat, May 10, 2014 at 12:47 AM, David Montgomery wrote:

Hi,

I am using the python api. I want to get the ip address for all hbase
roles by master, region server. How?

Thanks


for s in cdh4.get_all_services():
if s.type == "HBASE":
hbase = s

for r in hbase.get_all_roles():
PRINT IP ADDRESS


To unsubscribe from this group and stop receiving emails from it, send an
email to scm-users+unsubscribe@cloudera.org.


--
Ricky Saltzer
http://www.cloudera.com

To unsubscribe from this group and stop receiving emails from it, send an email to scm-users+unsubscribe@cloudera.org.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
groupscm-users @
categorieshadoop
postedMay 10, '14 at 4:47a
activeMay 10, '14 at 6:11a
posts2
users2
websitecloudera.com
irc#hadoop

2 users in discussion

Ricky Saltzer: 1 post David Montgomery: 1 post

People

Translate

site design / logo © 2022 Grokbase