This is an automated email from the ASF dual-hosted git repository.
richardantal pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/master by this push:
new 19422a0147 PHOENIX-7848: Use ZK TLS properties from HBase config if
present (#2467)
19422a0147 is described below
commit 19422a01472068392504b2105d2ec3ad5b62bde1
Author: Andor Molnár <[email protected]>
AuthorDate: Mon May 18 04:24:16 2026 -0500
PHOENIX-7848: Use ZK TLS properties from HBase config if present (#2467)
Parse ZooKeeper TLS properties from hbase-site.xml and add them to sqlline
command line args.
---
bin/phoenix_utils.py | 26 ++++++++++++++++++++++++++
bin/sqlline.py | 1 +
2 files changed, 27 insertions(+)
diff --git a/bin/phoenix_utils.py b/bin/phoenix_utils.py
index 27032df5f1..103bd70c8d 100755
--- a/bin/phoenix_utils.py
+++ b/bin/phoenix_utils.py
@@ -25,6 +25,9 @@ import fnmatch
import re
import subprocess
import sys
+import xml.etree.ElementTree as ET
+
+zk_tls_args = ""
def find(pattern, classPaths):
paths = classPaths.split(os.pathsep)
@@ -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))
+ )
+
global current_dir
current_dir = os.path.dirname(os.path.abspath(__file__))
@@ -316,6 +341,7 @@ if __name__ == "__main__":
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)
diff --git a/bin/sqlline.py b/bin/sqlline.py
index 09424789de..7fc8d252c6 100755
--- a/bin/sqlline.py
+++ b/bin/sqlline.py
@@ -94,6 +94,7 @@ opts = os.getenv('PHOENIX_OPTS') or os.getenv('HBASE_OPTS')
or ''
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 + \