Hadoop单节点安装(1)本地模式
参考文章:http://hadoop.apache.org/docs/r2.7.4/hadoop-project-dist/hadoop-common/SingleCluster.html
修改/etc/hosts
[root@hadoop hadoop-2.7.4]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc pfifo_fast state UP qlen 1000
link/ether fa:16:3e:ac:0b:18 brd ff:ff:ff:ff:ff:ff
inet 1.1.1.37/24 brd 1.1.1.255 scope global dynamic eth0
valid_lft 84757sec preferred_lft 84757sec
inet6 fe80::f816:3eff:feac:b18/64 scope link
valid_lft forever preferred_lft forever
[root@hadoop hadoop-2.7.4]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
1.1.1.37 hadoop
解压jdk和hadoop压缩文件到相应目录
mkidr /usr/jdk64/
tar xzvf ~/jdk-8u144-linux-x64.tar.gz -C /usr/jdk64/
mkdir /usr/hadoop
tar xzvf ~/hadoop-2.7.4.tar.gz -C /usr/hadoop
最后一行添加
export JAVA_HOME=/usr/jdk64/jdk1.8.0_144/
验证,单机运行
[root@hadoop hadoop-2.7.4]# mkdir input
[root@hadoop hadoop-2.7.4]# cp etc/hadoop/*.xml input/
[root@hadoop hadoop-2.7.4]# bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.4.jar grep input output 'dfs[a-z.]+'
......省略一堆输出
[root@hadoop hadoop-2.7.4]# cat output/*
1 dfsadmin