分享

hue中hive的security如何配置

CR_Y 发表于 2017-11-16 16:23:17 [显示全部楼层] 只看大图 回帖奖励 阅读模式 关闭右栏 8 14437
已经安装了apache sentry服务,也在hive配置中配置了
hive.security.authorization.enabled,hive.security.authorization.createtable.owner.grants,但与sentry整合时一直没有成功,看了一些博客,尝试了许多方法都没有成功,求大神解答~~

hive权限控制

hive权限控制

已有(8)人评论

跳转到指定楼层
sstutu 发表于 2017-11-16 16:36:36
本帖最后由 sstutu 于 2017-11-16 16:47 编辑

没成功的原因有很多,所以你需要提供自己的错误日志,最好有自己怎么操作的,否则别人可能不猜到你错在什么地方?
回复

使用道具 举报

CR_Y 发表于 2017-11-16 16:57:43
这是我的/etc/sentry/conf/sentry-site.xml的配置
<property>
       <name>sentry.service.security.mode</name>
        <value>none</value>
    </property>
    <property>
       <name>sentry.service.admin.group</name>
        <value>impala,hive,hue</value>
    </property>
    <property>
       <name>sentry.service.allow.connect</name>
        <value>impala,hive,hue</value>
    </property>
    <property>
        <name>sentry.verify.schema.version</name>
        <value>true</value>
    </property>
    <property>
   <name>sentry.service.server.rpc-address</name>
    <value>slave1</value>
    </property>
    <property>
   <name>sentry.service.server.rpc-port</name>
    <value>8038</value>
    </property>
    <property>
       <name>sentry.store.jdbc.url</name>
       <value>jdbc:mysql://192.168.86.12:3306/sentry</value>
    </property>

   <property>
       <name>sentry.store.jdbc.driver</name>
        <value>com.mysql.jdbc.Driver</value>
    </property>
    <property>
       <name>sentry.store.jdbc.user</name>
        <value>root</value>
    </property>
    <property>
       <name>sentry.store.jdbc.password</name>
        <value>root</value>
    </property>
    <property>
       <name>sentry.hive.server</name>
        <value>master</value>
    </property>
    <property>
       <name>sentry.store.group.mapping</name>
       <value>org.apache.sentry.provider.common.HadoopGroupMappingService</value>
    </property>
这是hive-site.xml的配置
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.86.12:3306/hive?createDatabaseIfNotExist=true</value>
</property>

<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
  <value>root</value>
</property>
<property>
  <name>javax.jdo.option.ConnectionPassword</name>
  <value>root</value>
</property>

<property>
   <name>hive.security.authorization.task.factory</name>
   <value>org.apache.sentry.binding.hive.SentryHiveAuthorizationTaskFactoryImpl</value>
</property>
<property>
   <name>hive.server2.session.hook</name>
   <value>org.apache.sentry.binding.hive.HiveAuthzBindingSessionHook</value>
</property>
<property>
   <name>hive.sentry.conf.url</name>
   <value>file:///root/software/apache-hive-1.2.1-bin/conf/sentry-site.xml</value>
</property>
<property>
<name>hive.metastore.filter.hook</name>
<value>org.apache.sentry.binding.metastore.SentryMetaStoreFilterHook</value>
</property>
<property>
    <name>hive.metastore.pre.event.listeners</name>
    <value>org.apache.sentry.binding.metastore.MetastoreAuthzBinding</value>
    <description>list of comma separated listeners for metastore events.</description>
</property>
<property>
    <name>hive.metastore.event.listeners</name>
    <value>org.apache.sentry.binding.metastore.SentryMetastorePostEventListener</value>
    <description>list of comma separated listeners for metastore, post events.</description>
</property>


这是$HIVE_HOME下的sentry-site.xml的配置
<property>
    <name>hive.sentry.server</name>
    <value>slave1</value>
</property>
<property>
    <name>sentry.service.security.mode</name>
    <value>none</value>
</property>
<property>
    <name>sentry.hive.provider.backend</name>
    <value>org.apache.sentry.provider.db.SimpleDBProviderBackend</value>
</property>
<property>
    <name>sentry.service.client.server.rpc-address</name>
    <value>slave1</value>
