本文主要介绍经过JDBC链接Hive服务时,链接串中在不一样场景下涉及到的参数,这些场景包括非Kerberos认证环境、Kerberos认证环境、Kerberos认证环境下使用代理用户及Kerberos认证环境下使用代理用户且指定队列等使用场景。数据库
1.非Kerberos认证环境下hive jdbc链接串
!connect jdbc:hive2://${hive节点ip}:${hive端口号}/${须要链接的数据库名};代理
说明:server
${hive节点ip}——为Hive安装节点的ip或hostnamexml
${hive端口号}——为Hive服务的端口号,默认为10000队列
${须要链接的数据库名}——为须要链接的Hive数据库名,如:defaultip
2.hive jdbc链接串
!connect jdbc:hive2://${hive节点ip}:${hive端口号}/${须要链接的数据库名};principal=${hive principal};ci
说明:it
${hive节点ip}——为Hive安装节点的ip或hostnameio
${hive端口号}——为Hive服务的端口号,默认为10000集群
${须要链接的数据库名}——为须要链接的Hive数据库名,如:default
${hive principal}——为Hive服务的principal,此参数是在Hive集成Kerberos认证环境下使用,若是集群未使用Kerberos认证,则不须要配置该参数,若是集群是Kerberos认证环境,则该principal为hive-site.xml中hive.server2.authentication.kerberos.principal配置项的值
3.经过代理模式链接hive
!connect jdbc:hive2://${hive节点ip}:${hive端口号}/${须要链接的数据库名};principal=${hive principal};hive.server2.proxy.user=${proxyUserName};
说明:
${hive节点ip}——为Hive安装节点的ip或hostname
${hive端口号}——为Hive服务的端口号,默认为10000
${须要链接的数据库名}——为须要链接的Hive数据库名,如:default
${hive principal}——为Hive服务的principal,此参数是在Hive集成Kerberos认证环境下使用,若是集群未使用Kerberos认证,则不须要配置该参数,若是集群是Kerberos认证环境,则该principal为hive-site.xml中hive.server2.authentication.kerberos.principal配置项的值
${proxyUserName}——为Hive代理的用户名
4.hive jdbc链接串中指定代理用户、指定队列名
!connect jdbc:hive2://${hive节点ip}:${hive端口号}/${须要链接的数据库名};principal=${hive principal};hive.server2.proxy.user=${proxyUserName}?mapreduce.job.queuename=${queueName};
说明:
${hive节点ip}——为Hive安装节点的ip或hostname
${hive端口号}——为Hive服务的端口号,默认为10000
${须要链接的数据库名}——为须要链接的Hive数据库名,如:default
${hive principal}——为Hive服务的principal,此参数是在Hive集成Kerberos认证环境下使用,若是集群未使用Kerberos认证,则不须要配置该参数,若是集群是Kerberos认证环境,则该principal为hive-site.xml中hive.server2.authentication.kerberos.principal配置项的值
${queueName}——为执行Hive任务的队列名,该参数只支持执行引擎为MapReduce