python 连接 hive 的 HiveServer2 的配置坑

环境:

  • hadoop 2.7.6
  • hive 2.3.4

Hive 的 thirft 启动:

  • hadoop 单机或者集群需要:
    • 启动 webhdfs
    • 修改 hadoop 的代理用户 
<property>
  <name>hadoop.proxyuser.hadoop.hosts</name>
  <value>*</value>
</property>
<property>
  <name>hadoop.proxyuser.hadoop.groups</name>
  <value>*</value>
</property>

注:

hadoop.proxyuser.hadoop.hosts 中的 hadoop 代表任意节点的代理用户(hadoop, 可以更换) 都能访问 hdfs 集群。groups 表示代理用户的所属组

  • hive 配置
    • 注意 hive.server2.authentication 的方式 NOSASL(如下),与开发使用 pyhive (auth) 或者 impyla (auth_mechanism) 一致,防止出现: Error in sasl_client_start (-4) SASL(-4): no mechanism available:no mechanism available: Unable to find a callback: 2'") 之类的
<property>
    <name>hive.server2.authentication</name>
    <value>NOSASL</value>
    <description>
      Expects one of [nosasl, none, ldap, kerberos, pam, custom].
      Client authentication types.
        NONE: no authentication check
        LDAP: LDAP/AD based authentication
        KERBEROS: Kerberos/GSSAPI authentication
        CUSTOM: Custom authentication provider
                (Use with property hive.server2.custom.authentication.class)
        PAM: Pluggable authentication module
        NOSASL:  Raw transport
    </description>
</property>
    • hive.server2.enable.doAs
<property>
  <name>hive.server2.enable.doAs</name>
  <value>true</value>
</property>

注意:默认情况下,HiveServer2以提交查询的用户执行查询访问(true),如果hive.server2.enable.doAs设置为false,查询将以运行hiveserver2进程的用户访问。

      • 与HTTP传送相关的参数如下:
hive.server2.transport.mode – 默认值为binary(TCP),可选值HTTP。 
hive.server2.thrift.http.port– HTTP的监听端口,默认值为10001。 
hive.server2.thrift.http.path – 服务的端点名称,默认为 cliservice。 
hive.server2.thrift.http.min.worker.threads– 服务池中的最小工作线程,默认为5。 
hive.server2.thrift.http.max.worker.threads– 服务池中的最大工作线程,默认为500。 
      • 为了防止非加密模式下的内存泄露,可以通过设置下面的参数为true禁用文件系统的缓存: 
fs.hdfs.impl.disable.cache – 禁用HDFS文件系统缓存,默认值为false。 
fs.file.impl.disable.cache – 禁用本地文件系统缓存,默认值为false。 

 

转载于:https://www.cnblogs.com/spaceapp/p/10472849.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值