hadoop1.0.0 ,hbase0.90.6,nutch2.1搭配方法,修订版

官方文档:http://wiki.apache.org/nutch/Nutch2Tutorial?action=show&redirect=GORA_HBase 

现在网上针对nutch 2.0 以上版本的部署内容很残缺。经过两天奋战,终于把nutch 2.1在hbase上部署成功了!在此与网友分享。 

准备两台机器: 
cr5(master):192.168.8.185,cr8(slave):192.168.8.188 
这两台机器必须保证相互的ssh是通的(具体可以问谷歌) 
修改两台机器的/etc/hostname文件 
Java代码   收藏代码
  1. cr5  
  2. 或者  
  3. cr8  

修改两台机器的/etc/hosts文件 
Java代码   收藏代码
  1. 192.168.8.185   cr5  
  2. 192.168.8.188   cr8  



我准备在cr5机上运行进程: 

Hadoop: NameNode, SecondaryNameNode, JobTracker 
Hbase: HMaster 

在cr8机上运行进程: 

Hadoop: DataNode, TaskTracker 
Hbase: HQuorumPeer, HRegionServer 

接下来我们开始部署hadoop和hbase 
官网上有很多hadoop和hbase的版本,并不是所有的版本都可以被nutch 2.1支持的。 

一、配置hadoop  
   1. wget 命令下载对应的hadoop版本.tar.gz 
   2. tar zxvf hadoop版本.tar.gz 解压hadoop 
   3. cd conf 下修改配置文件 
     a. hadoop-env.sh 
     
Java代码   收藏代码
  1. export JAVA_HOME=/opt/jdk1.6.0_21  
  2.         

     b. core-site.xml 
     
Java代码   收藏代码
  1. <?xml version="1.0"?>  
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>  
  3.   <!-- Put site-specific property overrides in this file. -->  
  4.   <configuration>  
  5.      <property>  
  6.          <name>fs.default.name</name>  
  7.          <value>hdfs://cr5:9000/</value>  
  8.      </property>  
  9.      <property>  
  10.          <name>hadoop.tmp.dir</name>  
  11.          <value>/home/kfs/ww/data/hadoop_tmp</value>  
  12.          <description>此处设置hadoop根目录</description>  
  13.      </property>  
  14.   </configuration>  

     c. hdfs-site.xml 
     
Java代码   收藏代码
  1. <?xml version="1.0"?>  
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>  
  3. <!-- Put site-specific property overrides in this file. -->  
  4.    <configuration>  
  5.       <property>  
  6.          <name>dfs.replication</name>  
  7.          <value>1</value>  
  8.          <description>副本个数</description>  
  9.       </property>  
  10.    </configuration>  

     d. mapred-site.xml 
    
Java代码   收藏代码
  1. <?xml version="1.0"?>  
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>  
  3. <!-- Put site-specific property overrides in this file. -->  
  4.   <configuration>  
  5.      <property>  
  6.           <name>mapred.job.tracker</name>  
  7.           <value>cr5:9001</value>  
  8.           <description>jobtracker 标识:端口号</description>  
  9.      </property>  
  10.   </configuration>  

     e. masters 
    
Java代码   收藏代码
  1. cr5  

     f. slaves 
    
Java代码   收藏代码
  1. cr8  


配置完成后,将cr5的hadoop 复制到 cr8下面 
在cr5 的hadoop/bin 下面运行 
./hadoop -namenode format 
./hadoop -datanode format 

然后启动hadoop 
./start-all.sh 

检查启动成功与否 
查看hadoop/logs下面的×.log日志确保没有异常 
然后通过 
http://localhost:50030 
http://localhost:50070 
来查看信息 

二、配置hbase  
   1. wget 命令下载对应的hbase版本.tar.gz 
   2. tar zxvf hbase版本.tar.gz 解压hadoop 
   3. cd conf 下修改配置文件 
     a. hbase-site.xml 
    
Java代码   收藏代码
  1. <configuration>  
  2.         <property>  
  3.                 <name>hbase.rootdir</name>  
  4.                 <value>hdfs://cr5:9000/hbase</value>  
  5.         </property>  
  6.   
  7.         <property>  
  8.                 <name>hbase.cluster.distributed</name>  
  9.                 <value>true</value>  
  10.         </property>  
  11.   
  12.         <property>  
  13.                 <name>hbase.zookeeper.quorum</name>  
  14.                 <value>cr8</value>  
  15.         </property>  
  16.   
  17.         <property>  
  18.                 <name>hbase.zookeeper.property.dataDir</name>  
  19.                 <value>/home/kfs/ww/data/zookeeper_data</value>  
  20.         </property>  
  21.   
  22.         <property>  
  23.                 <name>hbase.zookeeper.property.clientPort</name>  
  24.                 <value>2181</value>  
  25.         </property>  
  26.   
  27.         <property>  
  28.                 <name>hbase.tmp.dir</name>  
  29.                 <value>/home/kfs/ww/data/hbase_tmp</value>  
  30.         </property>  
  31. </configuration>  


      注意:这里的hdfs://cr5:9000/hbase和hadoop配置需对应  

     b. hadoop-env.sh 
     
Java代码   收藏代码
  1. export JAVA_HOME=/opt/jdk1.6.0_21  
  2. export HBASE_CLASSPATH=~/ww/hbase-0.90.6/conf  

     c. regionservers 
Java代码   收藏代码
  1. cr8  


hbase 配置完成 
当然还有后续的工作 
1. 删除hbase中的hadoop-core-版本。。。.jar,然后把hadoop中的hadoop-core-版本.jar,commons-configuration-1.6.jar和commons-collections-3.2.1.jar拷贝到hbase的lib中。 
否则hbase 的HMaster无法启动! 
2. 关闭防火墙 

