b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

c语言清空文件中数据 HBase的协处理器开发编码实例(6)

电脑杂谈  发布时间:2018-01-09 17:07:34  来源:网络整理

// 获得返回值

Map《byte〔〕, Long》 result = table.coprocessorService(SumService.class, null, null,

new Batch.Call《SumService, Long》() {

@Override

public Long call(SumService service) throws IOException {

BlockingRpcCallback《SumResponse》 rpcCallback = new BlockingRpcCallback《SumResponse》();

service.getSum(null, request, rpcCallback);

SumResponse response = (SumResponse) rpcCallback.get();

return response.hasSum() ? response.getSum() : 0L;

}

});

// 将返回值进行迭代相加

for (Long v : result.values()) {

sum += v;

}

// 结果输出

System.out.println(“sum: ” + sum);

// 关闭资源

table.close();

conn.close();

}

}

4.3 加载Endpoint

// 将Sum类和SumEndPoint类打包后上传到HDFS

$ hadoopfs -put endpoint_sum.jar /input

// 修改hbase配置文件,添加配置

$ vimapp/hbase-1.2.0-cdh5.7.1/conf/hbase-site.xml

〔html〕 view plain copy《property》

《name》hbase.table.sanity.checks《/name》

《value》false《/value》

《/property》

// 重启hbase

$stop-hbase.sh

$start-hbase.sh

// 启动hbase shell

$hbase shell

// 创建表sum_table

》 create‘sum_table’,‘info’

// 插入测试数据

》 put‘sum_table’,‘rowkey01’,‘info:score’,‘95’

》 put‘sum_table’,‘rowkey02’,‘info:score’,‘98’

》 put‘sum_table’,‘rowkey02’,‘info:age’,‘20’

// 查看数据

》 scan‘sum_table’

HBase的协处理器开发编码实例

c语言保存数据到文件_c语言清空文件中数据_c语言输出100以内素数

// 加载协处理器

》disable ‘sum_table’

》 alter‘sum_table’,METHOD =》‘table_att’,‘coprocessor’ =》‘hdfs://localhost:9000/input/endpoint_sum.jar|com.hbase.demo.endpoint.SumEndPoint|100’


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-59353-6.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    • 小日向早苗
      小日向早苗

      怎么证明蛆是在袋子里出来

    • 僧儿
      僧儿

      别会错意他在说滚滚滚

    热点图片
    拼命载入中...