-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.php
40 lines (26 loc) · 916 Bytes
/
demo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
$hbaseConf = new HBaseNativeClient\Config();
$hbaseConf->set(HBaseNativeClient\Config::HBASE_ZOOKEEPER_QUORUM, "localhost");
$hbaseConf->set(HBaseNativeClient\Config::HBASE_ZOOKEEPER_CLIENT_PORT, "2181");
//$hbaseConf->set(HBaseNativeClient\Config::HBASE_ZOOKEEPER_ZNODE_PARENT, "/hbase-unsecure");
$hbaseClient = new HBaseNativeClient\Client($hbaseConf);
$hbaseClient->table("world:country");
$scan = new HBaseNativeClient\Scan();
$scan->setCaching(2);
$scan->setStartRow("0");
$scanner = $hbaseClient->openScanner($scan);
echo "Scan results \n";
echo "------------ \n";
do {
$res = $scanner->getList();
foreach ($res as $rowKey => $row) {
echo $rowKey, PHP_EOL;
}
} while (!empty($res));
$scanner->close();
echo "------------ \n";
echo "Get 'russia' results \n";
echo "------------ \n";
print_r($hbaseClient->get(['russia']));
echo "------------ \n";
$hbaseClient->close();