nutch将从网页中抓取到的信息放入hbase数据库中,默认情况下表名为$crawlId_webpage,但表中的内容以16进制进行表示,直接scan或者通过Java API进行读取均只能读取到16进制信息。

    因此nutch提供了readdb选项进行数据获取,将表中的内容读取到一个文本中。



 具体用法为:

$ bin/nutch readdb
Usage: WebTableReader (-stats | -url [url] | -dump <out_dir> [-regex regex])
[-crawlId <id>] [-content] [-headers] [-links] [-text]
-crawlId <id> - the id to prefix the schemas to operate on,
(default: storage.crawl.id)
-stats [-sort] - print overall statistics to System.out
[-sort] - list status sorted by host
-url <url> - print information on <url> to System.out
-dump <out_dir> [-regex regex] - dump the webtable to a text file in
<out_dir>
-content - dump also raw content
-headers - dump protocol headers
-links - dump links
-text - dump extracted text
[-regex] - filter on the URL of the webtable entry

示例:

(1)seed.txt的内容为:

http://www.163.com



(2)执行以下命令进行inject操作

 bin/nutch inject seed.txt -crawlId test001



(3)scan表中内容,发现无意义

hbase(main):002:0> scan 'test001_webpage'
ROW COLUMN+CELL
com.163.money:http/ column=f:fi, timestamp=1423550107073, value=\x00'\x8D\x00
com.163.money:http/ column=f:ts, timestamp=1423550107073, value=\x00\x00\x01Kr2\xC7\xD6
com.163.money:http/ column=mk:_injmrk_, timestamp=1423550107073, value=y
com.163.money:http/ column=mk:dist, timestamp=1423550107073, value=0
com.163.money:http/ column=mtdt:_csh_, timestamp=1423550107073, value=?\x80\x00\x00
com.163.money:http/ column=s:s, timestamp=1423550107073, value=?\x80\x00\x00
1 row(s) in 0.4090 seconds

(4)将表中内容读取到/mnt/jediael/2

bin/nutch readdb  -dump /mnt/jediael/2  -crawlId test001 -content 

(5)查看/mnt/jediael/2中的内容

$ ll
total 4
-rwxrwxrwx. 1 jediael jediael 344 Feb 10 14:41 part-r-00000
-rwxrwxrwx. 1 jediael jediael 0 Feb 10 14:41 _SUCCESS
$ cat part-r-00000
http://money.163.com/ key: com.163.money:http/
baseUrl: null
status: 0 (null)
fetchTime: 1423550105558
prevFetchTime: 0
fetchInterval: 2592000
retriesSinceFetch: 0
modifiedTime: 0
prevModifiedTime: 0
protocolStatus: (null)
parseStatus: (null)
title: null
score: 1.0
marker _injmrk_ : y
marker dist : 0
reprUrl: null
metadata _csh_ : ?锟

