Hadoop集群安装部署

hadoop集群安装部署

1、服务器主机名和IP配置(三台)
2、修改每个主机的/etc/hosts文件,添加IP和主机名的对应关系(三台)
3、管理节点到从节点配置无密码登录
4、配置jdk  1.8(三台)
5、关闭防火墙(三台)
6、关闭selinux(三台)
vi   /etc/selinux/config
SELINUX=enforcing        SELINUX=disabled               重启系统

安装流程

1、上传软件包到管理节点,在管理节点解压并配置
2、将修改完的解压包,远程拷贝到所有的从节点
3、启动软件

CDH 分布式环境搭建

1、软件包上传并解压

tar -zxvf hadoop-2.6.0-cdh5.14.0-with-centos6.9.tar.gz  -C ../servers/

2、第二步查看hadoop支持的压缩方式以及本地库

  ./hadoop checknative

Hadoop集群安装部署_第1张图片

安装openssl
yum -y install openssl-devel
./hadoop checknative

Hadoop集群安装部署_第2张图片

3、修改配置文件

修改 core-site.xml

cd /export/servers/hadoop-2.6.0-cdh5.14.0/etc/hadoop
vim core-site.xml  




	fs.defaultFS
	hdfs://node01:8020


	hadoop.tmp.dir
	/export/servers/hadoop-2.6.0-cdh5.14.0/hadoopDatas/tempDatas



	io.file.buffer.size
	4096




	fs.trash.interval
	10080
	

修改 hdfs-site.xml

	cd /export/servers/hadoop-2.6.0-cdh5.14.0/etc/hadoop
	vim hdfs-site.xml
	
	 
	
	 
	 
			dfs.namenode.secondary.http-address
			node01:50090
	

	
		dfs.namenode.http-address
		node01:50070
	
	
		dfs.namenode.name.dir
		file:///export/servers/hadoop-2.6.0-cdh5.14.0/hadoopDatas/namenodeDatas
	
	
	
		dfs.datanode.data.dir
		file:///export/servers/hadoop-2.6.0-cdh5.14.0/hadoopDatas/datanodeDatas
	
	
	
		dfs.namenode.edits.dir
		file:///export/servers/hadoop-2.6.0-cdh5.14.0/hadoopDatas/dfs/nn/edits
	
	
		dfs.namenode.checkpoint.dir
		file:///export/servers/hadoop-2.6.0-cdh5.14.0/hadoopDatas/dfs/snn/name
	
	
		dfs.namenode.checkpoint.edits.dir
		file:///export/servers/hadoop-2.6.0-cdh5.14.0/hadoopDatas/dfs/nn/snn/edits
	
	
		dfs.replication
		2
	
	
		dfs.permissions
		false
	

		dfs.blocksize
		134217728
	

修改 Hadoop-env.sh (不用改)

修改 mapred-site.xml

cd /export/servers/hadoop-2.6.0-cdh5.14.0/etc/hadoop   
cp  mapred-site.xml.template    mapred-site.xml
vim mapred-site.xml



	

		mapreduce.framework.name
		yarn
	

	
	
		mapreduce.job.ubertask.enable
		true
	
	
	
		mapreduce.jobhistory.address
		node01:10020
	

	
		mapreduce.jobhistory.webapp.address
		node01:19888
	

修改 slaves

cd /export/servers/hadoop-2.6.0-cdh5.14.0/etc/hadoop
vim slaves

修改yarn-site.xml

cd /export/servers/hadoop-2.6.0-cdh5.14.0/etc/hadoop
vim yarn-site.xml


	
		yarn.resourcemanager.hostname
		node01
	
	

		yarn.nodemanager.aux-services
		mapreduce_shuffle
	

4. 创建文件存放目录

mkdir -p /export/servers/hadoop-2.6.0-cdh5.14.0/hadoopDatas/tempDatas
mkdir -p /export/servers/hadoop-2.6.0-cdh5.14.0/hadoopDatas/namenodeDatas
mkdir -p /export/servers/hadoop-2.6.0-cdh5.14.0/hadoopDatas/datanodeDatas 
mkdir -p /export/servers/hadoop-2.6.0-cdh5.14.0/hadoopDatas/dfs/nn/edits
mkdir -p /export/servers/hadoop-2.6.0-cdh5.14.0/hadoopDatas/dfs/snn/name
mkdir -p /export/servers/hadoop-2.6.0-cdh5.14.0/hadoopDatas/dfs/nn/snn/edits

5.安装包的分发

cd /export/servers/

scp -r hadoop-2.6.0-cdh5.14.0/ node02:$PWD
scp -r hadoop-2.6.0-cdh5.14.0/ node03:$PWD

6.配置Hadoop的环境变量(类似于配置jdk的过程)

vim  /etc/profile.d/hadoop.sh
export HADOOP_HOME=/export/servers/hadoop-2.6.0-cdh5.14.0
export PATH=:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH

配置完成之后
source /etc/profile

7.启动集群

a)格式化集群
在第一个节点执行 (在sbin目录下进行) hadoop  namenode   -format
b)启动
i.每个组件独立启动
1.启动namenode   node01节点   ./hadoop-daemon.sh  start  namenode
2.启动namenode	node01、02、03节点  ./hadoop-daemon.sh  start  datanode
3.启动resourcemanager   node01节点  ./yarn-daemon.sh   start  resourcemanager
4.启动nodemanager  node01、02、03节点    ./yarn-daemon.sh  start  nodemanager

ii.单独启动
1.单独启动HDFS  :  ./start-dfs.sh        关闭 ./stop-dfs.sh
2.单独启动Yarn   :  ./start-yarn.sh       关闭 ./stop-yarn.sh

iii.一键启动所有
启动:  ./start-all.sh      			 关闭:./stop-all.sh

8.浏览器查看启动页面

http://主节点ip:50070
http://主节点ip:8088

你可能感兴趣的:(大数据,笔记,大数据)