doulan0297 2016-07-11 08:06
浏览 72
已采纳

使用php thrift的Hive查询不起作用

While running this code, stuck on $client->execute('SHOW DATABASES'); line.Libraries are on the proper directory but somehow we couldn't make query

 <?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');
  • 写回答

1条回答 默认 最新

  • drc4925 2016-12-24 09:54
    关注

    After closing SASL Authentication by adding a row our hive-site.xml,connection will be successful.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?