Skip to content

Commit f0d1146

Browse files
authored
Fix HBase init error when Kerberos is enabled (#1294)
fix #1292
1 parent 278f15f commit f0d1146

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
import com.baidu.hugegraph.type.define.Action;
8787
import com.baidu.hugegraph.type.define.HugeKeys;
8888
import com.baidu.hugegraph.type.define.IndexType;
89+
import com.baidu.hugegraph.type.define.SchemaStatus;
8990
import com.baidu.hugegraph.util.CollectionUtil;
9091
import com.baidu.hugegraph.util.E;
9192
import com.baidu.hugegraph.util.InsertionOrderUtil;

hugegraph-dist/src/assembly/static/bin/init-store.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,17 @@ ensure_path_writable $PLUGINS
2222

2323
if [ -n "$JAVA_HOME" ]; then
2424
JAVA="$JAVA_HOME"/bin/java
25+
EXT="$JAVA_HOME/jre/lib/ext:$LIB:$PLUGINS"
2526
else
2627
JAVA=java
28+
EXT="$LIB:$PLUGINS"
2729
fi
2830

2931
cd $TOP
3032

3133
echo "Initializing HugeGraph Store..."
3234

33-
$JAVA -cp $LIB/hugegraph-dist-*.jar -Djava.ext.dirs=$LIB:$PLUGINS \
35+
$JAVA -cp $LIB/hugegraph-dist-*.jar -Djava.ext.dirs=$EXT \
3436
com.baidu.hugegraph.cmd.InitStore \
3537
"$CONF"/gremlin-server.yaml "$CONF"/rest-server.properties
3638

hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseOptions.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ public static synchronized HbaseOptions instance() {
114114
"/etc/krb5.conf"
115115
);
116116

117+
public static final ConfigOption<String> HBASE_HBASE_SITE =
118+
new ConfigOption<>(
119+
"hbase.hbase_site",
120+
"The HBase's configuration file",
121+
null,
122+
"/etc/hbase/conf/hbase-site.xml"
123+
);
124+
117125
public static final ConfigOption<String> HBASE_KERBEROS_PRINCIPAL =
118126
new ConfigOption<>(
119127
"hbase.kerberos_principal",

hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseSessions.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import java.util.concurrent.Future;
3434

3535
import org.apache.hadoop.conf.Configuration;
36+
import org.apache.hadoop.fs.Path;
3637
import org.apache.hadoop.hbase.Cell;
3738
import org.apache.hadoop.hbase.CellScanner;
3839
import org.apache.hadoop.hbase.CellUtil;
@@ -135,6 +136,9 @@ public synchronized void open() throws IOException {
135136
hConfig.setInt("hbase.hconnection.threads.max",
136137
config.get(HbaseOptions.HBASE_THREADS_MAX));
137138

139+
String hbaseSite = config.get(HbaseOptions.HBASE_HBASE_SITE);
140+
hConfig.addResource(new Path(hbaseSite));
141+
138142
if(isEnableKerberos) {
139143
String krb5Conf = config.get(HbaseOptions.HBASE_KRB5_CONF);
140144
System.setProperty("java.security.krb5.conf", krb5Conf);

0 commit comments

Comments
 (0)