1、安装jdk
rpm -i jdk-8u231-linux-x64.rpm
2、配置java环境变量
vi /etc/profile export JAVA_HOME=/usr/java/jdk1.8.0_231-amd64 PATH=$PATH:$JAVA_HOME/bin source /etc/profile
3、配置ssh免密钥登陆
ssh localhost ssh-keygen -t dsa -P ‘‘ -f ~/.ssh/id_dsa cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
4、解压hadoop安装包
mkdir -p /opt/ycyz tar xf hadoop-2.6.5.tar.gz -C /opt/ycyz/
5、配置hadoop环境变量
vi + /etc/profile export HADOOP_HOME=/opt/ycyz/hadoop-2.6.5 PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin source /etc/profile
6、hadoop的java环境变量配置
cd $HADOOP_HOME/etc/hadoop/ vi hadoop-env.sh vi mapred-env.sh vi yarn-env.sh export JAVA_HOME=/usr/java/jdk1.8.0_231-amd64
7、配置core-site.xml
vi core-site.xml <property> <name>fs.defaultFS</name> <value>hdfs://hadoop-1:9000</value> </property> <property> <name>hadoop.tmp.dir</name> <value>/var/ycyz/hadoop/local</value> </property>
8、配置hdfs-site.xml
vi hdfs-site.xml <property> <name>dfs.replication</name> <value>1</value> </property> <property> <name>dfs.namenode.secondary.http-address</name> <value>hadoop-1:50090</value> </property>
9、配置slaves文件
vi slaves hadoop-1
10、格式化hdfs
hdfs namenode -format (只能格式化一次,再次启动集群不要执行)
11、启动集群
start-dfs.sh
注:
角色进程查看:jps
帮助: hdfs
hdfs dfs
查看web UI: IP:50070
创建目录:hdfs dfs -mkdir -p /user/root
查看目录: hdfs dfs -ls /
上传文件: hdfs dfs -put hadoop-2.6.5.tar.gz /user/root
停止集群:stop-dfs.sh
原文地址:https://www.cnblogs.com/mstoms/p/11741278.html
时间: 2024-11-09 00:46:25