Reputation: 5880
I think there would be a lot of meta data were written into Zookeeper from Hbase, such as Region split info or Region and RegionServer info ect... But when I tried to get these information I got almost nothing, I tried each subfolder of /Hbase in Zookeeper via command get, but I just get a few lame data as following:
[zk: localhost:2181(CONNECTED) 40] get /hbase/meta-region-server
�regionserver:60020w��#�yPBUF
test008.tv.local�����Ч*
cZxid = 0xe0000018f
ctime = Mon Jan 25 10:39:58 PST 2016
mZxid = 0xe0000018f
mtime = Mon Jan 25 10:39:58 PST 2016
pZxid = 0xe0000018f
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 73
numChildren = 0
Is possible to get the full meta data about HBase in Zoookeeper, although there are binary, Thanks!
Upvotes: 1
Views: 1416
Reputation: 3785
This information is HBase's persistent storage of its current configuration. It is not meant to be accessed directly, but by API. This information is all contained in the ClusterStatus class, which can be obtained from an instance of the Admin interface. Programmatically, you can get this information with the following code.
Imports so it is clear which classes are needed
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.ClusterStatus;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
Example:
public ClusterStatus getClusterStatus(String zkConnectionInfo) throws IOException {
/* this is the minimum configuration info */
configuration = new Configuration();
configuration.set(HConstants.ZOOKEEPER_QUORUM, zkConnectionInfo);
// can be /hbase, /hbase-secure, etc
configuration.set(HConstants.ZOOKEEPER_ZNODE_PARENT, "/hbase");
Connection connection = ConnectionFactory.createConnection(configuration);
Admin admin = connection.getAdmin();
return admin.getClusterStatus();
}
This is intended as an example. It usually best to create the Configuration
object from your site xml files. For instance, this setup would not handle any kind of security configuration necessary for the cluster.
Upvotes: 1