准备工作:
一、配置网络 —》远程连接
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:BE:B6:76
TYPE=Ethernet
UUID=49fcc01e-92b7-47e5-b7c0-1a617f7480d8
IPADDR=192.168.43.199
NETMASK=255.255.255.0
GATEWAY=192.168.43.1
DNS1=114.114.114.114
DNS2=8.8.8.8
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
接下来的步骤:
service network restart 重启网络
service network stop 关闭网络
service network start 启动网络
service iptables stop 关闭防火墙
service iptables start 启动防火墙
service iptables status 查看防火墙的状态
二、文件传输 jdk1.8.tar.gz (linux) hadoop .tar.gz
三、正式配置
1、配置ssh免密配置
yum install openssh* (可以省略)
ssh-keygen -t rsa (四步回车)
配置主机名:
vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.43.199 (自己的主机名)
ssh-copy-id -i /root/.ssh/id_rsa.pub min64
2、配置jdk环境变量,配置hadoop环境变量
tar -zxvf jdk-8u161-linux-x64.tar.gz -C /usr
tar -zxvf hadoop-2.6.0-x64.tar.gz -C /usr
cd ~
vi .bash_profile
export JAVA_HOME=/usr/jdk1.8.0_162
export HADOOP_HOME=/usr/hadoop-2.6.0
PATH=
P
A
T
H
:
PATH:
PATH:HOME/bin:
J
A
V
A
H
O
M
E
/
b
i
n
:
JAVA_HOME/bin:
JAVAHOME/bin:HADOOP_HOME / bin:$HADOOP_HOME/sbin
source .bash_profile
java -version
hadoop version
3、修改hadoop中配置文件
cd /usr/hadoop-2.6/etc/hadoop/
hadoop-env.sh
export JAVA_HOME=/usr/jdk1.8.0_162
slaves
(自己的主机名)
core-site.xml
hadoop.tmp.dir
file:///usr/hadoop-2.6.0/tmp
fs.defaultFS
hdfs://root:9000
fs.checkpoint.period
3600
hdfs-site.xml
dfs.replication
1
dfs.namenode.name.dir
file:/usr/hadoop-2.6.0/tmp/dfs/name
dfs.datanode.data.dir
file:/usr/hadoop-2.6.0/tmp/dfs/data
mapred-site.xml(需要先将原本的文件mapred-site.xml.template cp mapred-site.xml,然后更改mapred-site.xml即可
cp mapred-site.xml.template mapred-site.xml)
mapred-site.xml
mapreduce.framework.name
yarn
yarn-site.xml
yarn.nodemanager.aux-services
mapreduce_shuffle
yarn.resourcemanager.hostname
root
yarn.log-aggregation-enable
true
4.hadoop文件配置结束
格式化
hadoop namenode -format
hadoop datanode -format
start-all.sh #全部启动
5.jps 查看当前运行的程序
7972 NodeManager
8006 Jps
7160 DataNode
7291 SecondaryNameNode
7884 ResourceManager
7581 NameNode
6.查看
http://192.168.43.199:50070
Hadoop伪分布式搭建
最新推荐文章于 2024-06-27 21:14:06 发布