zoukankan      html  css  js  c++  java
  • 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。 
  • 相关阅读:
    MySQL/MariaDB数据库的各种日志管理
    MySQL/MariaDB数据库的事务和隔离级别
    MySQL/MariaDB数据库的并发控制
    MySQL/MariaDB数据库的索引工作原理和优化
    MySQL/MariaDB数据库的查询缓存优化
    安卓(Android)开发基础知识
    typora快捷键
    理解ECS的概念和Unity中的ECS设计
    UGUI合批原理笔记
    SourceTree下载bitbucket代码
  • 原文地址:https://www.cnblogs.com/spaceapp/p/10472849.html
Copyright © 2011-2022 走看看