Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/hadoop/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
配置单元服务器2的PHP thrift客户端挂起_Php_Hadoop_Hive_Thrift - Fatal编程技术网

配置单元服务器2的PHP thrift客户端挂起

配置单元服务器2的PHP thrift客户端挂起,php,hadoop,hive,thrift,Php,Hadoop,Hive,Thrift,按照标准示例,我试图使用PHP中的0.12 Thrift Server连接到Hive Server 2,但每次使用$client->execute()发送查询时,它都会挂起 下面是test.php的php代码(域名是为了匿名而编辑的): <?php $GLOBALS['THRIFT_ROOT'] = '/hadoop/libraries/php-thrift-sql/php'; require_once $GLOBALS['THRIFT_ROOT'] . '/TException.php'

按照标准示例,我试图使用PHP中的0.12 Thrift Server连接到Hive Server 2,但每次使用$client->execute()发送查询时,它都会挂起

下面是test.php的php代码(域名是为了匿名而编辑的):

<?php
$GLOBALS['THRIFT_ROOT'] = '/hadoop/libraries/php-thrift-sql/php';
require_once $GLOBALS['THRIFT_ROOT'] . '/TException.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/packages/fb303/FacebookService.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/packages/hive_metastore/metastore/ThriftHiveMetastore.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/packages/hive_service/ThriftHive.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TSocket.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/protocol/TProtocol.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/protocol/TBinaryProtocol.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/../src/Thrift/Type/TType.php';
require_once dirname(__FILE__) . '/ThriftHiveClientEx.php';

$transport = new TSocket('xxxx.com', 10000);
$transport->setSendTimeout(600 * 1000);
$transport->setRecvTimeout(600 * 1000);
$client = new ThriftHiveClientEx(new TBinaryProtocol($transport));
$client->open();
$client->execute('SHOW DATABASES');
var_dump($client->fetchAll());
$client->close();
一段时间后(请参阅上面test.php中的接收超时设置),它会超时

poll([{fd=3, events=POLLIN|POLLERR|POLLHUP}], 1, 600000) = 1 ([{fd=3, revents=POLLIN}])
recvfrom(3, "", 8192, MSG_DONTWAIT, NULL, NULL) = 0
munmap(0x2af661ac2000, 266240)          = 0
munmap(0x2af661b44000, 266240)          = 0
close(2)                                = 0
...

我们也遇到了同样的问题,我发现了这个补丁,Thrift中的问题仍然存在: 在您的案例中,看起来像revents=POLLIN,与上面的问题不同。我们也是如此。当我们执行“lsof-”时,fd处于关闭等待状态。(即Thrift服务器正在关闭连接)

poll([{fd=3, events=POLLIN|POLLERR|POLLHUP}], 1, 600000) = 1 ([{fd=3, revents=POLLIN}])
recvfrom(3, "", 8192, MSG_DONTWAIT, NULL, NULL) = 0
munmap(0x2af661ac2000, 266240)          = 0
munmap(0x2af661b44000, 266240)          = 0
close(2)                                = 0
...