Using HiveServer2 - Authentication
To configure Hive for use with HiveServer2, include the following configuration properties in the .../hive-site.xml configuration file.
<property>
<name>hive.support.concurrency</name>
<description>Enable Hive's Table Lock Manager Service</description>
<value>true</value>
</property> <property>
<name>hive.zookeeper.quorum</name>
<description>Zookeeper quorum used by Hive's Table Lock Manager</description>
<value><zk node1>,<zk node2>,...,<zk nodeN></value>
</property> <property>
<name>hive.zookeeper.client.port</name>
<value>5181</value>
<description>The Zookeeper client port. The MapR default clientPort is 5181.</description>
</property>
To implement custom authentication for HiveServer2, create a custom Authenticator class derived from the following interface:
public interface PasswdAuthenticationProvider {
/**
* The Authenticate method is called by the HiveServer2 authentication layer
* to authenticate users for their requests.
* If a user is to be granted, return nothing/throw nothing.
* When a user is to be disallowed, throw an appropriate {@link AuthenticationException}.
*
* For an example implementation, see {@link LdapAuthenticationProviderImpl}.
*
* @param user - The username received over the connection request
* @param password - The password received over the connection request
* @throws AuthenticationException - When a user is found to be
* invalid by the implementation
*/
void Authenticate(String user, String password) throws AuthenticationException;
}
e.g.
ackage org.apache.hadoop.hive.contrib.auth; import javax.security.sasl.AuthenticationException; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configurable;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.contrib.utils.MD5Util;
import org.apache.hive.service.auth.PasswdAuthenticationProvider; public class XXXXPasswdAuthenticator implements PasswdAuthenticationProvider,Configurable {
private static final Log LOG=LogFactory.getLog(XXXXPasswdAuthenticator.class);
private Configuration conf=null; private static final String HIVE_JDBC_PASSWD_AUTH_PREFIX="hive.jdbc_passwd.auth.%s"; public XXXXPasswdAuthenticator() {
init();
} /**
*
*/
public void init(){ } @Override
public void Authenticate(String userName, String passwd)
throws AuthenticationException {
LOG.info("user: "+userName+" try login."); String passwdMD5 = getConf().get(String.format(HIVE_JDBC_PASSWD_AUTH_PREFIX, userName)); if(passwdMD5==null){
String message = "user's ACL configration is not found. user:"+userName;
LOG.info(message);
throw new AuthenticationException(message);
} String md5 = MD5Util.md5Hex(passwd); if(!md5.equals(passwdMD5)){
String message = "user name and password is mismatch. user:"+userName;
throw new AuthenticationException(message);
} LOG.info("user "+userName+" login system successfully."); } @Override
public Configuration getConf() {
if(conf==null){
this.conf=new Configuration();
} return conf;
} @Override
public void setConf(Configuration arg0) {
this.conf=arg0;
} }
Add the following properties to the hive-site.xml file, then restart Hiveserver2:
<property>
<name>hive.server2.authentication</name>
<value>CUSTOM</value>
</property> <property>
<name>hive.server2.custom.authentication.class</name>
<value>org.apache.hadoop.hive.contrib.auth.XXXXPasswdAuthenticator</value>
</property>
User name and password would be set in hive-site.xml
<property>
<name>hive.jdbc_passwd.auth.hive_user1</name>
<value>b531c271de4552ca2dec510d318c87f9</value>
<description/>
</property>
<property>
<name>hive.jdbc_passwd.auth.hive_user2</name>
<value>b531c271de4552ca2dec510d318c87f9</value>
<description/>
</property>
Using HiveServer2 - Authentication的更多相关文章
- [Hive - LanguageManual ] ]SQL Standard Based Hive Authorization
Status of Hive Authorization before Hive 0.13 SQL Standards Based Hive Authorization (New in Hive 0. ...
- bigdata_hiveserver2报错_thrift
问题一: php客户端,链接hiveserver2 ,报错 如下 1: server.TThreadPoolServer (TThreadPoolServer.java:run(215)) - Err ...
- hiveserver2 with kerberos authentication
Kerberos协议: Kerberos协议主要用于计算机网络的身份鉴别(Authentication), 其特点是用户只需输入一次身份验证信息就可以凭借此验证获得的票据(ticket-grantin ...
- hiveServer2 和 metastore的一点解读。
刚看了hive官网的文档,对于一些概念结合自己的经验,似乎又多了一些理解,想一想还是记下来的好,一来我是个有些健忘的人,过一段时间即便忘了,循着这个帖子,也能快速把知识点抓起来:二来或许对别人也有些启 ...
- python 连接 hive 的 HiveServer2 的配置坑
环境: hadoop 2.7.6 hive 2.3.4 Hive 的 thirft 启动: hadoop 单机或者集群需要: 启动 webhdfs 修改 hadoop 的代理用户 <proper ...
- Python3 impyla 连接 hiveserver2
简介: 接到一个任务,需要从 hive 中读取数据,生成报表. 于是找到了官方文档:https://cwiki.apache.org/confluence/display/Hive/Setting+U ...
- beeline无密码连接hiveserver2
1.说明 #hiveserver2增加了权限控制,需要在hadoop的配置文件中配置 core-site.xml 增加以下内容: <property> <name>hadoop ...
- WCF : 修复 Security settings for this service require Windows Authentication but it is not enabled for the IIS application that hosts this service 问题
摘要 : 最近遇到了一个奇怪的 WCF 安全配置问题, WCF Service 上面配置了Windows Authentication. IIS上也启用了 Windows Authentication ...
- Atitit HTTP 认证机制基本验证 (Basic Authentication) 和摘要验证 (Digest Authentication)attilax总结
Atitit HTTP认证机制基本验证 (Basic Authentication) 和摘要验证 (Digest Authentication)attilax总结 1.1. 最广泛使用的是基本验证 ( ...
随机推荐
- atitit.为什么java体系开发效率这样低的原因and解决
atitit.为什么java体系开发效率这样低的原因and解决 #---开发理念问题(影响度:很大的,2-3倍效率) mvc<>webform server control ajax< ...
- 我所理解的JavaScript闭包
目录 一.闭包(Closure) 1.1.什么是闭包? 1.2.为什么要用闭包(作用)? 1.2.1.保护函数内的变量安全. 1.2.2.通过访问外部变量,一个闭包可以暂时保存这些变量的上下文环境,当 ...
- linux shell 多线程执行程序
Shell中并没有真正意义的多线程,要实现多线程可以启动多个后端进程,最大程度利用cpu性能. 直接看代码示例吧. (1) 顺序执行的代码 #!/bin/bash date ` do { echo & ...
- Undefined symbols for architecture i386: "_deflate", referenced from:
Undefined symbols for architecture i386: "_deflate", referenced from: PlatCompress(enumCom ...
- Android GPS 临近触发
前面介绍过LocationManager有一个addProximityAlert(double latitude,double longitude,float radius,long expirati ...
- Node-restify 简介
restify 是Node.js的模块.虽然restify的API或多或少的参考了express,但restify不是一个MVC框架,它是一套为了能够正确构建REST风格API而诞生的框架. http ...
- Flask-Babel 中文支持(zh-CN和zh-Hans-CN)
命名的翻译文件夹必须命名为zh_Hans-CN,其他的都是不标准的命名!
- H-Basis/SG/SH GI Relighting
小试了一把预计算全局光照,作为PRT的上级应用.完全自行实现,使用SG/SH.H-Basis基波对GI光场进行频域压缩,存在3D纹理中,用于2跳间接光照实时显示.其中坑点不少,尤其是在HDR环境下使用 ...
- Splunk - 如何在WebFramework之CORS模式下你的网站和splunk web进行交互
1. 修改配置文件以支持CORS 进入/Applications/Splunk/etc/system/local 修改server.conf 在最后加入如下: [httpServer]crossOri ...
- Living one day at a time (update for a long time)
1, http://acm.hdu.edu.cn/showproblem.php?pid=1228 2014-04-14 10:39:52 分析:字符串处理题... #include<iost ...