读取Webpage表中的内容
生活随笔
收集整理的這篇文章主要介紹了
读取Webpage表中的内容
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
??? nutch將從網頁中抓取到的信息放入hbase數據庫中,默認情況下表名為$crawlId_webpage,但表中的內容以16進制進行表示,直接scan或者通過Java API進行讀取均只能讀取到16進制信息。
??? 因此nutch提供了readdb選項進行數據獲取,將表中的內容讀取到一個文本中。
?具體用法為:
示例:
(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表中的内容的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 运行一个Hadoop Job所需要指定的
- 下一篇: 【JAVA编码专题】JAVA字符编码系列