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
- <?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>
<?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
- <?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>
<?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
- <?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>
<?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复制过去。