hadoop in Linux development environment to build and install steps


Operation of all the big data tools must be performed by ordinary users, create a user named: fuyun

  1. Create a folder to install the required
sudo mkdir -p /opt/tools/ #创建文件夹/opt/tools 存储安装包
sudo mkdir -p /opt/modules/ #创建文件夹/opt/software存储安装程序文件
sudo mkdir -p /opt/datas #创建文件夹/opt/datas 存储日志
  1. Modify the folder above the current owner and user groups
sudo chown -R rdedu:rdedu /opt/datas
sudo chown -R rdedu:rdedu /opt/tools
sudo chown -R rdedu:rdedu /opt/software
  1. Installation package to upload / opt / tools document
    by switching to / opt / tools directorycd /opt/tools
    rz
    Here Insert Picture Description

Installation jdk

Find jdk installation package name
ls /opt/tools/
Extract installation jdk
tar -zxvf jdk-8u91-linux-x64.tar.gz -C /opt/software/
install the above package path is relative, that is, you must firstcd /opt/tools

  1. Configuration environment variable
    cd /opt/software/jdk1.8.0_91/
    pwdPrint full path
sudo vi /etc/profile
#JAVA_HOME
export JAVA_HOME=/opt/software/jdk1.8.0_91
export PATH=$PATH:$JAVA_HOME/bin

Here Insert Picture Description
Refresh environment variable
source /etc/profile
test
java -version
Here Insert Picture Description

hadoop of three installation modes
Local modes: MapReduce default read local files that do not run on the yarn, running in a separate jvm, the general procedures for testing the accuracy of
pseudo-distributed: only one machine, all programs are run a machine uplink
distributed: build a cluster of multiple machines, different programs running on different machines

Pseudo-distributed mode installation

Find jdk installation package name
ls /opt/tools/

tar -zxvf hadoop-2.6.0-cdh5.7.6.tar.gz -C /opt/software/
Package mounted thereon path is relative, i.e. must cd / opt / tools

Modify the configuration official website address: http://hadoop.apache.org/docs/r2.7.6/hadoop-project-dist/hadoop-common/SingleCluster.html#Pseudo-Distributed_Operation

hadoop-env.sh、mapred-env.sh、yarn-env.sh

Operating environment variables for configuring the hadoop
hadoop-env.sh:
`` `Export the JAVA_HOME = / opt / Software / jdk1.8.0_91``

mapred-env.sh
export JAVA_HOME=/opt/software/jdk1.8.0_91

yarn-env.sh
export JAVA_HOME=/opt/software/jdk1.8.0_91

core-site.xml: Some configuration for global hadoop
create datas hadoop directory in the home directory

  <!--指定hdfs的唯一入口,以及namenode的地址-->
  <property>
    <name>fs.defaultFS</name>
    <value>hdfs://bigdata.fuyun:8020</value>
  </property>
  <!--配置hadoop的临时目录-->
  <property>
    <name>hadoop.tmp.dir</name>
    <value>/opt/software/hadoop-2.6.0-cdh5.7.6/datas</value>
  </property>

hdfs-site.xml: for the configuration hdfs

  <!--配置hdfs中文件块的副本数-->
  <property>
    <name>dfs.replication</name>
    <value>1</value>
  </property>

slaves: used to configure the address of a node, a line
bigdata.fuyun

Start the service
firstcd /opt/software/hadoop-2.6.0-cdh5.7.6

The first to be formatted before you start the
bin/hdfs namenode -format
start NameNode
sbin/hadoop-daemon.sh start namenode

Start DataNode
sbin/hadoop-daemon.sh start datanode

an examination
jps

Access web client: 50070
HTTP: //bigdata.fuyun: 50070

Here Insert Picture Description

Test
Create a folder on hdfs
bin/hdfs dfs -mkdir /hive
bin/hdfs dfs -ls /

Here Insert Picture Description

shut down
sbin/hadoop-daemon.sh stop namenode
sbin/hadoop-daemon.sh stop datanode

MapReduce environment configuration of the yarn:
HDFS: HDFS-the site.xml

-》 <!--关闭hdfs的权限检查-->
<property>
<name>dfs.permissions.enabled</name>
<value>false</value>
</property>

mapreduce: mapred-site.xml
history service process: information used to record all programs run-off

<!--用于配置历史服务进程的地址-->
    <property>
        <name>mapreduce.framework.name</name>
        <value>yarn</value>
    </property>
    <property>
        <name>mapreduce.jobhistory.address</name>
        <value>bigdata.fuyun:10020</value>
    </property>
    <property>
        <name>mapreduce.jobhistory.webapp.address</name>
        <value>bigdata.fuyun:19888</value>
    </property>

yarn:yarn-site.xml

Log aggregation: Save the running log of all programs on hdfs, unified management

<!--用于配置日志聚集,保存7天-->
  <property>
    <name>yarn.log-aggregation-enable</name>
    <value>true</value>
  </property>
  <property>
    <name>yarn.log-aggregation.retain-seconds</name>
    <value>604800</value>
  </property>

Start yarn
sbin/yarn-daemon.sh start resourcemanager
sbin/yarn-daemon.sh start nodemanager
start jobhistoryserver Service
sbin/mr-jobhistory-daemon.sh start historyserver

YARN associated interface
http: //bigdata.fuyun: 8088 /

Here Insert Picture Description

maven deployment

Download maven official website: http://maven.apache.org/download.cgi

After downloading unzip Linux maven After uploading

tar -zxvf apache-maven-3.3.9-bin.tar.gz -C / opt / software /

Configuration environment variable:sudo vim /etc/profile

#M2_HOME
export M2_HOME=/opt/software/apache-maven-3.6.1
export PATH=$PATH:$M2_HOME/bin

source /etc/profile
test:mvn -version

Here Insert Picture Description
Modify maven configuration: conf / settings.xml

Modify the maven remote repository as a source Ali

<mirror>
  <id>alimaven</id>
  <name>aliyun maven</name>   <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
  <mirrorOf>central</mirrorOf>        
</mirror>

Create a local maven repository directory
mkdir -p ~/.m2/repository
Here Insert Picture Description
will copy the configuration file to the next .m2 directory:
cp /opt/software/apache-maven-3.6.1/conf/settings.xml ~ / .m2 /

Here Insert Picture Description

Guess you like

Origin blog.csdn.net/lz6363/article/details/91887930