Skip to content

Commit

Permalink
flink-connector-hbase 添加配置项hbase.conf.dir
Browse files Browse the repository at this point in the history
  • Loading branch information
dongkelun committed Jul 13, 2023
1 parent fc679b6 commit c41cfed
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.HBASE_CONF_DIR;
import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.LOOKUP_ASYNC;
import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.LOOKUP_CACHE_MAX_ROWS;
import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.LOOKUP_CACHE_TTL;
Expand Down Expand Up @@ -131,6 +132,7 @@ public Set<ConfigOption<?>> optionalOptions() {
set.add(LOOKUP_CACHE_MAX_ROWS);
set.add(LOOKUP_CACHE_TTL);
set.add(LOOKUP_MAX_RETRIES);
set.add(HBASE_CONF_DIR);
return set;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ public class HBaseConnectorOptions {
.defaultValue("/hbase")
.withDescription("The root dir in Zookeeper for HBase cluster.");

public static final ConfigOption<String> HBASE_CONF_DIR =
ConfigOptions.key("hbase.conf.dir")
.stringType()
.defaultValue("/etc/hbase/conf")
.withDescription("Configuration folder path for hbase.");

public static final ConfigOption<String> NULL_STRING_LITERAL =
ConfigOptions.key("null-string-literal")
.stringType()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.Map;
import java.util.Properties;

import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.HBASE_CONF_DIR;
import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.LOOKUP_CACHE_MAX_ROWS;
import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.SINK_BUFFER_FLUSH_INTERVAL;
import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.SINK_BUFFER_FLUSH_MAX_ROWS;
Expand Down Expand Up @@ -118,6 +119,9 @@ public static Configuration getHBaseConfiguration(ReadableConfig tableOptions) {
getHBaseClientProperties(
((org.apache.flink.configuration.Configuration) tableOptions).toMap());
properties.forEach((k, v) -> hbaseClientConf.set(k.toString(), v.toString()));
hbaseClientConf.addResource(
new org.apache.hadoop.fs.Path(
tableOptions.get(HBASE_CONF_DIR) + "/hbase-site.xml"));
return hbaseClientConf;
}

Expand Down

0 comments on commit c41cfed

Please sign in to comment.