Hadoop基礎(chǔ)?
可以用“5V + 1C”來概括:
? ? Variety (多樣化) ? Volume (海量)? Velocity (快速)? Vitality (靈活)
? ? Value (價值性) ?? Complexity (復(fù)雜)
Hadoop
狹義: 軟件(HDFS乖寒、MapReduce歧譬、Yarn)
廣義: 以hadoop為主的生態(tài)圈
Hadoop1.x
hdfs: 分布式文件管理系統(tǒng)? ? ? ? ? ? ? ? ? ? 存儲
mapreduce1: 執(zhí)行引擎? ? ? ? ? ? ? ? ? 計算+資源、作業(yè)調(diào)度
Hadoop2.x三大組件
hdfs: 分布式文件管理系統(tǒng)? ? ? ? ? ? 存儲
mapreduce2: 執(zhí)行引擎? ? ? ? ? ? ? ? ? 計算
yarn: 資源(memory cpu)和作業(yè)調(diào)度平臺? ? 資源
Hadoop編譯
[root@hadoop-01 ~]# cd /opt/
[root@hadoop-01 opt]# mkdir sourcecode software
[root@hadoop-01 opt]# cd sourcecode
[root@hadoop-01 sourcecode]# pwd
/opt/sourcecode
hadoop源代碼下載
# 將hadoop-2.8.1-src.tar.gz下載(或者用rz上傳)到sourcecode目錄
[root@hadoop-01 sourcecode]# ll
total 33756 ??
-rw-r--r--. 1 root root 34523353 Aug 20 12:14 hadoop-2.8.1-src.tar.gz
# 解壓
[root@hadoop-01 sourcecode]# tar -xzvf hadoop-2.8.1-src.tar.gz
[root@hadoop-01 sourcecode]# ll
total 33760
? drwxr-xr-x. 17 root root? ? 4096 Jun? 2 14:13 hadoop-2.8.1-src
-rw-r--r--.? 1 root root 34523353 Aug 20 1c'd2:14 hadoop-2.8.1-src.tar.gz
[root@hadoop-01 sourcecode]# cd hadoop-2.8.1-src
JAVA安裝
[root@hadoop-01 ~]# mkdir -p /usr/java
[root@hadoop-01 ~]# cd /usr/java
[root@hadoop-01 java]# rz #上傳jdk-8u45-linux-x64.gz
[root@hadoop-01 java]# tar -xzvf jdk-8u45-linux-x64.gz
# 修改用戶和用戶組
[root@hadoop-01 java]# chown -R root:root jdk1.8.0_45
# 設(shè)置環(huán)境變量
[root@hadoop-01 java]# vi /etc/profile
# 在最底下加入
export JAVA_HOME=/usr/java/jdk1.8.0_45
export PATH=$JAVA_HOME/bin:$PATH
# 生效
[root@hadoop-01 java]# source /etc/profile
Maven安裝
[root@hadoop-01 ~]# cd /opt/software/
[root@hadoop-01 software]# rz? #上傳apache-maven-3.3.9-bin.zip
[root@hadoop-01 software]# ll
total 8432
-rw-r--r--. 1 root root 8617253 Aug 20 12:35 apache-maven-3.3.9-bin.zip
# 解壓
[root@hadoop-01 software]# unzip apache-maven-3.3.9-bin.zip
# 設(shè)置環(huán)境變量
[root@hadoop-01 software]# vi /etc/profile
export MAVEN_HOME=/opt/software/apache-maven-3.3.9
export MAVEN_OPTS="-Xms256m -Xmx512m"
export PATH=$MAVEN_HOME/bin:$JAVA_HOME/bin:$PATH
# 生效
[root@hadoop-01 software]# source /etc/profile
# 查看
[root@hadoop-01 software]# mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /opt/software/apache-maven-3.3.9
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_45/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.el6.x86_64", arch: "amd64", family: "unix"
Findbugs安裝
[root@hadoop-01 ~]# cd /opt/software/
[root@hadoop-01 software]# rz #上傳findbugs-1.3.9.zip
# 解壓
[root@hadoop-01 software]# unzip findbugs-1.3.9.zip
# 設(shè)置環(huán)境變量
[root@hadoop-01 software]# vi /etc/profile
export FINDBUGS_HOME=/opt/software/findbugs-1.3.9
export PATH=$FINDBUGS_HOME/bin:$MAVEN_HOME/bin:$JAVA_HOME/bin:$PATH
# 生效
[root@hadoop-01 software]# source /etc/profile
# 查看
[root@hadoop-01 software]# findbugs -version
1.3.9
protobuf安裝
[root@hadoop-01 ~]# cd /opt/software/
[root@hadoop-01 software]# rz #上傳protobuf-2.5.0.tar.gz
# 解壓
[root@hadoop-01 software]# tar -xzvf protobuf-2.5.0.tar.gz
[root@hadoop-01 software]# cd protobuf-2.5.0
[root@hadoop-01 protobuf-2.5.0]# yum install -y gcc gcc-c++ make cmake
[root@hadoop-01 protobuf-2.5.0]# ./configure --prefix=/usr/local/protobuf
[root@hadoop-01 protobuf-2.5.0]# make && make install
# 設(shè)置環(huán)境變量
[root@hadoop-01 java]# vi /etc/profile
export PROTOC_HOME=/usr/local/protobuf
export PATH=$PROTOC_HOME/bin:$FINDBUGS_HOME/bin:$MAVEN_HOME/bin:$JAVA_HOME/bin:$PATH
# 生效
[root@hadoop-01 protobuf-2.5.0]# source /etc/profile
# 查看
[root@hadoop-01 protobuf-2.5.0]# protoc --version
libprotoc 2.5.0
其他依賴
yum install -y openssl openssl-devel svn ncurses-devel zlib-devel libtool
yum install -y snappy snappy-devel bzip2 bzip2-devel lzo lzo-devel lzop autoconf automake
編譯
[root@hadoop-01 sourcecode]# cd hadoop-2.8.1-src
[root@hadoop-01 hadoop-2.8.1-src]# mvn clean package -Pdist,native -DskipTests -Dtar
注意:
download需要3.5h
不想download就使用.m2.tar.gz -->解壓-->root家目錄
編譯好的tar包路徑
/opt/sourcecode/hadoop-2.8.1-src/hadoop-dist/target/hadoop-2.8.1.tar.gz
[root@hadoop000 target]# pwd /opt/sourcecode/hadoop-2.8.1-src/hadoop-dist/target [root@hadoop000 target]# ls
antrun hadoop-dist-2.8.1-sources.jar classes hadoop-dist-2.8.1-test-sources.jar dist-layout-stitching.sh javadoc-bundle-options dist-tar-stitching.sh maven-archiver hadoop-2.8.1 maven-shared-archive-resources hadoop-2.8.1.tar.gz test-classes hadoop-dist-2.8.1.jar test-dir hadoop-dist-2.8.1-javadoc.jar
配置本地Maven倉庫
window/linux:
cd /opt/software/apache-maven-3.3.9/conf
1.vi setting.xml? ?
D:\software\apache-maven-3.3.9\repository
2.創(chuàng)建D:\software\apache-maven-3.3.9\repository
提醒
1侣夷、有時候編譯過程中會出現(xiàn)下載某個包的時間太久祠乃,這是由于連接網(wǎng)站的過程中會出現(xiàn)假死梦重,
此時按ctrl+c,重新運(yùn)行編譯命令亮瓷。
2琴拧、如果出現(xiàn)缺少了某個文件的情況,則要先清理maven(使用命令 mvn clean) 再重新編譯嘱支。