hbase倒序查詢 php操作hbase

2021-10-20 11:53:39 字數 1244 閱讀 9383

這裡將介紹php如何使用thrift進行操作php。

這裡僅測試scan方式,其他方法類似,可自行檢視(thbaseservice.php/get、put、scan等方法的使用)

require_once('hbase/thbaseservice.php');

require_once('hbase/types.php');

$host = '192.168.1.244';

$port = '9090';

$socket = new tsocket($host, $port);

$socket->setsendtimeout(5000);

$socket->setrecvtimeout(10000);

$this->transport = new tbufferedtransport($socket);

$protocol = new tbinaryprotocol($this->transport);

$this->client = new thbaseserviceclient($protocol);

$this->transport->open()

//上面的**幾乎固定, 只需要修改thrift2的host和port

/*倒序查詢user表從1-100行,中的第一行中族f1中的name列值*/

$table = 'user'; //你需要查的表名 $limit = 1; //限制多少輸出

$start_row = '1'; //從第幾行開始查 $stop_row = '100'; //結束行

$column_arr['family'] = 'f1' ; //表中哪個族

$column_arr['qualifier'] = 'name'; //哪一列

$column_1 = new tcolumn($column_arr);

$scan_val = array(

'startrow' =>$stop_row,

'stoprow' => $start_row,

'columns' => $column_1 ,

'reversed' => true

$scan = new tscan($scan_val);

$ret = $this->client->getscannerresults($table, $scan, $limit);

//記得關閉

$this->transport->close();

var_dump($ret);

hbase倒序查詢 HBase 命令列工具

根據官方的解釋 apache hbase shell 是 j ruby 下的 irb interactive ruby shell 任何在 irb 下的命令,在 hbase shell 下都可以使用。可以在啟動 hbase 之後,通過 bin hbase shell 來進入 hbase shell。...

qt sql 查詢 正序,倒序

qstring str qstring select date,time,people,event from tb log where people 1 order by date desc limit 0,2000 arg 模式 order by time desc qsqlquery query...

php字串倒序

近期在寫校內網的ftp搜尋引擎,由於對中文字串進行分詞,我採用了正逆結合的方法,需要對中文字串進行倒序。上網找了一下,看了都差不多,都是需要進行迴圈,我不是很喜歡。於是看了一下手冊,發現幾個函可以用 str split 函式把字串分割到陣列中。array reverse 接受陣列 array 作為輸...