Saturday, September 06, 2014

Clojure and HBase

(println (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))) ;; get class path in REPL
# in REPL
(require '[clojure-hbase.core :as hbase])
(import [org.apache.hadoop.hbase HBaseConfiguration HConstants KeyValue])
(import [org.apache.hadoop.hbase.client HTablePool Get Put Delete Scan Result RowLock HTableInterface])

(hbase/set-config (hbase/make-config {
     :zookeeper.znode.parent "/hbase-unsecure" 
     :hbase.zookeeper.property.clientPort "2181"
     :hbase.cluster.distributed "true"
     :hbase.zookeeper.quorum "hdp005-3,hdp005-21,hdp005-23"
}
))
(hbase/table "tweets-test")

---
create 'tweets_test', 'cf'
put "tweets_test", "newkey1", 'cf', 'somevalue'
hbase(main):007:0> scan "tweets_test"
ROW                             COLUMN+CELL
newkey1                        column=cf:, timestamp=1405693122884, value=somevalue

No comments: