Category Archives: HBase

[HBase] run hbase command by ruby

echo ‘list.each {|t| truncate t}; quit;’ | hbase shell or Drop Table echo ‘list.each {|t| disable t; drop t}; quit;’ | hbase shell Scan Table list.each {|t| print t; scan t, {LIMIT=>1};}

Posted in HBase, Ruby | Leave a comment

[Java, HBase] Hostname is very important!

If the connection is failed, try to check the hdfs uri setting, it might be used hostname.

Posted in HBase, Java | Leave a comment

[HBase] Use SingleColumnFilter in shell.

scan ‘TABLENAME’, {FILTER=>”(SingleColumnValueFilter(‘CF’, ‘CQ’, =, ‘binary:VALUE’, true, true))”} the first true means filterIfColumnMissing the second true means setLatestVersionOnly Ref. Spinning Thoughts: Applying Filters in HBase shell

Posted in HBase | 2 Comments

[Java、HBase] Retrieving timestamp form HBase row

Ref. stackoverflow: retrieving timestamp from hbase row HTableInterface hTableInterface = CONNECTION.getTable(Table.SCHEMA_NAME); Result result = hTableInterface.get(get); Date date = new Date(result.raw()[0].getTimestamp()); System.out.println(“DateTime: ” + sdf.format(date)); we must edit HBaseSettings to set hbaseConf.set(HBASE_ENV_KEY_ZOOKEEPER_QUORUM, “target_zookeeper_address”);

Posted in HBase, Java | Tagged , | Leave a comment

HBase get

get ‘TableName’, ‘RowKey’ get ‘TableName’, ‘RowKey’, ‘cf:qualifier’ get ‘TableName’, ‘RowKey’, {FILTER => “ValueFilter(=, ‘binary:Search Key’)”}

Posted in HBase | Leave a comment

HBase scan

scan ‘TableName’, FILTER => “ValueFilter(=, ‘binary:Search key’)” scan ‘TableName’, {FILTER => “ValueFilter(=, ‘binary:Search key1’) OR ValueFilter(=, ‘binary:Search key2’)”} scan ‘TableName’, {COLUMNS => ‘cf:qualifer’, FILTER => “ValueFilter(>=, ‘binary:Search key1’) AND ValueFilter(<, ‘binary:Search key1~’)”} scan ‘TableName’, FILTER => “ValueFilter(=, ‘binaryprefix:+8869’)” //符合+8869開頭的 scan … Continue reading

Posted in HBase | Leave a comment

[Apache HBase] Install Apache HBase in Ubuntu 14.04

Java 1.7 add-apt-repository ppa:webupd8team/java apt-get update apt-get install oracle-java7-installer apt-get install oracle-java7-set-default Cloudera HBase Ref. installing-apache-hbase-on-ubuntu-for-standalone-mode Note. hbase tar file choose http://archive.apache.org/dist/hbase/hbase-0.98.5/hbase-0.98.5-hadoop1-bin.tar.gz (or http://ftp.mirror.tw/pub/apache/hbase/hbase-0.98.11/hbase-0.98.11-hadoop1-bin.tar.gz )

Posted in HBase, Ubuntu | Leave a comment

[Cloudera HBase] Install Cloudera HBase in Ubuntu 14.04 x64

Install Oracle Sun Java 1.7. Add Repository. sudo add-apt-repository ppa:webupd8team/java Repository update. sudo apt-get update Install Java 1.7. sudo apt-get install oracle-java7-installer Install Java Environment Variable. sudo apt-get install oracle-java7-set-default Cloudera HBase Ref 1. – Installing the Latest CDH 5 … Continue reading

Posted in Cloudera, HBase | Leave a comment