hive server
hive 1
启动:
hive –service hiveserver
jdbc连接
org.apache.hadoop.hive.jdbc.HiveDriver
dbc:hive://172.22.1.100:10000/test
hive2
启动:
hive –service hiveserver2
jdbc连接
org.apache.hive.jdbc.HiveDriver
dbc:hive2://172.22.1.100:10000/test
开启远程写的权限
hdfs-site.xml
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>
配置用户自定义安全策略
首先hive支持多种安全认证方式:NONE,NOSASL, KERBEROS, LDAP, PAM ,CUSTOM等,一般默认配置为none就是没有任何验证,所以需要其他的安全策略,我选择的是CUSTOM(自定义安全策略)。
如果将hive.server2.authentication设置成CUSTOM,则需要设置
hive.server2.custom.authentication.class来指定用于权限认证的类,这个类需要实现
org.apache.hive.service.auth.PasswdAuthenticationProvider接口。
首先实现一个自定义类:
package com.imis.project;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import javax.security.sasl.AuthenticationException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hive.service.auth.PasswdAuthenticationProvider;
public class