新建hbase_thriftserver.py

#!/usr/bin/env python
"""
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.

"""

import sys
from resource_management import *
from resource_management.libraries.functions.security_commons import build_expectations, \
cached_kinit_executor, get_params_from_filesystem, validate_security_config_properties, \
FILE_TYPE_XML
from hbase import hbase
from hbase_service import hbase_service
import upgrade
from setup_ranger_hbase import setup_ranger_hbase
from ambari_commons import OSCheck, OSConst
from ambari_commons.os_family_impl import OsFamilyImpl
from resource_management.libraries.functions.check_process_status import check_process_status

class HbaseThrift(Script):

def install(self, env):
import params
env.set_params(params)
self.install_packages(env)
pass

def configure(self, env):
import params
env.set_params(params)
pass

def start(self, env, upgrade_type=None):
import params
env.set_params(params)
self.configure(env)
hbase_service('thrift', action = 'start')

def stop(self, env, upgrade_type=None):
import params
env.set_params(params)
hbase_service('thrift', action = 'stop')

def status(self, env):
import status_params
env.set_params(status_params)
hbase_thrift_pid_file = format("{pid_dir}/hbase-{hbase_user}-thrift.pid")
check_process_status(hbase_thrift_pid_file)

def get_component_name(self):
return "hbase-thriftserver"

if __name__ == "__main__":
HbaseThrift().execute()

上传hbase_thriftserver.py

上传/var/lib/ambari-server/resources/common-services/HBASE/0.96.0.2.0/package/scripts目录

添加执行权限

chmod +x hbase_thriftserver.py

修改metainfo.xml

添加以下内容:

<component>
    <name>HBASE_THRIFTSERVER</name>
    <displayName>HBase ThriftServer</displayName>
    <category>SLAVE</category>
    <cardinality>0+</cardinality>
    <versionAdvertised>true</versionAdvertised>
    <dependencies>
        <dependency>
            <name>HBASE/HBASE_CLIENT</name>
            <scope>host</scope>
            <auto-deploy>
                <enabled>true</enabled>
            </auto-deploy>
        </dependency>
    </dependencies>
    <commandScript>
        <script>scripts/hbase_thriftserver.py</script>
        <scriptType>PYTHON</scriptType>
    </commandScript>
</component>

复制HBase service目录到HBASE目录

cp /var/lib/ambari-server/resources/common-services/HBASE/0.96.0.2.0/* 到/var/lib/ambari-server/resources/common-services/HBASE/0.96.0.2.0/

重启ambari-server

在Amabri-web安装HBase thriftserver

在这里插入图片描述

修改hue.ini

hbase_clusters=(clusterName|IP:9090)

重启HUE

在这里插入图片描述

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