diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/properties/stack_packages.json b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/properties/stack_packages.json index 3cbda98976a..6fcce5ed725 100644 --- a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/properties/stack_packages.json +++ b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/properties/stack_packages.json @@ -67,6 +67,18 @@ "STANDARD": [ "hbase-regionserver" ] + }, + "HBASE_THRIFT": { + "STACK-SELECT-PACKAGE": "hbase-master", + "INSTALL": [ + "hbase-master" + ], + "PATCH": [ + "hbase-master" + ], + "STANDARD": [ + "hbase-master" + ] } }, "HDFS": { diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/configuration/hbase-thrift-site.xml b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/configuration/hbase-thrift-site.xml new file mode 100644 index 00000000000..50503a878b3 --- /dev/null +++ b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/configuration/hbase-thrift-site.xml @@ -0,0 +1,45 @@ + + + + + + hbase.thrift.port + 9091 + HBase Thrift Port + The port for the HBase Thrift server. + + int + true + + + + + hbase.thrift.info.port + 9095 + HBase Thrift Info Port + The info port for the HBase Thrift server web UI. + + int + true + + + + diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/metainfo.xml b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/metainfo.xml index 657459107b8..da4f4d5609d 100755 --- a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/metainfo.xml +++ b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/metainfo.xml @@ -98,6 +98,32 @@ + + HBASE_THRIFT + HBase Thrift Server + SLAVE + 0+ + true + hbase + + + PYTHON + + + + xml + hbase-thrift-site.xml + hbase-thrift-site + + + + + hbase_thrift + true + + + + HBASE_CLIENT HBase Client @@ -150,6 +176,7 @@ viewfs-mount-table hbase-policy hbase-site + hbase-thrift-site hbase-env hbase-log4j ranger-hbase-plugin-properties diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/scripts/hbase_thrift.py b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/scripts/hbase_thrift.py new file mode 100644 index 00000000000..550340a4b73 --- /dev/null +++ b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/scripts/hbase_thrift.py @@ -0,0 +1,161 @@ +#!/usr/bin/env python3 +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +HBase Thrift Server - Manages the HBase Thrift service. +Uses hbase-daemon.sh start thrift -p --infoport +""" + +from resource_management.core.resources.system import Execute +from resource_management.core.shell import as_sudo +from resource_management.libraries.script.script import Script +from resource_management.libraries.functions.format import format +from resource_management.libraries.functions.check_process_status import check_process_status +from resource_management.libraries.functions.show_logs import show_logs +from resource_management.core.resources import File +import upgrade + + +class HbaseThrift(Script): + def install(self, env): + import params + env.set_params(params) + self.install_packages(env) + + def pre_upgrade_restart(self, env, upgrade_type=None): + import params + env.set_params(params) + upgrade.prestart(env) + + def configure(self, env): + import params + env.set_params(params) + thrift_site_config = params.config['configurations'].get('hbase-thrift-site', {}) + hbase_site_config = params.config['configurations'].get('hbase-site', {}) + hbase_env_config = params.config['configurations'].get('hbase-env', {}) + + from hbase import hbase + hbase(name='regionserver') # Use same config as regionserver for thrift + + # Build an effective hbase-site.xml for Thrift without mutating immutable Ambari config dicts. + effective_hbase_site_config = dict(hbase_site_config) + if not effective_hbase_site_config.get('hbase.thrift.kerberos.principal'): + thrift_principal = ( + effective_hbase_site_config.get('hbase.master.kerberos.principal') + or effective_hbase_site_config.get('hbase.regionserver.kerberos.principal') + or hbase_env_config.get('hbase_principal_name') + ) + if thrift_principal: + effective_hbase_site_config['hbase.thrift.kerberos.principal'] = thrift_principal + + if not effective_hbase_site_config.get('hbase.thrift.keytab.file'): + thrift_keytab = ( + effective_hbase_site_config.get('hbase.master.keytab.file') + or effective_hbase_site_config.get('hbase.regionserver.keytab.file') + or hbase_env_config.get('hbase_user_keytab') + ) + if thrift_keytab: + effective_hbase_site_config['hbase.thrift.keytab.file'] = thrift_keytab + + from resource_management.libraries.resources.xml_config import XmlConfig + XmlConfig("hbase-site.xml", + conf_dir=params.hbase_conf_dir, + configurations=effective_hbase_site_config, + configuration_attributes=params.config['configurationAttributes']['hbase-site'], + owner=params.hbase_user, + group=params.user_group) + + # Deploy hbase-thrift-site.xml (Thrift-specific config) + if thrift_site_config: + XmlConfig("hbase-thrift-site.xml", + conf_dir=params.hbase_conf_dir, + configurations=thrift_site_config, + configuration_attributes=params.config['configurationAttributes'].get('hbase-thrift-site', {}), + owner=params.hbase_user, + group=params.user_group) + + def start(self, env, upgrade_type=None): + import params + env.set_params(params) + self.configure(env) + + role = 'thrift' + cmd = format("{daemon_script} --config {hbase_conf_dir}") + pid_file = format("{pid_dir}/hbase-{hbase_user}-{role}.pid") + pid_expression = as_sudo(["cat", pid_file]) + no_op_test = as_sudo(["test", "-f", pid_file]) + format(" && ps -p `{pid_expression}` >/dev/null 2>&1") + + # Thrift requires port args: -p --infoport + thrift_port = params.hbase_thrift_port + thrift_info_port = params.hbase_thrift_info_port + daemon_cmd = format("{cmd} start {role} -p {thrift_port} --infoport {thrift_info_port}") + + try: + Execute(daemon_cmd, + not_if=no_op_test, + user=params.hbase_user + ) + except: + show_logs(params.log_dir, params.hbase_user) + raise + + def stop(self, env, upgrade_type=None): + import params + env.set_params(params) + + role = 'thrift' + cmd = format("{daemon_script} --config {hbase_conf_dir}") + pid_file = format("{pid_dir}/hbase-{hbase_user}-{role}.pid") + pid_expression = as_sudo(["cat", pid_file]) + no_op_test = as_sudo(["test", "-f", pid_file]) + format(" && ps -p `{pid_expression}` >/dev/null 2>&1") + + daemon_cmd = format("{cmd} stop {role}") + shutdown_timeout = getattr(params, 'hbase_regionserver_shutdown_timeout', 30) + + try: + Execute(daemon_cmd, + user=params.hbase_user, + only_if=no_op_test, + timeout=shutdown_timeout, + on_timeout=format("! ( {no_op_test} ) || {sudo} -H -E kill -9 `{pid_expression}`") + ) + except: + show_logs(params.log_dir, params.hbase_user) + raise + + File(pid_file, action="delete") + + def status(self, env): + import status_params + env.set_params(status_params) + check_process_status(status_params.thrift_pid_file) + + def get_log_folder(self): + import params + return params.log_dir + + def get_user(self): + import params + return params.hbase_user + + def get_pid_files(self): + import status_params + return [status_params.thrift_pid_file] + + +if __name__ == "__main__": + HbaseThrift().execute() diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/scripts/params_linux.py b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/scripts/params_linux.py index b6b8b8757f7..4a22f528dc4 100755 --- a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/scripts/params_linux.py +++ b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/scripts/params_linux.py @@ -181,6 +181,9 @@ phoenix_enabled = default("/configurations/hbase-env/phoenix_sql_enabled", False) has_phoenix = len(phoenix_hosts) > 0 +hbase_thrift_port = default("/configurations/hbase-thrift-site/hbase.thrift.port", "9091") +hbase_thrift_info_port = default("/configurations/hbase-thrift-site/hbase.thrift.info.port", "9095") + underscored_version = stack_version_unformatted.replace(".", "_") dashed_version = stack_version_unformatted.replace(".", "-") # if OSCheck.is_redhat_family() or OSCheck.is_suse_family(): diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/scripts/status_params.py b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/scripts/status_params.py index 0844ef7b3f0..673d9e5bd30 100755 --- a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/scripts/status_params.py +++ b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/scripts/status_params.py @@ -33,6 +33,7 @@ SERVER_ROLE_DIRECTORY_MAP = { "HBASE_MASTER": "hbase-master", "HBASE_REGIONSERVER": "hbase-regionserver", + "HBASE_THRIFT": "hbase-master", "HBASE_CLIENT": "hbase-client", } @@ -51,6 +52,7 @@ hbase_master_pid_file = format("{pid_dir}/hbase-{hbase_user}-master.pid") regionserver_pid_file = format("{pid_dir}/hbase-{hbase_user}-regionserver.pid") + thrift_pid_file = format("{pid_dir}/hbase-{hbase_user}-thrift.pid") # Security related/required params hostname = config["agentLevelParams"]["hostname"] diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/quicklinks/quicklinks.json b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/quicklinks/quicklinks.json index ccf901b5c9e..edba790afeb 100755 --- a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/quicklinks/quicklinks.json +++ b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/quicklinks/quicklinks.json @@ -97,6 +97,21 @@ "regex": "", "site": "hbase-site" } + }, + { + "name": "hbase_thrift_ui", + "label": "Thrift Server Info", + "component_name": "HBASE_THRIFT", + "url": "%@://%@:%@/", + "requires_user_name": "false", + "port": { + "http_property": "hbase.thrift.info.port", + "http_default_port": "9095", + "https_property": "hbase.thrift.info.port", + "https_default_port": "9095", + "regex": "", + "site": "hbase-thrift-site" + } } ] } diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/role_command_order.json b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/role_command_order.json index 58d0c1c2a09..58175e242f4 100755 --- a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/role_command_order.json +++ b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/role_command_order.json @@ -4,6 +4,7 @@ "HBASE_REGIONSERVER-START": ["HBASE_MASTER-START"], "HBASE_SERVICE_CHECK-SERVICE_CHECK": ["HBASE_MASTER-START", "HBASE_REGIONSERVER-START"], "HBASE_MASTER-STOP": ["HBASE_REGIONSERVER-STOP"], - "HBASE_MASTER-START": ["NAMENODE-START", "DATANODE-START", "ZOOKEEPER_SERVER-START", "RANGER_USERSYNC-START", "RANGER_KMS_SERVER-START"] + "HBASE_MASTER-START": ["NAMENODE-START", "DATANODE-START", "ZOOKEEPER_SERVER-START", "RANGER_USERSYNC-START", "RANGER_KMS_SERVER-START"], + "HBASE_THRIFT-START": ["HBASE_MASTER-START"] } } diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/service_advisor.py b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/service_advisor.py index 2b96fdbee0a..23881023e00 100755 --- a/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/service_advisor.py +++ b/ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/service_advisor.py @@ -186,7 +186,7 @@ def getServiceConfigurationsValidationItems( ) def isComponentUsingCardinalityForLayout(self, componentName): - return componentName == "PHOENIX_QUERY_SERVER" + return componentName in ["PHOENIX_QUERY_SERVER", "HBASE_THRIFT"] class HBASERecommender(service_advisor.ServiceAdvisor): diff --git a/ambari-web/app/mappers/components_state_mapper.js b/ambari-web/app/mappers/components_state_mapper.js index fb1213840f4..fb812288584 100644 --- a/ambari-web/app/mappers/components_state_mapper.js +++ b/ambari-web/app/mappers/components_state_mapper.js @@ -87,6 +87,11 @@ App.componentsStateMapper = App.QuickDataMapper.create({ phoenix_servers_installed: 'INSTALLED_PATH', phoenix_servers_total: 'TOTAL_PATH' }, + 'HBASE_THRIFT': { + thrift_servers_started: 'STARTED_PATH', + thrift_servers_installed: 'INSTALLED_PATH', + thrift_servers_total: 'TOTAL_PATH' + }, 'GANGLIA_MONITOR': { ganglia_monitors_started: 'STARTED_PATH', ganglia_monitors_installed: 'INSTALLED_PATH', diff --git a/ambari-web/app/mappers/service_metrics_mapper.js b/ambari-web/app/mappers/service_metrics_mapper.js index 7da550d6b15..9b9517f6ec1 100644 --- a/ambari-web/app/mappers/service_metrics_mapper.js +++ b/ambari-web/app/mappers/service_metrics_mapper.js @@ -149,7 +149,10 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({ region_servers_total: 'region_servers_total', phoenix_servers_started: 'phoenix_servers_started', phoenix_servers_installed: 'phoenix_servers_installed', - phoenix_servers_total: 'phoenix_servers_total' + phoenix_servers_total: 'phoenix_servers_total', + thrift_servers_started: 'thrift_servers_started', + thrift_servers_installed: 'thrift_servers_installed', + thrift_servers_total: 'thrift_servers_total' }, stormConfig: { total_tasks: 'restApiComponent.tasksTotal', diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index 6ccaf175afd..bdf8bb1752c 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -3226,6 +3226,8 @@ Em.I18n.translations = { 'dashboard.services.hbase.regionServersSummary':'{0} live / {1} total', 'dashboard.services.hbase.phoenixServers':'Phoenix Query Servers', 'dashboard.services.hbase.phoenixServersSummary':'{0} live / {1} total', + 'dashboard.services.hbase.thriftServers':'HBase Thrift Servers', + 'dashboard.services.hbase.thriftServersSummary':'{0} live / {1} total', 'dashboard.services.hbase.chart.label':'Request Count', 'dashboard.services.hbase.masterWebUI':'Master Web UI', 'dashboard.services.hbase.regions.transition':'Regions In Transition', diff --git a/ambari-web/app/models/service/hbase.js b/ambari-web/app/models/service/hbase.js index 09378fc7c1a..dc3be344137 100644 --- a/ambari-web/app/models/service/hbase.js +++ b/ambari-web/app/models/service/hbase.js @@ -25,6 +25,9 @@ App.HBaseService = App.Service.extend({ phoenixServersStarted: DS.attr('number'), phoenixServersInstalled: DS.attr('number'), phoenixServersTotal: DS.attr('number'), + thriftServersStarted: DS.attr('number'), + thriftServersInstalled: DS.attr('number'), + thriftServersTotal: DS.attr('number'), masterStartTime: DS.attr('number'), masterActiveTime: DS.attr('number'), averageLoad: DS.attr('number'), diff --git a/ambari-web/app/templates/main/service/services/hbase.hbs b/ambari-web/app/templates/main/service/services/hbase.hbs index 581099b3e00..9c418cd85fd 100644 --- a/ambari-web/app/templates/main/service/services/hbase.hbs +++ b/ambari-web/app/templates/main/service/services/hbase.hbs @@ -67,6 +67,25 @@ {{/if}} + {{! ThriftServers }} + {{#if view.isThriftServerCreated}} +
+
+ + {{#view App.ComponentLiveTextView liveComponentsBinding="view.service.thriftServersStarted" totalComponentsBinding="view.service.thriftServersTotal"}} + {{#if App.router.clusterController.isServiceContentFullyLoaded}} + {{view.liveComponents}}/{{view.totalComponents}} + {{/if}} + {{/view}} + + {{t common.live}} +
+ +
+ {{/if}} {{! Regions in Transition }}
{{view.service.regionsInTransition}}
diff --git a/ambari-web/app/views/main/service/services/hbase.js b/ambari-web/app/views/main/service/services/hbase.js index fd889a99d08..37fbe8c15a2 100644 --- a/ambari-web/app/views/main/service/services/hbase.js +++ b/ambari-web/app/views/main/service/services/hbase.js @@ -50,6 +50,8 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({ phoenixServersText: Em.computed.countBasedMessage('service.phoenixServersTotal', '', Em.I18n.t('services.service.summary.viewHost'), Em.I18n.t('services.service.summary.viewHosts')), + thriftServersText: Em.computed.countBasedMessage('service.thriftServersTotal', '', Em.I18n.t('services.service.summary.viewHost'), Em.I18n.t('services.service.summary.viewHosts')), + /** * One(!) active master component */ @@ -87,11 +89,19 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({ componentName: 'PHOENIX_QUERY_SERVER' }), + thriftServerComponent: Em.Object.create({ + componentName: 'HBASE_THRIFT' + }), + isRegionServerCreated: function () { return this.isServiceComponentCreated('HBASE_REGIONSERVER'); }.property('App.router.clusterController.isComponentsStateLoaded'), isPhoenixQueryServerCreated: function () { return this.isServiceComponentCreated('PHOENIX_QUERY_SERVER'); + }.property('App.router.clusterController.isComponentsStateLoaded'), + + isThriftServerCreated: function () { + return this.isServiceComponentCreated('HBASE_THRIFT'); }.property('App.router.clusterController.isComponentsStateLoaded') }); diff --git a/ambari-web/test/views/main/service/services/hbase_test.js b/ambari-web/test/views/main/service/services/hbase_test.js index f8f194181c6..b4e46d13d3f 100644 --- a/ambari-web/test/views/main/service/services/hbase_test.js +++ b/ambari-web/test/views/main/service/services/hbase_test.js @@ -41,6 +41,8 @@ describe('App.MainDashboardServiceHbaseView', function () { App.TestAliases.testAsComputedCountBasedMessage(getView(), 'phoenixServersText', 'service.phoenixServersTotal', '', Em.I18n.t('services.service.summary.viewHost'), Em.I18n.t('services.service.summary.viewHosts')); + App.TestAliases.testAsComputedCountBasedMessage(getView(), 'thriftServersText', 'service.thriftServersTotal', '', Em.I18n.t('services.service.summary.viewHost'), Em.I18n.t('services.service.summary.viewHosts')); + describe('#averageLoad', function () { beforeEach(function () {