Skip to content

Commit 84c1df2

Browse files
committed
AMBARI-140 (clemlab): improve hue start/stop handling follow up
1 parent 1d89927 commit 84c1df2

File tree

2 files changed

+37
-15
lines changed

2 files changed

+37
-15
lines changed

ambari-server/src/main/resources/stacks/ODP/1.0/services/HBASE/service_advisor.py

+33-14
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,12 @@ def recommendHBASEConfigurationsFromODP12(self, configurations, clusterData, ser
458458

459459
# https://github.com/apache/hbase/blob/13af64dc1cbd0e90c3a98071deeb815520b624ee/hbase-common/src/main/resources/hbase-default.xml#L1389
460460
hbaseThriftServerHosts = self.getHostsWithComponent("HBASE", "HBASE_THRIFTSERVER", services, hosts)
461+
hueServerHosts = self.getHostsWithComponent("HUE", "HUE_SERVER", services, hosts)
461462
if hbaseThriftServerHosts is not None and len(hbaseThriftServerHosts):
462-
putHbaseSiteProperty('hbase.regionserver.thrift.framed', 'true')
463+
putHbaseSiteProperty('hbase.regionserver.thrift.framed', 'false')
464+
putHbaseSiteProperty('hbase.regionserver.thrift.http', 'true')
465+
if hueServerHosts is not None and len(hueServerHosts) > 0 :
466+
putHbaseSiteProperty('hbase.thrift.support.proxyuser', 'true')
463467

464468
def setHandlerCounts(self, configurations, clusterData, services, hosts, cores):
465469
putHbaseSiteProperty = self.putProperty(configurations, "hbase-site", services)
@@ -534,16 +538,18 @@ def recommendHBASEConfigurationsForKerberos(self, configurations, clusterData, s
534538
else:
535539
self.logger.debug("No phoenix query server hosts to update")
536540

537-
hbase_thriftserver_server_hosts = self.getHBaseThriftServerHosts(services, hosts)
538-
hbaseEnvProperties = self.getSiteProperties(services['configurations'], 'hbase-env')
539-
if hbaseEnvProperties and self.checkSiteProperties(hbaseEnvProperties, 'hbase_user'):
540-
hbaseUser = hbaseEnvProperties['hbase_user']
541-
hbaseUserOld = self.getOldValue(services, 'hbase-env', 'hbase_user')
542-
self.put_proxyuser_value(hbaseUser, '*', is_groups=True, services=services, configurations=configurations, put_function=putCoreSiteProperty)
543-
if hbaseUserOld is not None and hbaseUser != hbaseUserOld:
544-
putCoreSitePropertyAttribute("hadoop.proxyuser.{0}.groups".format(hbaseUserOld), 'delete', 'true')
545-
services["forced-configurations"].append({"type" : "core-site", "name" : "hadoop.proxyuser.{0}.groups".format(hbaseUserOld)})
546-
services["forced-configurations"].append({"type" : "core-site", "name" : "hadoop.proxyuser.{0}.groups".format(hbaseUser)})
541+
if 'hbase.thrift.support.proxyuser' in configurations['hbase-site']['properties']:
542+
if configurations['hbase-site']['properties']['hbase.thrift.support.proxyuser'].lower() == 'true':
543+
hbase_thriftserver_server_hosts = self.getHBaseThriftServerHosts(services, hosts)
544+
hbaseEnvProperties = self.getSiteProperties(services['configurations'], 'hbase-env')
545+
if hbaseEnvProperties and self.checkSiteProperties(hbaseEnvProperties, 'hbase_user'):
546+
hbaseUser = hbaseEnvProperties['hbase_user']
547+
hbaseUserOld = self.getOldValue(services, 'hbase-env', 'hbase_user')
548+
self.put_proxyuser_value(hbaseUser, '*', is_groups=True, services=services, configurations=configurations, put_function=putCoreSiteProperty)
549+
if hbaseUserOld is not None and hbaseUser != hbaseUserOld:
550+
putCoreSitePropertyAttribute("hadoop.proxyuser.{0}.groups".format(hbaseUserOld), 'delete', 'true')
551+
services["forced-configurations"].append({"type" : "core-site", "name" : "hadoop.proxyuser.{0}.groups".format(hbaseUserOld)})
552+
services["forced-configurations"].append({"type" : "core-site", "name" : "hadoop.proxyuser.{0}.groups".format(hbaseUser)})
547553

548554
else:
549555
putHbaseSiteProperty('hbase.master.ui.readonly', 'false')
@@ -883,7 +889,9 @@ def validateHBASEConfigurationsFromHDP23(self, properties, recommendedDefaults,
883889
def validateHBASEConfigurationsFromODP12(self, properties, recommendedDefaults, configurations, services, hosts):
884890
hbase_site = properties
885891
validationItems = []
886-
892+
hbase_security_kerberos = False
893+
if "hbase.security.authentication" in properties:
894+
hbase_security_kerberos = properties["hbase.security.authentication"].lower() == "kerberos"
887895
#Adding HBase Thrift Logic Here
888896
ranger_plugin_properties = self.getSiteProperties(configurations, "ranger-hbase-plugin-properties")
889897
ranger_plugin_enabled = ranger_plugin_properties['ranger-hbase-plugin-enabled'] if ranger_plugin_properties else 'No'
@@ -909,9 +917,20 @@ def validateHBASEConfigurationsFromODP12(self, properties, recommendedDefaults,
909917
validationItems.append({"config-name": framed_prop_name,
910918
"item": self.getErrorItem("{0} needs to be defined when HBase Thrift Server is installed".format(framed_prop_name))})
911919
else:
912-
if 'false' == hbase_site[framed_prop_name].lower():
920+
if 'true' == hbase_site[framed_prop_name].lower() and hbase_security_kerberos :
913921
validationItems.append({"config-name": framed_prop_name,
914-
"item": self.getWarnItem("{0} should be set to true to improve performance and security".format(framed_prop_name))})
922+
"item": self.getWarnItem("{0} need to be set to false when kerberos is enabled".format(framed_prop_name))})
923+
#https://hbase.apache.org/book.html#security.gateway.thrift
924+
925+
# verification of hbase proxy user when hbase thrift server is installed and proxy is enable
926+
hbase_user = services['configurations']['hbase-env']['properties']['hbase_user']
927+
if 'hbase.thrift.support.proxyuser' in hbase_site:
928+
if hbase_site['hbase.thrift.support.proxyuser'].lower() == 'true':
929+
for prop in ["hadoop.proxyuser.{0}.groups".format(hbase_user),"hadoop.proxyuser.{0}.groups".format(hbase_user)]:
930+
if prop not in services['configurations']['core-site']['properties']:
931+
validationItems.append({"config-name": prop_name,
932+
"item": self.getErrorItem(
933+
"HBase user need to be added to proxyuser when impersonation is enabled.".format(prop_name))})
915934

916935
validationProblems = self.toConfigurationValidationProblems(validationItems, "hbase-site")
917936
return validationProblems

ambari-server/src/main/resources/stacks/ODP/1.2/services/HUE/package/scripts/params_linux.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,10 @@ def buildUrlElement(protocol, hdfs_host, port, servicePath) :
560560
hue_oozie_kerberos_enabled = security_enabled
561561

562562
if has_hbase:
563-
hbase_thrift_port = default("/configurations/hbase-site/hbase.thrift.port", 9090)
563+
hbase_thrift_http_port = default("/configurations/hbase-site/hbase.thrift.port", 9090)
564+
hbase_thrift_binary_port = default("/configurations/hbase-site/hbase.thrift.http.port", 9095)
565+
hbase_thrift_http_enabled = default("/configurations/hbase-site/'hbase.regionserver.thrift.http", 'false')
566+
hbase_thrift_port = hbase_thrift_binary_port if hbase_thrift_http_enabled.lower() == 'false' else hbase_thrift_http_port
564567
if len(hbase_thrift_hosts) > 1:
565568
hue_hbase_clusters = ','.join('(HBase Thrift'+ str(item)+ '|' + item +':'+ str(hbase_thrift_port) + ')' for item in hbase_thrift_hosts)
566569
else:

0 commit comments

Comments
 (0)