脚本宝典收集整理的这篇文章主要介绍了php – 如何清除hbase中的表?,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我的表结构是:
$mutations = array( new Mutation( array( 'column' => 'username:1','value' =>$name ) ),new Mutation( array( 'column' => 'email:1','value' =>$email ) ) ); $hbase->mutateRow("user",$key,$mutations);
有人能帮我吗?
实际上,再次禁用,删除和创建表大约需要4秒钟.
// get Hbase client $client = <Your code here>; $t = "table_name"; $tables = $client->getTablenames(); if (in_array($t,$tables)) { if ($client->isTableEnabled($t)) $client->disableTable($t); $client->deleteTable($t); } $descriptors = array( new ColumnDescriptor(array("name" => "c1","maxVersions" => 1)),new ColumnDescriptor(array("name" => "c2","maxVersions" => 1)) ); $client->createTable($t,$descriptors);
如果表中没有大量数据 – 扫描所有行并删除每个行的速度要快得多.
$client = <Your code here>; $t = "table_name"; // i don't remember,if list of column families is actually needed here $columns = array("c1","c2"); $scanner = $client->scannerOPEn($t,"",$columns); while ($result = $client->scannerGet($scanner)) { $client->deleteallRow($t,$result[0]->row); }
以上是脚本宝典为你收集整理的php – 如何清除hbase中的表?全部内容,希望文章能够帮你解决php – 如何清除hbase中的表?所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。