一个纯净版的centos7 虚拟机,配置好静态ip,主机名,主机映射
vi /etc/sysconfig/network-scripts/ifcfg-ens33
-----------------------------------------------------
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=e219cc60-b53f-4563-a91c-5239fc9103a8
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.73.101
立即生效
hostnamectl set-hostname hadoop1
vi /etc/hosts
-----------------------------------------------------
192.168.191.101 hadoop1
cd /opt
mkdir software install
ssh-keygen
#3次回车
#拷贝密钥
ssh-copy-id hadoop1
#解压
tar zxvf jdk-8u171-linux-x64.tar.gz -C /opt/install/
#配置环境变量
vi /etc/profile
export JAVA_HOME=/opt/install/jdk1.8.0_221
export JRE_HOME=/opt/install/jdk1.8.0_221/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
#刷新环境变量
source /etc/profile
#验证输入
java -version
#显示结果
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
Hadoop 的安装模式分为3种:单机(本地)模式,伪分布式,完全分布式(集群模式)
tar zxvf hadoop-2.6.0-cdh5.14.2.tar.gz -C /opt/install/
vi /etc/profile
---------------------------
# hadoop
export HADOOP_HOME=/opt/install/hadoop-2.6.0-cdh5.14.2
export PATH=$HADOOP_HOME/bin:$PATH
---------------------------------
source /etc/profile
bin/hadoop
mkdir input
cp etc/hadoop/*.xml input
bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.0-cdh5.14.2.jar grep input output 'dfs[a-z.]+'
cat output/*
export JAVA_HOME=/opt/install/jdk1.8.0_221
<property>
<name>fs.defaultFSname>
<value>hdfs://hadoop1:9000value>
property>
<property>
<name>dfs.replicationname>
<value>1value>
property>
hadoop1
bin/hdfs namenode -format
sbin/start-dfs.sh
#输入命令
jps
#显示结果
20896 Jps
20787 SecondaryNameNode
20521 NameNode
20638 DataNode
hdfs dfs -mkdir /input
hdfs dfs -put etc/hadoop/*.xml /input
bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.0-cdh5.14.2.jar grep /input /output 'dfs[a-z.]+'
hdfs dfs -cat /output/part-r-00000
mapred-site.xml
cp etc/hadoop/mapred-site.xml.template etc/hadoop/mapred-site.xml
--------------------------
<property>
<name>mapreduce.framework.namename>
<value>yarnvalue>
property>
yarn-site.xml
<configuration>
<property>
<name>yarn.nodemanager.aux-servicesname>
<value>mapreduce_shufflevalue>
property>
configuration>
sbin/start-yarn.sh
查看jps进程
jps
22304 ResourceManager
21989 DataNode
22389 NodeManager
21868 NameNode
22143 SecondaryNameNode
22703 Jps
hdfs dfs -rm -r -f /output
bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.0-cdh5.14.2.jar grep /input /output 'dfs[a-z.]+'
hdfs dfs -cat /output/part-r-00000