hive查询不起作用

jfgube3f  于 2021-06-02  发布在  Hadoop
关注(0)|答案(1)|浏览(407)

运行此代码时,卡在 $client->execute('SHOW DATABASES'); line.libraries在正确的目录下,但不知何故我们无法进行查询

<?php
    $GLOBALS['THRIFT_ROOT'] = dirname(__FILE__) . '/lib';
    require_once $GLOBALS['THRIFT_ROOT'] . '/packages/hive_service/ThriftHive.php';
    require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TSocket.php';
    require_once $GLOBALS['THRIFT_ROOT'] . '/protocol/TBinaryProtocol.php';

    require_once dirname(__FILE__) . '/ThriftHiveClientEx.php';

    $transport = new TSocket('localhost', 10001);
    $transport->setSendTimeout(30 * 1000);
    $transport->setRecvTimeout(30 * 1000);
    $client = new ThriftHiveClientEx(new TBinaryProtocol($transport));
    $client->open();

    print('open');
    //shell_exec('hive');
    $client->execute('SHOW DATABASES');
    print('database');
    var_dump($client->fetchAll());
    print('dump');
    $client->close();
    print('close');
ru9i0ody

ru9i0ody1#

在通过向我们的hive site.xml添加一行来关闭sasl身份验证之后,连接将成功。

相关问题