Hadoop集群安装部署

一、概述
随着互联网的发展,各行各业的快速发展,大数据爆炸的时代,数据处理显得越来越重要了,因此学习大数据的分析也是让各位IT人员极为重要了。学习大数据的基础,就得从hadoop开始,后续要学习到的kafka、Hbase、Hive、flink等,都会多少使用到这个hadoop的相关内容,特别是HDFS和YARN两大组件功能。
后续我们是先搭建hadoop的安全分布式环境。

二、环境准备
1、服务器准备,为了体现集群安装高可用,申请了三台集群
机器名称 Ip地址 操作系统 位数 备注
hadoop01 10.10.36.20 Linux 64 Master
hadoop02 10.10.36.164 Linux 64 slaver
hadoop03 10.10.5.247 Linux 64 slaver
另外要注意hosts文件的修改。
2、SSH无密授权登录
设置ssh无密授权登录,是为了后续各类集群通信做准备。
3、Java安装准备
基于hadoop的安装,建立在Java的基础上,因此Java的安装要准备。
可以到官网下载,我准备的版本是jdk-8u181-linux-x64.tar.gz
4、Hadoop安装准备
我准备的版本是hadoop-3.2.1.tar.gz,可以到官网下载。
三、安装步骤
1、首先是配置好hosts文件,在三台机器的/etc/hosts文件编辑,添加好hosts文件

1.png

2、ssh无密授权登录配置,在hadoop01服务器,进入/root/.ssh目录,执行ssh-keygen -t rsa,回车三次


2.png

会得到id_rsa(私钥)和id_rsa.pub(公钥)两个文件,在其余两台机器都执行相同的操作,vi打开id_rsa.pub,将内容统一拷贝authorized_keys文件,包括hadoop02和hadoop03的id_rsa.pub文件内容。最后再统一将authorized_keys文件拷贝到hadoop02和hadoop03。最后可以验证ssh免密登录了。如需详细了解SSH免密登录,可以自行谷歌或百度了解。

3、检查Java的安装,如下:


1.png

由于我的机器已经安装了,也配置了jdk的环境变量,所以就不再赘述,如需了解,自行Google或百度JDK-Linux环境变量设置。
4、Hadoop安装,到了安装的重头戏了。
首先我们需要在服务器home目录下建一个子目录


2.png

将hadoop压缩包解压到/home/hadoop-ha/目录下

3.png

解压如下
4.png

接着修改环境配置文件,/etc/profile文件
export JAVA_HOME=/opt/java/jdk1.8.0_181
export PATH=PATH
export CLASSPATH=.:JAVA_HOME/lib/tools.jar
export HADOOP_HOME=/home/hadoop-ha/hadoop-3.2.1
5.png

保存退出。
接入进入/home/hadoop-ha/hadoop-3.2.1/etc/hadoop 修改6个文件
首先是修改hadoop-env.sh,增加JAVA_HOME配置
6.png

接着修改hdfs-site.xml文件
<configuration>
<property>
<name>dfs.namenode.http-address</name>
<value>hadoop01:50070</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/home/hadoop-ha/dfs/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/home/hadoop-ha/dfs/data</value>
</property>
<property>
<name>dfs.replication</name>
<value>2</value>
</property>
<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>
<property>
<name>dfs.namenode.secondary.http-adddress</name>
<value>hadoop01:9001</value>
</property>
<property>
<name>dfs.namenode.fs-limts.min-block-size</name>
<value>1024</value>
</property>
</configuration>
接着是core-site.xml文件的配置

<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://hadoop01:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/home/hadoop-ha/tmp</value>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://hadoop01:8020</value>
</property>
</configuration>

还有修改mapred-site.xml文件的配置

