在运行此代码时,卡在$client->execute('SHOW DATABASES');
行上。图书馆位于正确的目录中但不知何故我们无法进行查询
<?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');
答案 0 :(得分:1)
通过添加我们的hive-site.xml行来关闭SASL身份验证后,连接将成功。