示例#1
0
    def get_config_files(self, cluster_context, configs, instance=None):
        hive_default = 'plugins/mapr/services/hive/resources/hive-default.xml'
        hive_site = bcf.HadoopXML("hive-site.xml")
        hive_site.remote_path = self.conf_dir(cluster_context)
        if instance:
            hive_site.fetch(instance)
        hive_site.parse(files.get_file_text(hive_default))
        hive_site.add_properties(self._get_hive_site_props(cluster_context))
        sentry_host = cluster_context.get_instance(sentry.SENTRY)
        if sentry_host:
            sentry_mode = cluster_context._get_cluster_config_value(
                sentry.Sentry().SENTRY_STORAGE_MODE)
            ui_name = sentry.Sentry().ui_name
            sentry_version = cluster_context.get_chosen_service_version(
                ui_name)
            sentry_service = cluster_context. \
                _find_service_instance(ui_name, sentry_version)
            if sentry_service.supports(self, sentry_mode):
                sentry_default = 'plugins/mapr/services/hive/resources/' \
                                 'sentry-default.xml'
                sentry_db = \
                    'plugins/mapr/services/hive/resources/sentry-db.xml'
                hive_site.parse(files.get_file_text(sentry_default))
                hive_site.add_property(
                    'hive.sentry.conf.url', 'file://%s/sentry-site.xml' %
                    sentry_service.conf_dir(cluster_context))
                if sentry_mode == sentry.DB_STORAGE_SENTRY_MODE:
                    hive_site.parse(files.get_file_text(sentry_db))

        return [hive_site]
示例#2
0
文件: impala.py 项目: madar010/mad
    def get_config_files(self, cluster_context, configs, instance=None):
        defaults = 'plugins/mapr/services/impala/resources/impala-env.sh.j2'

        impala_env = bcf.TemplateFile("env.sh")
        impala_env.remote_path = self.conf_dir(cluster_context)
        if instance:
            impala_env.fetch(instance)
        impala_env.parse(files.get_file_text(defaults))
        impala_env.add_properties(self._get_impala_env_props(cluster_context))
        sentry_host = cluster_context.get_instance(sentry.SENTRY)
        if sentry_host:
            sentry_mode = cluster_context._get_cluster_config_value(
                sentry.Sentry().SENTRY_STORAGE_MODE)
            ui_name = sentry.Sentry().ui_name
            sentry_version = cluster_context.get_chosen_service_version(
                ui_name)
            sentry_service = cluster_context. \
                _find_service_instance(ui_name, sentry_version)
            if sentry_service.supports(self, sentry_mode):
                impala_env.add_properties({
                    'sentry_home':
                    sentry_service.home_dir(cluster_context),
                    'sentry_db':
                    sentry_mode == sentry.DB_STORAGE_SENTRY_MODE,
                    'sentry_policy_file':
                    'maprfs://' + sentry_service.GLOBAL_POLICY_FILE,
                })
        return [impala_env]
示例#3
0
 def _create_sentry_role(self, cluster_context):
     instance = cluster_context.get_instance(HIVE_METASTORE)
     sentry_host = cluster_context.get_instance(sentry.SENTRY)
     if sentry_host:
         sentry_mode = cluster_context._get_cluster_config_value(
             sentry.Sentry().SENTRY_STORAGE_MODE)
         ui_name = sentry.Sentry().ui_name
         sentry_version = cluster_context.get_chosen_service_version(
             ui_name)
         sentry_service = cluster_context. \
             _find_service_instance(ui_name, sentry_version)
         if sentry_service.supports(self, sentry_mode):
             cmd = 'sudo -u mapr hive -e "create role admin_role;' \
                   'grant all on server HS2 to role admin_role;' \
                   'grant role admin_role to group mapr;"'
             with instance.remote() as r:
                 LOG.debug("Creating hive role for sentry")
                 r.execute_command(cmd, raise_when_error=False)
示例#4
0
文件: hue.py 项目: madar010/mad
    def _get_hue_ini_props(self, cluster_context):
        db_instance = mysql.MySQL.get_db_instance(cluster_context)
        is_yarn = cluster_context.cluster_mode == 'yarn'
        hue_specs = mysql.MySQL.HUE_SPECS
        rdbms_specs = mysql.MySQL.RDBMS_SPECS

        result = {
            'db_host':
            db_instance.internal_ip,
            'hue_name':
            hue_specs.db_name,
            'hue_user':
            hue_specs.user,
            'hue_password':
            hue_specs.password,
            'rdbms_name':
            rdbms_specs.db_name,
            'rdbms_user':
            rdbms_specs.user,
            'rdbms_password':
            rdbms_specs.password,
            'resource_manager_uri':
            cluster_context.resource_manager_uri,
            'yarn_mode':
            is_yarn,
            'rm_host':
            cluster_context.get_instance_ip(yarn.RESOURCE_MANAGER),
            'webhdfs_url':
            cluster_context.get_instance_ip(httpfs.HTTP_FS),
            'jt_host':
            cluster_context.get_instance_ip(mr.JOB_TRACKER),
            'oozie_host':
            cluster_context.get_instance_ip(oozie.OOZIE),
            'sqoop_host':
            cluster_context.get_instance_ip(sqoop.SQOOP_2_SERVER),
            'impala_host':
            cluster_context.get_instance_ip(impala.IMPALA_STATE_STORE),
            'zk_hosts_with_port':
            cluster_context.get_zookeeper_nodes_ip_with_port(),
            'secret_key':
            self._generate_secret_key()
        }

        hive_host = cluster_context.get_instance(hive.HIVE_SERVER_2)
        if hive_host:
            hive_service = cluster_context.get_service(hive.HIVE_SERVER_2)
            result.update({
                'hive_host':
                hive_host.internal_ip,
                'hive_version':
                hive_service.version,
                'hive_conf_dir':
                hive_service.conf_dir(cluster_context),
            })

        hbase_host = cluster_context.get_instance(hbase.HBASE_THRIFT)
        if hbase_host:
            hbase_service = cluster_context.get_service(hbase.HBASE_THRIFT)
            result.update({
                'hbase_host':
                hbase_host.internal_ip,
                'hbase_conf_dir':
                hbase_service.conf_dir(cluster_context),
            })

        livy_host = cluster_context.get_instance(HUE_LIVY)
        if livy_host:
            result.update({'livy_host': livy_host.internal_ip})

        sentry_host = cluster_context.get_instance(sentry.SENTRY)
        if sentry_host:
            ui_name = sentry.Sentry().ui_name
            sentry_version = cluster_context.get_chosen_service_version(
                ui_name)
            sentry_service = cluster_context. \
                _find_service_instance(ui_name, sentry_version)
            result.update({
                'sentry_host':
                sentry_host.internal_ip,
                'sentry_conf':
                sentry_service.conf_dir(cluster_context)
            })

        return result