nutch2.0的分布式环境依赖Hadoop-0.20.2和hbase-0.90.*。
测试做在两台机器上,A(master):192.168.20.215,B(slave):192.168.20.214
目的是在A机上运行进程:
Hadoop: NameNode, SecondaryNameNode, JobTracker
Hbase: HMaster
在B机上运行进程:
Hadoop: DataNode, TaskTracker
Hbase: HQuorumPeer, HRegionServer
然后可以在此环境下运行nutch,OK,步骤如下:

1。配置hosts文件
A机和B机的/etc/hosts内容都如下:
127.0.0.1  localhost.localdomain  localhost
192.168.20.215  SYE
192.168.20.214  UBT

2。配置hadoop
A机的配置:
1》hadoop-env.sh
export JAVA_HOME=/opt/jdk1.6.0_21
2》core-site.xml

  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.  
  8.    <property> 
  9.        <name>fs.default.name</name> 
  10.        <value>hdfs://SYE:8020</value> 
  11.    </property> 
  12.  
  13.    <property> 
  14.        <name>hadoop.tmp.dir</name>   
  15.      
  16.        <value>/home/sychen/nutch/hadoop-0.20.2/hdfs_root</value>   
  17.        <description>A base for other temporary directories. 
  18.  
  19.        此处设为你自己想要的Hadoop根目录</description>   
  20.    </property> 
  21. </configuration> 
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<!-- Put site-specific property overrides in this file. -->

<configuration>

   <property>
       <name>fs.default.name</name>
       <value>hdfs://SYE:8020</value>
   </property>

   <property>
       <name>hadoop.tmp.dir</name>  
   
       <value>/home/sychen/nutch/hadoop-0.20.2/hdfs_root</value>  
       <description>A base for other temporary directories.

       此处设为你自己想要的Hadoop根目录</description>  
   </property>
</configuration>


3》hdfs-site.xml

  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>dfs.replication</name> 
  9.        <value>1</value> 
  10.        <description>副本个数,不配置默认是 3,应小于 datanode 机器数量</description> 
  11.    </property> 
  12.  
  13. </configuration> 
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<!-- Put site-specific property overrides in this file. -->

<configuration>
   <property>
       <name>dfs.replication</name>
       <value>1</value>
       <description>副本个数,不配置默认是 3,应小于 datanode 机器数量</description>
   </property>

</configuration>


4》mapred-site.xml

  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.  
  8.    <property> 
  9.        <name>mapred.job.tracker</name> 
  10.        <value>SYE:8000</value> 
  11.        <description>jobtracker 标识:端口号,不是 URI</description> 
  12.    </property> 
  13.  
  14.  
  15. </configuration> 
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<!-- Put site-specific property overrides in this file. -->

<configuration>

   <property>
       <name>mapred.job.tracker</name>
       <value>SYE:8000</value>
       <description>jobtracker 标识:端口号,不是 URI</description>
   </property>


</configuration>

5》masters

SYE

6》slaves

UBT 

配置完毕后将这些配置文件复制到B机的相应目录中。或者如果B机中还没有Hadoop,可以将整个Hadoop复制过去。