Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions bin/phoenix_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
import re
import subprocess
import sys
import xml.etree.ElementTree as ET

zk_tls_args = ""

def find(pattern, classPaths):
paths = classPaths.split(os.pathsep)
Expand Down Expand Up @@ -126,6 +129,28 @@ def setPath():
# Try to provide something valid
hbase_conf_dir = '.'

hbase_site_file = os.path.join(hbase_conf_dir, "hbase-site.xml")
try:
global zk_tls_args
root = ET.parse(hbase_site_file).getroot()
zk_hbase_prefix = "hbase.zookeeper.property."
zkcfg = {
prop.find("name").text[len(zk_hbase_prefix):]: prop.find("value").text
for prop in root.findall("property")
if prop.find("name").text.startswith(zk_hbase_prefix)
}
if 'client.secure' in zkcfg and zkcfg.get('client.secure').lower() == 'true':
zk_tls_args = '-Dzookeeper.client.secure=true ' + \
'-Dzookeeper.clientCnxnSocket=' + zkcfg['clientCnxnSocket'] + ' ' + \
'-Dzookeeper.ssl.trustStore.location=' + zkcfg['ssl.trustStore.location'] + ' ' + \
'-Dzookeeper.ssl.trustStore.type=' + zkcfg['ssl.trustStore.type'] + ' ' + \
'-Dzookeeper.ssl.trustStore.password=' + zkcfg['ssl.trustStore.password'] + ' '
except Exception as e:
sys.exit(
"ERROR: Failed to parse ZooKeeper TLS properties from '%s': %s"
% (hbase_site_file, repr(e))
)

Comment thread
anmolnar marked this conversation as resolved.
global current_dir
current_dir = os.path.dirname(os.path.abspath(__file__))

Expand Down Expand Up @@ -316,6 +341,7 @@ def common_sqlline_args(parser):
setPath()
print("phoenix_class_path:", phoenix_class_path)
print("hbase_conf_dir:", hbase_conf_dir)
print("zk_tls_args:", zk_tls_args)
print("current_dir:", current_dir)
print("phoenix_embedded_jar_path:", phoenix_embedded_jar_path)
print("phoenix_client_embedded_jar:", phoenix_client_embedded_jar)
Expand Down
1 change: 1 addition & 0 deletions bin/sqlline.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def kill_child():

java_cmd = phoenix_utils.java + ' ' + phoenix_utils.jvm_module_flags + \
' ' + opts + \
' ' + phoenix_utils.zk_tls_args + \
' -cp "' + phoenix_utils.hbase_conf_dir + os.pathsep + \
phoenix_utils.hadoop_conf + os.pathsep + \
phoenix_utils.sqlline_with_deps_jar + os.pathsep + \
Expand Down