按照这篇文章
http://nousefor.net/55/2011/12/php/hbase-and-hive-thrift-php-client/
我下载了 HBase 和 Thrift php 客户端包并将它们放在我的 ubuntu 机器上的 var/www/thrift/ 目录中,并编写了这个简单的客户端代码来打开连接并显示数据库中的表。但服务器不断返回错误消息“连接超时 [110]”。有任何想法吗..??当在服务器(Amazon EC2)上运行时,代码也可以正常执行$transport = new TSocket('localhost', 10001);
<?php
require_once('thrift/src/Thrift.php' );
require_once('thrift/src/transport/TSocket.php' );
require_once('thrift/src/transport/TBufferedTransport.php' );
require_once('thrift/src/protocol/TBinaryProtocol.php' );
require_once ('thrift/ThriftHive.php');
//open connection
$transport = new TSocket('107.xx.xx.101', 10001);
$protocol = new TBinaryProtocol($transport);
$client = new ThriftHiveClient($protocol);
try{
$transport->open();
}
catch(Exception $ex)
{
echo $ex->getMessage();
}
//show tables
$client->execute('SHOW TABLES');
$tables = $client->fetchAll();
foreach ($tables as $name){
echo( " found: {$name}\n" );
}
?>