Skip to content

Commit

Permalink
Fix bug: hbase init error when kerberos is enabled
Browse files Browse the repository at this point in the history
fix #1292
  • Loading branch information
tmljob committed Dec 10, 2020
1 parent 6eb4ef7 commit 90092b8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hugegraph-dist/src/assembly/static/bin/init-store.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@ ensure_path_writable $PLUGINS

if [ -n "$JAVA_HOME" ]; then
JAVA="$JAVA_HOME"/bin/java
EXT="$JAVA_HOME/jre/lib/ext:$LIB:$PLUGINS"
else
JAVA=java
EXT="$LIB:$PLUGINS"
fi

cd $TOP

echo "Initializing HugeGraph Store..."

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ public static synchronized HbaseOptions instance() {
"/etc/krb5.conf"
);

public static final ConfigOption<String> HBASE_HBASE_SITE =
new ConfigOption<>(
"hbase.hbase_site",
"The HBase's configuration file",
null,
"/etc/hbase/conf/hbase-site.xml"
);

public static final ConfigOption<String> HBASE_KERBEROS_PRINCIPAL =
new ConfigOption<>(
"hbase.kerberos_principal",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.concurrent.Future;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellScanner;
import org.apache.hadoop.hbase.CellUtil;
Expand Down Expand Up @@ -135,6 +136,9 @@ public synchronized void open() throws IOException {
hConfig.setInt("hbase.hconnection.threads.max",
config.get(HbaseOptions.HBASE_THREADS_MAX));

String hbaseSite = config.get(HbaseOptions.HBASE_HBASE_SITE);
hConfig.addResource(new Path(hbaseSite));

if(isEnableKerberos) {
String krb5Conf = config.get(HbaseOptions.HBASE_KRB5_CONF);
System.setProperty("java.security.krb5.conf", krb5Conf);
Expand Down

0 comments on commit 90092b8

Please sign in to comment.