Printing all property values in an HBase configuration

I’m sure there is an easier (perhaps built-in) way to do this, but for now, I wanted to document how you can print all properties for a given configuration that you load into a JVM.

import java.util.*;
import org.apache.hadoop.hbase.*;
import org.apache.hadoop.conf.*;

class printHbase {

  public static void main(String args[]) {
    try {
      Configuration conf = HBaseConfiguration.create();
      conf.addResource("oradev.xml");
      Iterator it = conf.iterator();
      while (it.hasNext()) {
        System.out.println(it.next());
      }
    }
    catch (Exception e) {
      e.printStackTrace();
    }
  }
}

You can just run the class directly. Below I print the first and last ten properties printed…

emgrid01:oracle:emprod1:/home/oracle>java printHbase | awk '{l[NR]=$0} END {while (i < length(l)) {if (i <= 10) {print l[i]} else if (i >= length(l) - 10) {print l[i]};i++}}'

io.map.index.skip=0
io.seqfile.compress.blocksize=1000000
hbase.hstore.compactionThreshold=3
s3.replication=3
hbase.master.port=9000
webinterface.private.actions=false
ftp.blocksize=67108864
fs.s3.impl=org.apache.hadoop.fs.s3.S3FileSystem
hbase.zookeeper.leaderport=3888
fs.checkpoint.edits.dir=${fs.checkpoint.dir}
hbase.master.logcleaner.plugins=org.apache.hadoop.hbase.master.TimeToLiveLogCleaner
kfs.replication=3
hadoop.common.configuration.version=0.21.0
hbase.master.logcleaner.ttl=600000
io.seqfile.local.dir=${hadoop.tmp.dir}/io/local
file.bytes-per-checksum=512
hbase.regionserver.regionSplitLimit=2147483647
fs.s3.sleepTimeSeconds=10
hbase.client.write.buffer=2097152
hbase.regionserver.info.port.auto=false
emgrid01:oracle:emprod1:/home/oracle>

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.