hbase组件是HDP自带组件,缺少HBase Thrift Server(与hue进行交互,如果不启动,hue组件无法与hue进行交互通信)、HBase Rest Server控制按钮,不能在Ambari页面进行这两个服务的启停,本笔记记录这两个服务如何在Ambari集群上面集成。
创建hbase_restserver.py、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 HbaseRest(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('rest', action = 'start')
def stop(self, env, upgrade_type=None):
import params
env.set_params(params)
hbase_service('rest', action = 'stop')
def status(self, env):
import status_params
env.set_params(status_params)
hbase_rest_pid_file = format("{pid_dir}/hbase-{hbase_user}-rest.pid")
check_process_status(hbase_rest_pid_file)
def get_component_name(self):
return "hbase-restserver"
if __name__ == "__main__":
HbaseRest().execute()
#!/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()
# 进入目录
[root@manager241 ~]# cd /var/lib/ambari-server/resources/common-services/HBASE/0.96.0.2.0/package/scripts
# 上传本地文件(hbase_restserver.py、hbase_thriftserver.py)到该目录
[root@manager241 scripts]# rz
# 修改权限
[root@manager241 scripts]# chmod +x hbase_restserver.py
[root@manager241 scripts]# chmod +x hbase_thriftserver.py
# 进入目录,修改metainfo.xml
[root@manager241 ~]# cd /var/lib/ambari-server/resources/common-services/HBASE/0.96.0.2.0
# 编辑metainfo.xml文件,添加如下内容
[root@manager241 0.96.0.2.0]# vim metainfo.xml
# 使用上述方法,在/var/lib/ambari-server/resources/stacks/HDP/3.0/services/HBASE目录下执行相同的操作
[root@manager241 ~]# cd /var/lib/ambari-server/resources/stacks/HDP/3.0/services/HBASE/package/scripts
# 上传本地文件(hbase_restserver.py、hbase_thriftserver.py)到该目录
[root@manager241 scripts]# rz
# 修改权限
[root@manager241 scripts]# chmod +x hbase_restserver.py
[root@manager241 scripts]# chmod +x hbase_thriftserver.py
# 进入目录,修改metainfo.xml
[root@manager241 ~]# cd /var/lib/ambari-server/resources/stacks/HDP/3.0/services/HBASE
# 编辑metainfo.xml文件,添加如下内容
[root@manager241 HBASE]# vim metainfo.xml
<component>
<name>HBASE_THRIFTSERVERname>
<displayName>HBase ThriftServerdisplayName>
<category>SLAVEcategory>
<cardinality>0+cardinality>
<versionAdvertised>trueversionAdvertised>
<dependencies>
<dependency>
<name>HBASE/HBASE_CLIENTname>
<scope>hostscope>
<auto-deploy>
<enabled>trueenabled>
auto-deploy>
dependency>
dependencies>
<commandScript>
<script>scripts/hbase_thriftserver.pyscript>
<scriptType>PYTHON</scriptType>
</commandScript>
</component>
<component>
<name>HBASE_RESTSERVER</name>
<displayName>HBase RestServer</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_restserver.pyscript>
<scriptType>PYTHONscriptType>
commandScript>
component>
重启ambari-server
[root@manager241 ~]# ambari-server restart
重启ambari-agent
[root@manager241 ~]# ambari-agent restart
[root@manager241 ~]# netstat -nltp | grep 9090
[root@manager241 ~]# ps aux | grep 21290