Hadoop的安装与环境配置
Hadoop CDH版本的安装:参考文档http://archive.cloudera.com/cdh5/cdh/5/hadoop-2.6.0-cdh5.7.0/
下载地址:http://archive.cloudera.com/cdh5/cdh/5/
安装的版本为:hadoop-2.6.0-cdh5.7.0.tar.gz jdk-8u241-linux-x64.tar.gz
安装包的下载路径为~/software/
软件的安装路径为~/app/
JDK1.8下载地址:https://www.oracle.com/cn/java/technologies/javase-jdk8-downloads.html
安装与配置
- 安装JDK1.8
解压jdk-8u241-linux-x64.tar.gz 到~/app/目录
tar -zxvf jdk-8u241-linux-x64.tar.gz -C ~/app/
- 配置环境变量到~/.bashprofile
export JAVA_HOME=/home/coolkid/app/jdk1.8.0_241 export PATH=$JAVA_HOME/bin:$PATH
- ssh的安装
sudo apt-get install ssh sudo apt-get install rsync
- ssh免密码登录配置
ssh-keygen -t rsa cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
- 安装Hadoop
解压hadoop-2.6.0-cdh5.7.0.tar.gz
tar -zxvf ~/software/hadoop-2.6.0-cdh5.7.0.tar.gz -C ~/app/
配置配置文件:/home/coolkid/app/hadoop-2.6.0-cdh5.7.0/etc/hadoop/hadoop-env.sh
export JAVA_HOME=/home/coolkid/app/jdk1.8.0_241
配置配置文件:hadoop_home/etc/hadoop/core-site.xml
<configuration> <property> <name>fs.defaultFS</name> <value>hdfs://localhost:9000</value> </property> <property> <name>hadoop.tmp.dir</name> <value>~/app/tmp</value> </property> </configuration>
配置配置文件:hadoop_home/etc/hadoop/hdfs-site.xml
<configuration> <property> <name>dfs.replication</name> <value>1</value> </property> </configuration>
配置配置文件slaves
slaves一行配置一个datanode的主机名称,单节点配置本主机名称。当启动集群时,namenode扫描slaves像datanode发送命令启动。
- 启动HDFS
(第一次格式化namenode)
bin/hdfs namenode -format
启动集群
sbin/start-dfs.sh
查看启动的进程
jps
显示如下进程则启动成功
19203 Jps
19077 SecondaryNameNode
18823 DataNode
18665 NameNode
- 关闭集群
sbin/stop-dfs.sh
- 网页访问集群
http://localhost:50070