到hbase/bin 下 通过 ./start-hbase.sh 启动hbase 
验证启动与否查看log是否有异常 
或者 http://localhost:60010查看具体信息 

三、nutch 配置  
部署到eclipse中就不加累述了,主要是配置~ 
   1. wget 命令下载对应的hadoop版本.tar.gz 
   2. tar zxvf hadoop版本.tar.gz 解压hadoop 
   3. cd conf 下修改配置文件 
      a. gora.properties 
Java代码   收藏代码
  1. gora.datastore.default=org.apache.gora.hbase.store.HBaseStore  

     b. nutch-site.xml 
Java代码   收藏代码
  1. <?xml version="1.0"?>  
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>  
  3.   
  4. <!-- Put site-specific property overrides in this file. -->  
  5.   
  6. <configuration>  
  7.     <property>  
  8.         <name>http.agent.name</name>  
  9.         <value>test-nutch</value>  
  10.     </property>  
  11.   
  12.     <property>  
  13.         <name>http.robots.agents</name>  
  14.         <value>test-nutch,*</value>  
  15.     </property>  
  16.   
  17.     <property>  
  18.         <name>http.agent.name.check</name>  
  19.         <value>true</value>  
  20.     </property>  
  21.   
  22.     <!-- property> <name>plugin.includes</name> <value>.*</value> <description>Enable   
  23.         all plugins during unit testing.</description> </property -->  
  24.   
  25.     <property>  
  26.         <name>distributed.search.test.port</name>  
  27.         <value>60000</value>  
  28.         <description>TCP port used during junit testing.</description>  
  29.     </property>  
  30.   
  31.     <property>  
  32.         <name>http.accept.language</name>  
  33.         <value>ja-jp, en-us,en-gb,en;q=0.7,*;q=0.3</value>  
  34.         <description>Value of the “Accept-Language” request header field.  
  35.             This  
  36.             allows selecting non-English language as default one to retrieve.  
  37.             It  
  38.             is a useful setting for search engines build for certain national  
  39.             group.  
  40.         </description>  
  41.     </property>  
  42.   
  43.     <property>  
  44.         <name>parser.character.encoding.default</name>  
  45.         <value>utf-8</value>  
  46.         <description>The character encoding to fall back to when no other  
  47.             information  
  48.             is available  
  49.         </description>  
  50.     </property>  
  51.   
  52.     <property>  
  53.         <name>storage.data.store.class</name>  
  54.         <value>org.apache.gora.hbase.store.HBaseStore</value>  
  55.         <description>The Gora DataStore class for storing and retrieving data.  
  56.             Currently the following stores are available: ….  
  57.         </description>  
  58.     </property>  
  59.       
  60.     <property>  
  61.         <name>hadoop.tmp.dir</name>  
  62.         <value>/home/kfs/ww/data/hadoop_tmp</value>  
  63.         <description>此处设置hadoop根目录</description>  
  64.     </property>  
  65.   
  66. </configuration>  

     c. nutch-site.xml 
Java代码   收藏代码
  1. <property>  
  2.   <name>plugin.folders</name>  
  3.   <value>./src/plugin</value>  
  4.   <description>Directories where nutch plugins are located.  Each  
  5.   element may be a relative or absolute path.  If absolute, it is used  
  6.   as is.  If relative, it is searched for on the classpath.</description>  
  7. </property>  

     d. hbase-site.xml 
Java代码   收藏代码
  1. <?xml version="1.0"?>  
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>  
  3.   
  4. <configuration>  
  5.   
  6.     <property>  
  7.         <name>hbase.master</name>  
  8.         <value>cr5:60000</value>  
  9.     </property>  
  10.   
  11.     <property>  
  12.         <name>hbase.zookeeper.quorum</name>  
  13.         <value>cr8</value>  
  14.     </property>  
  15.   
  16.     <property>  
  17.         <name>hbase.zookeeper.property.clientPort</name>  
  18.         <value>2181</value>  
  19.     </property>  
  20.   
  21. </configuration>  

     e. ivy.xml 
Java代码   收藏代码
  1. <dependency org="org.apache.gora" name="gora-hbase" rev="0.2.1" conf="*->default" />  

     f. 新建urls文件夹,然后再文件夹中创建seed.txt ,在seed.txt中写入需要抓取的链接 
     g. regex-urlfilter.txt 加入抓取条件正则 

配置完成,后续工作 
nutch中的hbase-版本.jar需和部署的hbase的版本统一 

运行nutch 
配置Arguments信息 
1. Proguam arguments 
Java代码   收藏代码
  1. urls -depth 3 topN 5  
  2. 这里的urls就是nutch配置中生成的url种子文件夹  


2. VM arguments 
Java代码   收藏代码
  1. -Xms256m -Xmx512m -Dhadoop.log.dir=logs -Dhadoop.log.file=hadoop.log  


大功告成~~~ 


四、运行过程中异常处理  
1. point org.apache.nutch.net.URLNormalizer not found.请参见 http://youkimra.iteye.com/blog/1039903  

2. ERROR org.apache.hadoop.mapred.TaskTracker: Can not start task tracker because java.io.IOException: Failed to set permissions of path: \tmp\hadoop-admin\mapred\local\ttprivate to 0700 
请参见: http://download.csdn.net/detail/java2000_wl/4326323  

3. nutch 中有一些plugin 的类缺少包,遇到问题补全包即可 


转载请注明来自: http://wangwei3.iteye.com/blog/1818599
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值