Skip to content

Commit

Permalink
Add config hbase.zookeeper.znode.parent for hbase backend
Browse files Browse the repository at this point in the history
Implement #107

Change-Id: Ic57fe5aaeedc1af91b05399097a4170a2b159f2e
  • Loading branch information
Linary committed Jan 15, 2019
1 parent e84ce7a commit 744a1b5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions hugegraph-dist/src/assembly/travis/hbase-site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
<name>zookeeper.session.timeout</name>
<value>1200000</value>
</property>
<property>
<name>zookeeper.znode.parent</name>
<value>/hbase</value>
</property>
<property>
<name>hbase.zookeeper.property.tickTime</name>
<value>6000</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ public static synchronized HbaseOptions instance() {
2181
);

public static final ConfigOption<String> HBASE_ZNODE_PARENT =
new ConfigOption<>(
"hbase.znode_parent",
"The znode parent path of HBase zookeeper.",
disallowEmpty(),
"/hbase"
);

public static final ConfigOption<Integer> HBASE_THREADS_MAX =
new ConfigOption<>(
"hbase.threads_max",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.apache.hadoop.hbase.CellScanner;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.NamespaceDescriptor;
import org.apache.hadoop.hbase.RegionMetrics;
import org.apache.hadoop.hbase.ServerName;
Expand Down Expand Up @@ -93,10 +94,12 @@ private Table table(String table) throws IOException {
public synchronized void open(HugeConfig conf) throws IOException {
String hosts = conf.get(HbaseOptions.HBASE_HOSTS);
int port = conf.get(HbaseOptions.HBASE_PORT);
String znodeParent = conf.get(HbaseOptions.HBASE_ZNODE_PARENT);

Configuration config = HBaseConfiguration.create();
config.set("hbase.zookeeper.quorum", hosts);
config.set("hbase.zookeeper.property.clientPort", String.valueOf(port));
config.set(HConstants.ZOOKEEPER_QUORUM, hosts);
config.set(HConstants.ZOOKEEPER_CLIENT_PORT, String.valueOf(port));
config.set(HConstants.ZOOKEEPER_ZNODE_PARENT, znodeParent);
// Set hbase.hconnection.threads.max 64 to avoid OOM(default value: 256)
config.setInt("hbase.hconnection.threads.max",
conf.get(HbaseOptions.HBASE_THREADS_MAX));
Expand Down
1 change: 1 addition & 0 deletions hugegraph-test/src/main/resources/hugegraph.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ cassandra.read_timeout=120
# hbase backend config
hbase.hosts=localhost
hbase.port=2181
hbase.znode_parent=/hbase

# mysql backend config
jdbc.driver=com.mysql.jdbc.Driver
Expand Down

0 comments on commit 744a1b5

Please sign in to comment.