我在hadoop中有一些已爬网的数据。我已将数据从hbase表导出到配置单元表。。所以现在我必须通过html、php等访问它的表,这样我才能在网上显示它。他们有什么教程或工具可用吗?请彻底指导我。我的最终目标是从蜂箱表中搜索一些网络记录。
您可以将Hive与PHP连接以在网页中显示数据。为此,您需要使用ThrifSQL.phar.
参考以下代码
<html>
<body>
<?php
// Load this lib
require_once __DIR__ . '/ThriftSQL.phar';
// Try out a Hive query
$hive = new 'ThriftSQL'Hive( 'localhost', 10000, 'user', 'pass' );
$hql = "SELECT * from default.phpexample";
$client = $hive
->connect()
->setSasl(false)
->queryAndFetchAll($hql);
print_r($client);
echo "<table>
<tr>
<th>site_name</th>
<th>price</th>
</tr>";
foreach ($client as $row) {
echo "<tr>'n";
foreach ($row as $field) {
echo "<td>$field</td>";
}
echo "</tr>'n";
}
echo "</table>'n";
$hive->disconnect();
?>
</body>
</html>
请参阅https://github.com/Automattic/php-thrift-sql/blob/master/example.php