Created
April 19, 2013 09:06
-
-
Save maimai-swap/5419098 to your computer and use it in GitHub Desktop.
hbase-0.92.2にphp経由でアクセスするスクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $GLOBALS['THRIFT_ROOT'] = 'src/'; | |
| include 'gen-php/Hbase/Hbase_types.php'; | |
| include 'gen-php/Hbase/Hbase.php'; | |
| include 'src/transport/TSocket.php'; | |
| include 'src/transport/TBufferedTransport.php'; | |
| include 'src/protocol/TBinaryProtocol.php'; | |
| function hbase_test () | |
| { | |
| $server = '192.168.222.211'; // リモートでも接続出来ます。 | |
| $port = 9090; | |
| try { | |
| $socket = new TSocket ($server, $port); | |
| $transport = new TBufferedTransport ($socket); | |
| $protocol = new TBinaryProtocol ($transport); | |
| $client = new HbaseClient ($protocol); | |
| $transport->open (); | |
| $tables = $client->getTableNames (); | |
| var_dump ($tables); | |
| } catch (TException $e) { | |
| error_log ('TException'); | |
| error_log ($e); | |
| } catch (Exception $e) { | |
| error_log ('Exception'); | |
| error_log ($e); | |
| } | |
| } | |
| hbase_test (); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment