Created
November 9, 2017 10:46
-
-
Save yujuwon/078ea9ee58467706c57af836905fb287 to your computer and use it in GitHub Desktop.
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
| public static void main(String[] args) throws Exception { | |
| Configuration hconf = HBaseConfiguration.create(); | |
| hconf.set("hbase.rootdir", "hbase root 경로"); | |
| hconf.set("hbase.zookeeper.quorum", "hbase zookeeper 주소"); | |
| hconf.set("hbase.zookeeper.property.clientPort", "zookeeper port"); | |
| HBaseAdmin ha = new HBaseAdmin(hconf); | |
| for (int i = 0; i < ha.listTableNames().length; i++){ | |
| System.out.println(ha.listTableNames()[i]); | |
| } | |
| HTable hTable = new HTable(conf, "테이블명"); | |
| Scan s = new Scan(); | |
| ResultScanner rs = hTable.getScanner(s); | |
| for(Result r: rs){ | |
| for (KeyValue kv : r.raw()){ | |
| System.out.println("row : " + new String(kv.getRow())); | |
| System.out.println("family : " + new String(kv.getFamily())); | |
| System.out.println("qualifier : " + new String(kv.getQualifier())); | |
| System.out.println("value : " + new String(kv.getValue())); | |
| } | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment