zoukankan      html  css  js  c++  java
  • hive beeline使用说明

    参考 https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients#HiveServer2Clients-PythonClient

    https://cwiki.apache.org/confluence/display/Hive/Setting+Up+HiveServer2#SettingUpHiveServer2-PythonClientDriver

    Example:
    1. Connect using simple authentication to HiveServer2 on localhost:10000
    $ beeline -u jdbc:hive2://localhost:10000 username password

    2. Connect using simple authentication to HiveServer2 on hs.local:10000 using -n for username and -p for password
    $ beeline -n username -p password -u jdbc:hive2://hs2.local:10012

    3. Connect using Kerberos authentication with hive/localhost@mydomain.com as HiveServer2 principal  (现在一般生产集群都是用Kerberos 认证)
    $ beeline -u "jdbc:hive2://hs2.local:10013/default;principal=hive/localhost@mydomain.com

    4. Connect using SSL connection to HiveServer2 on localhost at 10000
    $ beeline jdbc:hive2://localhost:10000/default;ssl=true;sslTrustStore=/usr/local/truststore;trustStorePassword=mytruststorepassword

    5. Connect using LDAP authentication
    $ beeline -u jdbc:hive2://hs2.local:10013/default <ldap-username> <ldap-password>

    后面就像sql一样使用

      python client:

    https://github.com/cloudera/impyla(实测python3.7装不上)

    https://github.com/dropbox/PyHive

    能装上,但是对kerberos不是很友好

    这个链接是pyhive针对kerberos认证讨论的操作方法

    1. Install kerberos on your own computer
    2. Setup kerberos on your computer so that it connects to the remote kerberos server (/etc/krb5.conf)
    3. Given a keytab file (provided by your kerberos administrator), you can authenticate your computer to the remote kerberos server using kinit -kt your.keytab username@YOUR_KERBEROS_REALM
    4. You can check that you have a valid kerberos ticket using klist
    5. You can now launch pyhive with kerberos.
  • 相关阅读:
    python学习笔记番外:linux文件拷贝程序
    好看视频爬虫2.0
    Serverless 如何在阿里巴巴实现规模化落地?
    开放下载!2021 解锁 Serverless 从入门到实战大“橙”就
    这位硬核程序员,想好怎么过春节了吗?
    mysql error 1130 hy000:Host 'localhost' is not allowed to connect to this mysql server 解决方案
    DockerFile
    一种移动端的token设计方案(适合app+h5)
    elk7.5搭建详解
    关于rabbitmq与kafka的异同
  • 原文地址:https://www.cnblogs.com/to-here/p/14442136.html
Copyright © 2011-2022 走看看