当前位置: 首页 > news >正文

想自己做点飘纱素材到网站上买网站如何提升seo排名

想自己做点飘纱素材到网站上买,网站如何提升seo排名,dw网站制作效果怎么做,可以自己做网站的网址一、目的 把hbase中某张表的数据导出到hdfs上一份。 实现方式这里介绍两种:一种是自己写mr程序来完成,一种是使用hbase提供的类来完成。 二、自定义mr程序将hbase数据导出到hdfs上 2.1首先看看hbase中t1表中的数据: 2.2mr的代码如下&#xff…

一、目的

把hbase中某张表的数据导出到hdfs上一份。

实现方式这里介绍两种:一种是自己写mr程序来完成,一种是使用hbase提供的类来完成。

二、自定义mr程序将hbase数据导出到hdfs上

2.1首先看看hbase中t1表中的数据:

2.2mr的代码如下:

比较重要的语句是

job.setNumReduceTasks(0);//为什么要设置reduce的数量是0呢?读者可以自己考虑下
TableMapReduceUtil.initTableMapperJob(args[0], new Scan(),HBaseToHdfsMapper.class ,Text.class, Text.class, job);//这行语句指定了mr的输入是hbase的哪张表,scan可以对这个表进行filter操作。

public class HBaseToHdfs {public static void main(String[] args) throws Exception {Configuration conf = HBaseConfiguration.create();Job job = Job.getInstance(conf, HBaseToHdfs.class.getSimpleName());job.setJarByClass(HBaseToHdfs.class);job.setMapperClass(HBaseToHdfsMapper.class);job.setMapOutputKeyClass(Text.class);job.setMapOutputValueClass(Text.class);job.setNumReduceTasks(0);TableMapReduceUtil.initTableMapperJob(args[0], new Scan(),HBaseToHdfsMapper.class ,Text.class, Text.class, job);//TableMapReduceUtil.addDependencyJars(job);job.setOutputFormatClass(TextOutputFormat.class);FileOutputFormat.setOutputPath(job, new Path(args[1]));job.waitForCompletion(true);}public static class HBaseToHdfsMapper extends TableMapper<Text, Text> {private Text outKey = new Text();private Text outValue = new Text();@Overrideprotected void map(ImmutableBytesWritable key, Result value, Context context) throws IOException, InterruptedException {//key在这里就是hbase的rowkeybyte[] name = null;byte[] age = null;byte[] gender = null;byte[] birthday = null;try {name = value.getColumnLatestCell("f1".getBytes(), "name".getBytes()).getValue();} catch (Exception e) {}try {age = value.getColumnLatestCell("f1".getBytes(), "age".getBytes()).getValue();} catch (Exception e) {}try {gender = value.getColumnLatestCell("f1".getBytes(), "gender".getBytes()).getValue();} catch (Exception e) {}try {birthday = value.getColumnLatestCell("f1".getBytes(), "birthday".getBytes()).getValue();} catch (Exception e) {}outKey.set(key.get());String temp = ((name==null || name.length==0)?"NULL":new String(name)) + "\t" + ((age==null || age.length==0)?"NULL":new String(age)) + "\t" + ((gender==null||gender.length==0)?"NULL":new String(gender)) + "\t" +  ((birthday==null||birthday.length==0)?"NULL":new String(birthday));System.out.println(temp);outValue.set(temp);context.write(outKey, outValue);}}
}

2.3打包执行

hadoop jar hbaseToDfs.jar com.lanyun.hadoop2.HBaseToHdfs t1 /t1

2.4查看hdfs上的文件

(my_python_env)[root@hadoop26 ~]# hadoop fs -cat /t1/part*
1    zhangsan    10    male    NULL
2    lisi    NULL    NULL    NULL
3    wangwu    NULL    NULL    NULL
4    zhaoliu    NULL    NULL    1993

至此,导出成功

三、使用hbase自带的工具进行导出

hbase自带的工具是:org.apache.hadoop.hbase.mapreduce.Export
3.1如何使用这个工具呢?查看帮助信息

(my_python_env)[root@hadoop26 ~]# hbase org.apache.hadoop.hbase.mapreduce.Export
ERROR: Wrong number of arguments: 0
Usage: Export [-D <property=value>]* <tablename> <outputdir> [<versions> [<starttime> [<endtime>]] [^[regex pattern] or [Prefix] to filter]]

3.2使用工具来导出

hbase org.apache.hadoop.hbase.mapreduce.Export t1 /t2

至此已经完成导出。

转载于:https://www.cnblogs.com/dongdone/p/5687786.html

http://www.lbrq.cn/news/2613853.html

相关文章:

  • 网页设计与网站建设 设计题100个常用的关键词
  • 这个百度的网站怎么做的成都新一轮疫情
  • 临朐网站制作哪家好semantic scholar
  • 广州建设银行网站首页2022年免费云服务器
  • 福建电信网站备案长春网站seo公司
  • 网站后台链接怎么做高州新闻 头条 今天
  • d?t网站模版温州seo网站建设
  • wordpress没有备案seo优化网络公司
  • erp软件怎么用搜索引擎优化培训中心
  • 网站备案 停站免费html网站模板
  • 威县网站建设无锡网站制作优化
  • 广州中小学安全教育平台企业整站优化
  • 视频源网站怎么做优化方案的格式及范文
  • 做视频网站seo怎么赚钱
  • wordpress发号系统巢湖seo推广
  • 做ui必要的网站最新最好的磁力搜索
  • 汕头模板建站软件网站seo优化报告
  • 内蒙古住房建设厅网站百度问一问人工客服怎么联系
  • 西安网站建设网络网站域名查询地址
  • 哪类型网站容易做找网络公司做推广费用
  • 重庆永川网站建设价格网站策划方案
  • 怎样重新运行wordpress四川seo推广公司
  • 工程建设信息官方网站做app找什么公司
  • 尤溪网站开发seo交流qq群
  • 如何做网站平台关注站长之家域名查询官网
  • 搜狗网站入口百度seo发包工具
  • 2个网站 同意内容 百度优化百度seo排名公司
  • net做网站杭州seo网站建设靠谱
  • .net和php哪个做网站好网络营销的主要手段
  • 做企业网站前期需要准备什么网络推广宣传方式
  • Unity 调节 Rigidbody2D 响应速度的解决方案【资料】
  • 大模型后训练——Online-RL基础
  • 完整的登陆学生管理系统(配置数据库)
  • 批量提问程序开发方案:基于Python的百度文小言接口实现
  • 笔试——Day30
  • 开疆智能ModbusTCP转Profinet网关连接EPSON机器人配置案例