python cannot connect hiveserver2

后端 未结 4 1312
悲哀的现实
悲哀的现实 2020-12-11 03:42

I have tried use the example on https://cwiki.apache.org/confluence/display/Hive/Setting+Up+HiveServer2 but gets the following errors:

/usr/lib/python2.7/dis         


        
相关标签:
4条回答
  • 2020-12-11 04:09

    Setting up following environment variable worked for me:

    SASL_PATH=/usr/lib/x86_64-linux-gnu/sasl2 
    

    This is for Ubuntu

    0 讨论(0)
  • 2020-12-11 04:11

    The above answers don't work in my case, I've also tried others. Finally, I've solved my problem (no idea if it works for you).

    Just execute

    export LD_LIBRARY_PATH=/usr/lib64:/usr/local/lib:$LD_LIBRARY_PATH
    

    before running your script.

    My original LD_LIBRARY_PATH is /usr/local/lib:/usr/lib64

    0 讨论(0)
  • 2020-12-11 04:14

    You are missing some dependencies, make sure you install cyrus-sasl-devel and cyrus-sasl-gssapi:

    On an RHEL-based distro:

    sudo yum install cyrus-sasl-devel cyrus-sasl-gssapi cyrus-sasl-md5 cyrus-sasl-plain

    ... or on a Debian-based distro:

    sudo apt-get install sasl2-bin libsasl2-2 libsasl2-dev libsasl2-modules

    Per @KenKennedy, also add the libsasl2-modules-gssapi-mit package if using GSSAPI for authentication.

    0 讨论(0)
  • 2020-12-11 04:34

    1 In hive-site.xml, set configuration as below:

    <property>
       <name>hive.server2.authentication</name>
       <value>NOSASL</value>
    </property>
    

    2 pyhs2 program codes changes as below:

    with pyhs2.connect(host='localhost',
                       port=10000,
                       authMechanism="NOSASL",
                       user='user',
                       password='password',
                       database='default') as conn:
    

    Please note that username and password cannot be empty, add any username and password when connects to pyhs2

    0 讨论(0)
提交回复
热议问题