サンプルコード
@Grab(group='org.apache.hbase', module='hbase-client', version='0.98.5-hadoop2') @Grab(group='org.apache.hbase', module='hbase-common', version='0.98.5-hadoop2') @Grab(group='org.apache.hadoop', module='hadoop-client', version='2.5.0') import org.apache.hadoop.hbase.* import org.apache.hadoop.hbase.client.* def config = HBaseConfiguration.create() config.set(HConstants.ZOOKEEPER_QUORUM, "localhost") config.set(HConstants.ZOOKEEPER_CLIENT_PORT, "2181") def conn = HConnectionManager.createConnection(config) conn.withCloseable { for(tname in conn.listTableNames()){ println tname.nameAsString } }動作環境
groovy 2.3.6, JDK 7 Update 65, Hadoop 2.5.0, zookeeper 3.4.6, HBase0.98.5
0 件のコメント:
コメントを投稿