读取Webpage表中的内容的更多相关文章

  1. 读取Webpage表中的内容 分类: H3_NUTCH 2015-02-10 14:59 418人阅读 评论(0) 收藏

    nutch将从网页中抓取到的信息放入hbase数据库中,默认情况下表名为$crawlId_webpage,但表中的内容以16进制进行表示,直接scan或者通过Java API进行读取均只能读取到16进 ...

  2. 一百一十五、脱离SAP本体,通过ActiveX读取SAP表中数据

    一.Sap自带有客户端,但是非常之臃肿卡顿,可以利用ActiveX的方式,脱离Sap本体,来读取Sap表中的内容进行插入等操作,非常之方便.代码如下: 二.界面如下,输入好相关内容,点击登录,提示登录 ...

  3. Python xlrd模块读取Excel表中的数据

    1.xlrd库的安装 直接使用pip工具进行安装(当然也可以使用pycharmIDE进行安装,这里就不详述了) pip install xlrd 2.xlrd模块的一些常用命令 ①打开excel文件并 ...

  4. 读取数据表中第m条到第n条的数据,SQL语句怎么写?

    原文:读取数据表中第m条到第n条的数据,SQL语句怎么写? 对于MySQL或者Oracle来说,如果实现从Table 表中取出第 m 条到第 n 条的记录操作,我们需要TOP函数(不是所有的数据库都支 ...

  5. Flex读取txt文件中的内容(三)

    Flex读取txt文件中的内容 1.设计源码 LoadTxt.mxml: <?xml version="1.0" encoding="utf-8"?> ...

  6. Flex读取txt文件中的内容(二)

    Flex读取txt文件中的内容 自动生成的文件 LoadTxt-app.xml: <?xml version="1.0" encoding="utf-8" ...

  7. Flex读取txt文件中的内容(一)

    Flex读取txt文件中的内容 phone.txt: 13000003847 13000003848 13000003849 13000003850 13000003851 13000003852 1 ...

  8. Flex读取txt文件中的内容报错

    Flex读取txt文件中的内容 1.具体错误如下 2.错误原因 读取文件不存在 var file:File = new File(File.applicationDirectory.nativePat ...

  9. Hibernate查询之SQL查询,查询结果用new新对象的方式接受,hql查询,通过SQL查询的结果返回到一个实体中,查询不同表中内容,并将查到的不同表中的内容放到List中

     package com.ucap.netcheck.dao.impl; import java.util.ArrayList;import java.util.List; import org. ...

随机推荐

  1. 无法更新 EntitySet“Ips_Articles”,因为它有一个 DefiningQuery,而 <ModificationFunctionMapping> 元素中没有支持当前操作的 <InsertFunction> 元素。

    今天我在使用ef的时候,发现了这样的报错. 无法更新 EntitySet“Ips_Articles”,因为它有一个 DefiningQuery,而 <ModificationFunctionMa ...

  2. php 之 类,对象

    --恢复内容结束--- 一.类和对象: 1.定义: 对象:我们所见到的东西都可以称之为对象,是类实例化出来的东西 类:是对所有的同类对象抽象出来的东西 eg: 在一张表中记录了全班同学的学号,姓名,性 ...

  3. mysql foreign key 外键

    ALTER TABLE `fd_rel_customer_doctor` ADD CONSTRAINT `FK_fd_rel_customer_doctor_1` FOREIGN KEY (`CUST ...

  4. quartz spring

    简单例子可参考 http://yangpanwww.iteye.com/blog/797563 http://liuzidong.iteye.com/blog/1118992 关于时间配置可参考另一篇 ...

  5. MySQL锁等待分析【2】

    MySQL锁等待分析[1]中对锁等待的分析是一步一步来的.虽然最后是分析出来了,可是用时是比较长的:理清各个表之间的关系后,得到如下SQL语句,方便以后使用 select block_trx.trx_ ...

  6. Ubuntu 14.04 标题栏实时显示上下行网速、CPU及内存使用情况

    首先当然是用wget下载indicator-sysmonitor,终端执行命令:wget -c https://launchpad.net/indicator-sysmonitor/trunk/4.0 ...

  7. Android surfaceview详解

    周末看<精通Android游戏开发>(Pro Android Games),里面讲到游戏的框架,其中一个重要的概念surfaceview,觉得不是很理解,于是花了一点时间研究了下,写下自己 ...

  8. C#中使用命名管道进行进程通信的实例

    原文:C#中使用命名管道进行进程通信的实例 1 新建解决方案NamedPipeExample 在解决方案下面新建两个项目:Client和Server,两者的输出类型均为"Windows 应用 ...

  9. BZOJ2751: [HAOI2012]容易题(easy)

    2751: [HAOI2012]容易题(easy) Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 872  Solved: 377[Submit][S ...

  10. bzoj1148

    题目:http://www.lydsy.com/JudgeOnline/problem.php?id=1148 很常见的排序贪心题...... 假设我们得到了一个最优序列,记s[n]=w[1]+w[2 ...