挖坑:hive集成kerberos
集成 hive Kerberos
2023-09-11 14:20:41 时间
集成hive+kerberos前,hadoop已经支持kerberos,所以基础安装略去: https://www.cnblogs.com/garfieldcgf/p/10077331.html
直接用之前hadoop集成生成的keytab文件开始配置:
hive的 conf/hive-site.xml,添加如下:
<property> <name>hive.server2.authentication</name> <value>KERBEROS</value> </property> <property> <name>hive.server2.authentication.kerberos.principal</name> <value>udap/_HOST@STA.COM</value> </property> <property> <name>hive.server2.authentication.kerberos.keytab</name> <value>/home/udap/app/hadoop-2.6.0-cdh5.7.2/etc/hadoop/udap.keytab</value> </property> <property> <name>hive.metastore.sasl.enabled</name> <value>true</value> </property> <property> <name>hive.metastore.kerberos.keytab.file</name> <value>/home/udap/app/hadoop-2.6.0-cdh5.7.2/etc/hadoop/udap.keytab</value> </property> <property> <name>hive.metastore.kerberos.principal</name> <value>udap/_HOST@STA.COM</value> </property>
第二步,配置hadoop中的core-site.xml,添加如下:
<property> <name>hadoop.proxyuser.hive.hosts</name> <value>*</value> </property> <property> <name>hadoop.proxyuser.hive.groups</name> <value>*</value> </property> <property> <name>hadoop.proxyuser.hdfs.hosts</name> <value>*</value> </property> <property> <name>hadoop.proxyuser.hdfs.groups</name> <value>*</value> </property> <property> <name>hadoop.proxyuser.HTTP.hosts</name> <value>*</value> </property> <property> <name>hadoop.proxyuser.HTTP.groups</name> <value>*</value> </property> <property> <name>hadoop.proxyuser.udap.hosts</name> <value>*</value> </property> <property> <name>hadoop.proxyuser.udap.groups</name> <value>*</value> </property>
如果有多台,请保证每个节点配置都一样
bin目录下,启动hive
nohup ./hive --service metastore &
nohup ./hive --service hiveserver2 &
启动完成后就可以登录kerberos,然后用hive工具访问数据,如果是beenline登录,则需要使用如下链接串:
!connect jdbc:hive2://10.1.4.32:10000/default;principal=udap/host32@STA.COM
其中后面的principle,是创建数据库所用的用户,而非访问的用户
错误:
注意core-site中的用户代理配置,当kb的用户没有在配置的用户许可中时将会有报错:
org.apache.hadoop.ipc.RemoteException: User: root is not allowed to impersonate root
即,远程异常:用户root不允许模拟root
在hadoop中,远程访问时通过用户代理的方式,这里的不允许是需要配置特定用户允许远程访问:
<property>
<name>hadoop.proxyuser.root.groups</name>
<value>*</value>
<description>Allow the superuser oozie to impersonate any members of the group group1 and group2</description>
</property>
<property>
<name>hadoop.proxyuser.root.hosts</name>
<value>*</value>
<description>The superuser can connect only from host1 and host2 to impersonate a user</description>
</property>
如果报错不是root,或者你需要的并不是root用户,就修改一下<name>标签中的root
简单记录,有问题欢迎交流
相关文章
- 软件测试之集成测试
- Hive-java.lang.ClassNotFoundException: org.apache.hadoop.hive.contrib.serde2.MultiDelimitSerDe
- 技术分享 | Spring Boot 集成 Swagger
- SpringBoot集成jdbcTemplate/JPA
- 数仓工具—Hive集成篇之ElasticSerach(01)
- 如何在Flutter中集成华为认证服务
- Jenkins(持续集成)Windows版本解决插件安装缓慢
- hive学习----Hive表的创建
- 实践 —— 亲测从 RDS MySQL 通过数据集成导入 MaxCompute
- 5.2 spring集成redis