vi /etc/sysconfig/network-scripts/ifcfg-ens33
#ens33每个人可能不一样,要根据安装linux时候,系统分配的是什么
Systemctl restart network
systemctl stop firewalld #关闭防火墙
systemctl disable firewalld #禁用防火墙
systemctl status firewalld #查看防火墙状态,下面表示防火墙已关闭
vi /etc/hostname
hostnamectl set-hostname hadoop1(可以使用该命令,让其立刻生效)
tar -zxvf hadoop-2.6.0-cdh5.14.2.tar.gz -C /opt
tar -zxvf jdk-8u221-linux-x64.tar.gz -C /opt
mv hadoop-2.6.0-cdh5.14.2/ hadoop
mv jdk1.8.0_221/ jdk8
source /etc/profile
ssh-keygen -t rsa -P ""
cat /root/.ssh/id_rsa.pub > /root/.ssh/authorized_keys
cd /opt/hadoop/etc/hadoop
vi hadoop-env.sh
将原先默认的JAVA_HOME进行修改,如下所述:
fs.defaultFS
hdfs://192.168.220.171:9000
#配置hadoop临时数据的存储位置
hadoop.tmp.dir
/opt/hadoop/tmp
hadoop.proxyuser.root.hosts
*
hadoop.proxyuser.root.groups
*
#配置副本数量
dfs.replication
1
#配置第二个namenode
dfs.namenode.secondary.http-address
hadoop1:50090
系统默认是mapred-site.xml.template,将它改成mapred-site.xml
mapreduce.framework.name
yarn
mapreduce.jobhistory.address
hadoop1:10020
mapreduce.jobhistory.webapp.address
hadoop1:19888
yarn.nodemanager.aux-services
mapreduce_shuffle
yarn.nodemanager.aux-services.mapreduce.shuffle.class
org.apache.hadoop.mapred.ShuffleHandler
yarn.resourcemanager.hostname
hadoop1
yarn.log-aggregation-enable
true
yarn.log-aggregation.retain-seconds
604800
export HADOOP_HOME=/opt/hadoop
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib"
export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin
source /etc/profile
hadoop namenode -format
start-all.sh
mr-jobhistory-daemon.sh start historyserver
HDFS页面:http://192.168.220.171:50070
YARN的管理界面:http://192.168.220.171:8088
JobHistory界面:http://192.168.220.171:19888/
将software中hadoop-native-64-2.6.0.tar解压到hadoop/lib和hadoop/lib/native
tar -xvf hadoop-native-64-2.6.0.tar -C /opt/hadoop/lib
tar -xvf hadoop-native-64-2.6.0.tar -C /opt/hadoop/lib/native/
备注:如果安装包后缀只有.tar 用 -xvf ; 安装包后缀有.tar.gz 用 -zxvf
使用的是VmWare,选中要克隆的虚拟机,右键,管理,克隆
克隆完成后,需要将克隆好的虚拟机的网络适配器的MAC重新生成一下
vi /etc/sysconfig/network-scripts/ifcfg-ens33
Systemctl restart network
systemctl stop firewalld #关闭防火墙
systemctl disable firewalld #禁用防火墙
systemctl status firewalld #查看防火墙状态,下面表示防火墙已关闭
vi /etc/hostname
ssh-keygen -t rsa -P ""
cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys
ssh-copy-id -i ~/.ssh/id_rsa.pub -p22 [email protected]
ssh-copy-id -i ~/.ssh/id_rsa.pub -p22 [email protected]
ssh -p22 root@192.168.220.172
ssh -p22 root@192.168.220.173
cd /opt/hadoop/etc/hadoop
vi slaves
备注:hadoop1为主节点,一般不加在里面,由于是学习使用,所以无所谓
vi hdfs-site.xml
备注:设置副本为3,secondnamenode为hadoop2
scp etc/hadoop/hdfs-site.xml root@hadoop2:/opt/hadoop/etc/hadoop/hdfs-site.xml
scp etc/hadoop/hdfs-site.xml root@hadoop3:/opt/hadoop/etc/hadoop/hdfs-site.xml
scp etc/hadoop/slaves root@hadoop3:/opt/hadoop/etc/hadoop/slaves
scp etc/hadoop/slaves root@hadoop2:/opt/hadoop/etc/hadoop/slaves
cd /opt/hadoop
rm -rf tmp
hadoop namenode -format
start-all.sh