</property>
<property>
    <name>sentry.service.client.server.rpc-port</name>
    <value>8038</value>
</property>
<property>
    <name>sentry.service.client.server.rpc-connection-timeout</name>
    <value>200000</value>
</property>
<property>
    <name>hive.sentry.provider</name>
    <value>org.apache.sentry.provider.file.HadoopGroupResourceAuthorizationProvider</value>
</property>

<property>
    <name>hive.sentry.failure.hooks</name>
    <value>com.cloudera.navigator.audit.hive.HiveSentryOnFailureHook</value>
</property>
<property>
    <name>sentry.hive.testing.mode</name>
     <value>true</value>
</property>

启动hive时报错如下:
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.hadoop.hive.shims.HadoopShims.getUGIForConf(Lorg/apache/hadoop/conf/Configuration;)Lorg/apache/hadoop/security/UserGroupInformation;
        at org.apache.sentry.binding.metastore.MetastoreAuthzBinding.getUserName(MetastoreAuthzBinding.java:435)
        at org.apache.sentry.binding.metastore.MetastoreAuthzBinding.onEvent(MetastoreAuthzBinding.java:174)
        at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.firePreEvent(HiveMetaStore.java:1992)
        at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.get_database(HiveMetaStore.java:931)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:107)
        at com.sun.proxy.$Proxy8.get_database(Unknown Source)
        at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.getDatabase(HiveMetaStoreClient.java:1158)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:156)
        at com.sun.proxy.$Proxy9.getDatabase(Unknown Source)
        at org.apache.hadoop.hive.ql.metadata.Hive.getDatabase(Hive.java:1301)
        at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.getDatabase(BaseSemanticAnalyzer.java:1384)
        at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.getDatabase(BaseSemanticAnalyzer.java:1378)
        at org.apache.hadoop.hive.ql.parse.DDLSemanticAnalyzer.analyzeShowTables(DDLSemanticAnalyzer.java:2182)
        at org.apache.hadoop.hive.ql.parse.DDLSemanticAnalyzer.analyzeInternal(DDLSemanticAnalyzer.java:338)
        at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:227)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:424)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:308)
        at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1122)
        at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1170)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1059)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1049)
        at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:213)
        at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:165)
        at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:376)
        at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:736)
        at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:681)
        at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:621)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:136)







回复

使用道具 举报

desehawk 发表于 2017-11-16 18:30:03
CR_Y 发表于 2017-11-16 16:57
这是我的/etc/sentry/conf/sentry-site.xml的配置

       sentry.service.security.mode

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.hadoop.hive.shims.HadoopShims.getUGIForConf(Lorg/apache/hadoop/conf/Configuration;)
这个错误似乎在hadoop里面,HadoopShims这个你应该知道的。
回复

使用道具 举报

CR_Y 发表于 2017-11-16 19:09:15
desehawk 发表于 2017-11-16 18:30
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.hadoop.hive.shims.HadoopShims.g ...

这个包的作用还真不知道,网上找了一下也没有找到这个包的作用。。。。。。
回复

使用道具 举报

CR_Y 发表于 2017-11-16 19:12:43
desehawk 发表于 2017-11-16 18:30
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.hadoop.hive.shims.HadoopShims.g ...

大神可以解释一下这个包的作用吗
回复

使用道具 举报

qcbb001 发表于 2017-11-16 19:41:31
CR_Y 发表于 2017-11-16 19:12
大神可以解释一下这个包的作用吗

shims相关类是用来兼容不同的hadoop和hive版本。楼主确定hadoop和hive兼容吗
回复

使用道具 举报

CR_Y 发表于 2017-11-17 09:59:05
qcbb001 发表于 2017-11-16 19:41
shims相关类是用来兼容不同的hadoop和hive版本。楼主确定hadoop和hive兼容吗

hadoop版本为2.7.4 hive版本为1.2.1,应该兼容吧
回复

使用道具 举报

qcbb001 发表于 2017-11-17 18:47:00
CR_Y 发表于 2017-11-17 09:59
hadoop版本为2.7.4 hive版本为1.2.1,应该兼容吧

1.2.2是稳定版本。换下版本试试。
或则看看权限,hive和hadoop权限是否一致
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条