Hadoop可以在单节点上以伪分布模式运行,用不同的Java进程模拟分布式运行中的各类节点。
1、安装Hadoop
确保系统已安装好JDK和ssh。
1)在官网下载Hadoop: 我这里下载的是 hadoop-1.1.1-bin.tar.gz
2)下载后放到/softs目录下
3)将hadoop-1.1.1-bin.tar.gz解压到/usr目录
[root@localhost usr]# tar -zxvf /softs/hadoop-1.1.1-bin.tar.gz
[root@localhost usr]# ls
bin etc games hadoop-1.1.1 include java lib libexec local lost+found sbin share src tmp
[root@localhost usr]#
2、配置Hadoop
1)配置/usr/hadoop-1.1.1/conf/hadoop-env.sh文件,找到 export JAVA_HOME,修改为JDK的安装路径
export JAVA_HOME=/usr/java/jdk1.6.0_38
2)配置/usr/hadoop-1.1.1/conf/core-site.xml,内容如下:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="https://www.linuxidc.com/configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
3)配置/usr/hadoop-1.1.1/conf/hdfs-site.xml,内容如下:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="https://www.linuxidc.com/configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
4)配置/usr/hadoop-1.1.1/conf/mapred-site.xml,内容如下:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="https://www.linuxidc.com/configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:9001</value>
</property>
</configuration>