运行此代码时,卡在 $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');
1条答案
按热度按时间ru9i0ody1#
在通过向我们的hive site.xml添加一行来关闭sasl身份验证之后,连接将成功。