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
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@
"STANDARD": [
"hbase-regionserver"
]
},
"HBASE_THRIFT": {
"STACK-SELECT-PACKAGE": "hbase-master",
"INSTALL": [
"hbase-master"
],
"PATCH": [
"hbase-master"
],
"STANDARD": [
"hbase-master"
]
}
},
"HDFS": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
/**
* 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.
*/
-->
<configuration supports_final="true">
<property>
<name>hbase.thrift.port</name>
<value>9091</value>
<display-name>HBase Thrift Port</display-name>
<description>The port for the HBase Thrift server.</description>
<value-attributes>
<type>int</type>
<overridable>true</overridable>
</value-attributes>
<on-ambari-upgrade add="false"/>
</property>
<property>
<name>hbase.thrift.info.port</name>
<value>9095</value>
<display-name>HBase Thrift Info Port</display-name>
<description>The info port for the HBase Thrift server web UI.</description>
<value-attributes>
<type>int</type>
<overridable>true</overridable>
</value-attributes>
<on-ambari-upgrade add="false"/>
</property>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,32 @@
</logs>
</component>

<component>
<name>HBASE_THRIFT</name>
<displayName>HBase Thrift Server</displayName>
<category>SLAVE</category>
<cardinality>0+</cardinality>
<versionAdvertised>true</versionAdvertised>
<timelineAppid>hbase</timelineAppid>
<commandScript>
<script>scripts/hbase_thrift.py</script>
<scriptType>PYTHON</scriptType>
</commandScript>
<configFiles>
<configFile>
<type>xml</type>
<fileName>hbase-thrift-site.xml</fileName>
<dictionaryName>hbase-thrift-site</dictionaryName>
</configFile>
</configFiles>
<logs>
<log>
<logId>hbase_thrift</logId>
<primary>true</primary>
</log>
</logs>
</component>

<component>
<name>HBASE_CLIENT</name>
<displayName>HBase Client</displayName>
Expand Down Expand Up @@ -150,6 +176,7 @@
<config-type>viewfs-mount-table</config-type>
<config-type>hbase-policy</config-type>
<config-type>hbase-site</config-type>
<config-type>hbase-thrift-site</config-type>
<config-type>hbase-env</config-type>
<config-type>hbase-log4j</config-type>
<config-type>ranger-hbase-plugin-properties</config-type>
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <port> --infoport <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 <port> --infoport <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()
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
SERVER_ROLE_DIRECTORY_MAP = {
"HBASE_MASTER": "hbase-master",
"HBASE_REGIONSERVER": "hbase-regionserver",
"HBASE_THRIFT": "hbase-master",
"HBASE_CLIENT": "hbase-client",
}

Expand All @@ -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"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
5 changes: 5 additions & 0 deletions ambari-web/app/mappers/components_state_mapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
5 changes: 4 additions & 1 deletion ambari-web/app/mappers/service_metrics_mapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions ambari-web/app/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 3 additions & 0 deletions ambari-web/app/models/service/hbase.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
Loading