You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by pt...@apache.org on 2014/10/02 01:07:25 UTC
[05/26] git commit: allow override of hbase.rootdir
allow override of hbase.rootdir
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/a2d48e1a
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/a2d48e1a
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/a2d48e1a
Branch: refs/heads/master
Commit: a2d48e1a62c6249c8737fc80ff70587f79e191ef
Parents: c86ef53
Author: P. Taylor Goetz <pt...@gmail.com>
Authored: Tue Mar 11 10:30:52 2014 -0400
Committer: P. Taylor Goetz <pt...@gmail.com>
Committed: Tue Mar 11 10:30:52 2014 -0400
----------------------------------------------------------------------
.../org/apache/storm/hbase/bolt/HBaseBolt.java | 6 ++++++
.../hbase/topology/PersistentWordCount.java | 20 +++++++++-----------
.../storm/hbase/topology/WordCountClient.java | 4 ++++
3 files changed, 19 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/a2d48e1a/src/main/java/org/apache/storm/hbase/bolt/HBaseBolt.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/storm/hbase/bolt/HBaseBolt.java b/src/main/java/org/apache/storm/hbase/bolt/HBaseBolt.java
index 21f6b95..cff88ea 100644
--- a/src/main/java/org/apache/storm/hbase/bolt/HBaseBolt.java
+++ b/src/main/java/org/apache/storm/hbase/bolt/HBaseBolt.java
@@ -68,6 +68,12 @@ public class HBaseBolt extends BaseRichBolt {
public void prepare(Map map, TopologyContext topologyContext, OutputCollector collector) {
this.collector = collector;
Configuration hbConfig = HBaseConfiguration.create();
+ String hbRoot = (String)map.get("hbase.rootdir");
+ if(hbRoot != null){
+ LOG.info("Using hbase.rootdir={}", hbRoot);
+ hbConfig.set("hbase.rootdir", hbRoot);
+ }
+
try{
this.table = new HTable(hbConfig, this.tableName);
} catch(IOException e){
http://git-wip-us.apache.org/repos/asf/storm/blob/a2d48e1a/src/test/java/org/apache/storm/hbase/topology/PersistentWordCount.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/storm/hbase/topology/PersistentWordCount.java b/src/test/java/org/apache/storm/hbase/topology/PersistentWordCount.java
index 3feee15..8987736 100644
--- a/src/test/java/org/apache/storm/hbase/topology/PersistentWordCount.java
+++ b/src/test/java/org/apache/storm/hbase/topology/PersistentWordCount.java
@@ -34,6 +34,9 @@ public class PersistentWordCount {
public static void main(String[] args) throws Exception {
Config config = new Config();
+ if(args.length > 0){
+ config.put("hbase.rootdir", args[0]);
+ }
WordSpout spout = new WordSpout();
WordCounter bolt = new WordCounter();
@@ -55,16 +58,11 @@ public class PersistentWordCount {
builder.setBolt(HBASE_BOLT, hbase, 1).fieldsGrouping(COUNT_BOLT, new Fields("word"));
- if (args.length == 0) {
- LocalCluster cluster = new LocalCluster();
- cluster.submitTopology("test", config, builder.createTopology());
- Thread.sleep(10000);
- cluster.killTopology("test");
- cluster.shutdown();
- System.exit(0);
- } else {
- config.setNumWorkers(3);
- StormSubmitter.submitTopology(args[0], config, builder.createTopology());
- }
+ LocalCluster cluster = new LocalCluster();
+ cluster.submitTopology("test", config, builder.createTopology());
+ Thread.sleep(10000);
+ cluster.killTopology("test");
+ cluster.shutdown();
+ System.exit(0);
}
}
http://git-wip-us.apache.org/repos/asf/storm/blob/a2d48e1a/src/test/java/org/apache/storm/hbase/topology/WordCountClient.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/storm/hbase/topology/WordCountClient.java b/src/test/java/org/apache/storm/hbase/topology/WordCountClient.java
index ca836a3..27b625a 100644
--- a/src/test/java/org/apache/storm/hbase/topology/WordCountClient.java
+++ b/src/test/java/org/apache/storm/hbase/topology/WordCountClient.java
@@ -33,9 +33,13 @@ public class WordCountClient {
public static void main(String[] args) throws Exception {
Configuration config = HBaseConfiguration.create();
+ if(args.length > 0){
+ config.set("hbase.rootdir", args[0]);
+ }
HTable table = new HTable(config, "WordCount");
+
for (String word : WordSpout.words) {
Get get = new Get(Bytes.toBytes(word));
Result result = table.get(get);