<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>mapreduce.jobhistory.address</name>
<value>hadoop01:10020</value>
</property>
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value>hadoop01:19888</value>
</property>
<property>
<name>mapreduce.application.classpath</name>
<value>HADOOP_MAPRED_HOME/share/hadoop/mapreduce/*:HADOOP_MAPRED_HOME/sharehadoop/mapreduce/lib/*</value>
</property>
</configuration>

Yarn-site.xml文件的配置
<configuration>


<property>
<name>yarn.resourcemanager.hostname</name>
<value>hadoop01</value>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.resourcemanager.webapp.address</name>
<value>hadoop01:8088</value>
</property>
<property>
<name>yarn.scheduler.maximum-allocation-mb</name>
<value>2048</value>
</property>
<property>
<name>yarn.nodemanager.vmem-check-enabled</name>
<value>false</value>
</property>
<property>
<name>yarn.nodemanager.env-whitelist</name>
<value>JAVA_HOME,HADOOP_HOME,HADOOP_HDFS_HOME,HADOOP_CONF_DIR,CLASSPATH_PREPEND_DISTCACHE,HADOOP_YARN_HOME,HADOOP_MAPRED_HOME</value>
</property>
<property>
<name>yarn.application.classpath</name>
<value>/home/hadoop-ha/hadoop-3.2.1/etc/hadoop:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/mapreduce/lib/:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/mapreduce/:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/accessors-smart-1.2.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/animal-sniffer-annotations-1.17.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/asm-5.0.4.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/audience-annotations-0.5.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/avro-1.7.7.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/checker-qual-2.5.2.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/commons-beanutils-1.9.3.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/commons-cli-1.2.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/commons-codec-1.11.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/commons-collections-3.2.2.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/commons-compress-1.18.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/commons-configuration2-2.1.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/commons-io-2.5.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/commons-lang3-3.7.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/commons-logging-1.1.3.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/commons-math3-3.1.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/commons-net-3.6.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/commons-text-1.4.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/curator-client-2.13.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/curator-framework-2.13.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/curator-recipes-2.13.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/dnsjava-2.1.7.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/error_prone_annotations-2.2.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/failureaccess-1.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/gson-2.2.4.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/guava-27.0-jre.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/hadoop-annotations-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/hadoop-auth-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/htrace-core4-4.1.0-incubating.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/httpclient-4.5.6.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/httpcore-4.4.10.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/j2objc-annotations-1.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jackson-annotations-2.9.8.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jackson-core-2.9.8.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jackson-core-asl-1.9.13.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jackson-databind-2.9.8.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jackson-jaxrs-1.9.13.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jackson-mapper-asl-1.9.13.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jackson-xc-1.9.13.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/javax.servlet-api-3.1.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jaxb-api-2.2.11.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jaxb-impl-2.2.3-1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jcip-annotations-1.0-1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jersey-core-1.19.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jersey-json-1.19.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jersey-server-1.19.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jersey-servlet-1.19.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jettison-1.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jetty-http-9.3.24.v20180605.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jetty-io-9.3.24.v20180605.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jetty-security-9.3.24.v20180605.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jetty-server-9.3.24.v20180605.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jetty-servlet-9.3.24.v20180605.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jetty-util-9.3.24.v20180605.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jetty-webapp-9.3.24.v20180605.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jetty-xml-9.3.24.v20180605.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jsch-0.1.54.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/json-smart-2.3.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jsp-api-2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jsr305-3.0.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jsr311-api-1.1.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/jul-to-slf4j-1.7.25.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/kerb-admin-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/kerb-client-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/kerb-common-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/kerb-core-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/kerb-crypto-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/kerb-identity-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/kerb-server-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/kerb-simplekdc-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/kerb-util-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/kerby-asn1-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/kerby-config-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/kerby-pkix-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/kerby-util-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/kerby-xdr-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/log4j-1.2.17.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/metrics-core-3.2.4.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/netty-3.10.5.Final.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/nimbus-jose-jwt-4.41.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/paranamer-2.3.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/protobuf-java-2.5.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/re2j-1.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/slf4j-api-1.7.25.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/snappy-java-1.0.5.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/stax2-api-3.1.4.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/token-provider-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/woodstox-core-5.0.3.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib/zookeeper-3.4.13.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/hadoop-common-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/hadoop-common-3.2.1-tests.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/hadoop-kms-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/hadoop-nfs-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/jdiff:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/lib:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/sources:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/common/webapps:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/accessors-smart-1.2.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/animal-sniffer-annotations-1.17.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/asm-5.0.4.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/audience-annotations-0.5.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/avro-1.7.7.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/checker-qual-2.5.2.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/commons-beanutils-1.9.3.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/commons-cli-1.2.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/commons-codec-1.11.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/commons-collections-3.2.2.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/commons-compress-1.18.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/commons-configuration2-2.1.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/commons-daemon-1.0.13.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/commons-io-2.5.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/commons-lang3-3.7.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/commons-logging-1.1.3.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/commons-math3-3.1.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/commons-net-3.6.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/commons-text-1.4.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/curator-client-2.13.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/curator-framework-2.13.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/curator-recipes-2.13.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/dnsjava-2.1.7.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/error_prone_annotations-2.2.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/failureaccess-1.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/gson-2.2.4.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/guava-27.0-jre.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/hadoop-annotations-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/hadoop-auth-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/htrace-core4-4.1.0-incubating.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/httpclient-4.5.6.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/httpcore-4.4.10.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/j2objc-annotations-1.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jackson-annotations-2.9.8.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jackson-core-2.9.8.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jackson-core-asl-1.9.13.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jackson-databind-2.9.8.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jackson-jaxrs-1.9.13.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jackson-mapper-asl-1.9.13.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jackson-xc-1.9.13.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/javax.servlet-api-3.1.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jaxb-api-2.2.11.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jaxb-impl-2.2.3-1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jcip-annotations-1.0-1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jersey-core-1.19.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jersey-json-1.19.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jersey-server-1.19.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jersey-servlet-1.19.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jettison-1.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jetty-http-9.3.24.v20180605.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jetty-io-9.3.24.v20180605.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jetty-security-9.3.24.v20180605.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jetty-server-9.3.24.v20180605.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jetty-servlet-9.3.24.v20180605.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jetty-util-9.3.24.v20180605.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jetty-util-ajax-9.3.24.v20180605.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jetty-webapp-9.3.24.v20180605.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jetty-xml-9.3.24.v20180605.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jsch-0.1.54.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/json-simple-1.1.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/json-smart-2.3.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jsr305-3.0.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/jsr311-api-1.1.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/kerb-admin-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/kerb-client-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/kerb-common-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/kerb-core-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/kerb-crypto-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/kerb-identity-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/kerb-server-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/kerb-simplekdc-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/kerb-util-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/kerby-asn1-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/kerby-config-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/kerby-pkix-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/kerby-util-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/kerby-xdr-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/leveldbjni-all-1.8.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/log4j-1.2.17.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/netty-3.10.5.Final.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/netty-all-4.0.52.Final.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/nimbus-jose-jwt-4.41.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/okhttp-2.7.5.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/okio-1.6.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/paranamer-2.3.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/protobuf-java-2.5.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/re2j-1.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/snappy-java-1.0.5.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/stax2-api-3.1.4.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/token-provider-1.0.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/woodstox-core-5.0.3.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib/zookeeper-3.4.13.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/hadoop-hdfs-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/hadoop-hdfs-3.2.1-tests.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/hadoop-hdfs-client-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/hadoop-hdfs-client-3.2.1-tests.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/hadoop-hdfs-httpfs-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/hadoop-hdfs-native-client-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/hadoop-hdfs-native-client-3.2.1-tests.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/hadoop-hdfs-nfs-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/hadoop-hdfs-rbf-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/hadoop-hdfs-rbf-3.2.1-tests.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/jdiff:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/lib:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/sources:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/hdfs/webapps:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/mapreduce/lib/hamcrest-core-1.3.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/mapreduce/lib/junit-4.11.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/mapreduce/hadoop-mapreduce-client-app-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/mapreduce/hadoop-mapreduce-client-common-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/mapreduce/hadoop-mapreduce-client-core-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-plugins-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-3.2.1-tests.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/mapreduce/hadoop-mapreduce-client-nativetask-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/mapreduce/hadoop-mapreduce-client-shuffle-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/mapreduce/hadoop-mapreduce-client-uploader-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/mapreduce/jdiff:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/mapreduce/lib:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/mapreduce/lib-examples:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/mapreduce/sources:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/aopalliance-1.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/bcpkix-jdk15on-1.60.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/bcprov-jdk15on-1.60.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/ehcache-3.3.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/fst-2.50.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/geronimo-jcache_1.0_spec-1.0-alpha-1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/guice-4.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/guice-servlet-4.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/HikariCP-java7-2.4.12.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/jackson-jaxrs-base-2.9.8.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/jackson-jaxrs-json-provider-2.9.8.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/jackson-module-jaxb-annotations-2.9.8.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/java-util-1.9.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/javax.inject-1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/jersey-client-1.19.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/jersey-guice-1.19.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/json-io-2.5.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/metrics-core-3.2.4.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/mssql-jdbc-6.2.1.jre7.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/objenesis-1.0.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/snakeyaml-1.16.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib/swagger-annotations-1.5.4.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/hadoop-yarn-api-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/hadoop-yarn-applications-distributedshell-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/hadoop-yarn-applications-unmanaged-am-launcher-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/hadoop-yarn-client-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/hadoop-yarn-common-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/hadoop-yarn-registry-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/hadoop-yarn-server-applicationhistoryservice-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/hadoop-yarn-server-common-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/hadoop-yarn-server-nodemanager-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/hadoop-yarn-server-resourcemanager-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/hadoop-yarn-server-router-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/hadoop-yarn-server-sharedcachemanager-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/hadoop-yarn-server-tests-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/hadoop-yarn-server-timeline-pluginstorage-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/hadoop-yarn-server-web-proxy-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/hadoop-yarn-services-api-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/hadoop-yarn-services-core-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/hadoop-yarn-submarine-3.2.1.jar:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/lib:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/sources:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/test:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/timelineservice:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/webapps:/home/hadoop-ha/hadoop-3.2.1/share/hadoop/yarn/yarn-service-examples</value>
</property>
</configuration>

修改works文件,添加两个服务器主机
hadoop02
Hadoop03
创建目录


7.png

最后要配置一下/home/hadoop-ha/hadoop-3.2.1/sbin/ 目录下的start-dfs.sh、stop-dfs.sh文件
HDFS_DATANODE_USER=root
HDFS_DATANODE_SECURE_USER=hdfs
HDFS_NAMENODE_USER=root
HDFS_SECONDARYNAMENODE_USER=root
同时也要配置一下/home/hadoop-ha/hadoop-3.2.1/sbin/ 目录下的start-yarn.sh、stop-yarn.sh文件
YARN_RESOURCEMANAGER_USER=root
HDFS_DATANODE_USER=yarn
YARN_NODEMANAGER_USER=root

接着是将整个hadoop-ha目录文件同步到另外两台服务器。命令如下:
scp -r hadoop-ha root@hadoop02:/home/
scp -r hadoop-ha root@hadoop03:/home/

同时也同步/etc/profile文件
scp /etc/profile root@hadoop02:/etc/
scp /etc/profile root@hadoop03:/etc/

5、启动hadoop
由于hadoop01是namenode,而hadoop02和hadoop03是datanode,所以首次启动,需要对hadoop01进行初始化操作,也就是对hdfs进行格式化化。进入到/home/hadoop-ha/hadoop-3.2.1/bin目录
需要到hadoop01机器执行初始化脚本,也就是执行命令:
./hadoop namenode -format


8.png
9.png

当看到has been successfully formatted 这些提示,即为格式化成功。
最后则可以启动整体分布式服务了。进入/home/hadoop-ha/hadoop-3.2.1/sbin 目录
执行初始化脚本,也就是执行命令
./start-all.sh

10.png

使用jps命令,看到有namenode、resourcemanager、secondarynamenode进程,则说明是启动成功。
而另外两台机器,也可以jps命令查看
hadoop02


11.png

hadoop03


12.png

同时也可以登录WebUI页面登录查看,如下:
13.png

6、至此,整体的hadoop分布式环境搭建已经是完成,成功启动服务。
四、题外话
后续会逐渐开展相应的技术安装开发,都会编写相关的技术文档,欢迎拍砖纠正。
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 216,258评论 6 498
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,335评论 3 392
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 162,225评论 0 353
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,126评论 1 292
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,140评论 6 388
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,098评论 1 295
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,018评论 3 417
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,857评论 0 273
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,298评论 1 310
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,518评论 2 332
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,678评论 1 348
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,400评论 5 343
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,993评论 3 325
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,638评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,801评论 1 268
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,661评论 2 368
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,558评论 2 352

推荐阅读更多精彩内容

  • 一、系统参数配置优化 1、系统内核参数优化配置 修改文件/etc/sysctl.conf,添加如下配置,然后执行s...
    张伟科阅读 3,748评论 0 14
  • 说明:不少读者反馈,想使用开源组件搭建Hadoop平台,然后再部署Kylin,但是遇到各种问题。这里我为读者部署一...
    大诗兄_zl阅读 2,070评论 0 2
  • 之前的有点忘记了,这里在云笔记拿出来再玩玩.看不懂的可以留言 大家可以尝试下Ambari来配置Hadoop的相关环...
    HT_Jonson阅读 2,954评论 0 50
  • 单机部署参考Hadoop安装——单机 集群部署 在每台主机配置好java环境,将hadoop安装到每台主机的/us...
    顶儿响叮当阅读 591评论 0 2
  • 2018-6-10 彩虹卡 颜色:靛蓝,眉心轮 觉知 元素:光 理解:对"头脑"的理解可以分成两部分看。一是直觉洞...
    聊愈者李奕葳阅读 793评论 0 1