第二步:hadoop 完全分布式集群安装

1.下载hadoop zookeeper-3.4.7.tar

上传到 /home底下

2.tar -zxvf  zookeeper-3.4.7.tar

3.配置 hadoop环境变量

vim  /etc/profile

因为hadoop依赖java环境 必须先配置JAVA_HOME

加入环境变量

export HADOOP_HOME=/home/hadoop-2.7.1/

export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin

4.添加hadoop 数据存储目录

cd /home/hadoop-2.7.1/

mkdir tmp

cd tmp

mkdir data

mkdir journal

mkdir name

5.配置hadoop集群的配置文件

1> 配置hadoop环境变量

cd /home/hadoop-2.7.1/etc/hadoop

vim hadoop-env.sh

export JAVA_HOME=/home/jdk1.8.0_131

:wq

2>配置hadoop核心的配置 core.site.xml

fs.defaultFS

hdfs://ns

hadoop.tmp.dir

/home/hadoop-2.7.1/tmp

io.file.buffer.size

4096

ha.zookeeper.quorum

hadoop1:2181,hadoop2:2181,hadoop3:2181,hadoop4:2181,hadoop5:2181

fs.defaultFS

hdfs://ns

hadoop.tmp.dir

/home/hadoop-2.7.1/tmp

io.file.buffer.size

4096

ha.zookeeper.quorum

hadoop1:2181,hadoop2:2181,hadoop3:2181,hadoop4:2181,hadoop5:2181

3>配置hadoop hdfs数据存储方式 hdfs-site.xml

dfs.nameservices

ns

dfs.ha.namenodes.ns

nn1,nn2

dfs.namenode.rpc-address.ns.nn1

hadoop1:9000

dfs.namenode.http-address.ns.nn1

hadoop1:50070

dfs.namenode.rpc-address.ns.nn2

hadoop2:9000

dfs.namenode.http-address.ns.nn2

hadoop2:50070

dfs.namenode.shared.edits.dir

qjournal://hadoop3:8485;hadoop4:8485;hadoop5:8485/ns

dfs.journalnode.edits.dir

/home/hadoop-2.7.1/tmp/journal

dfs.ha.automatic-failover.enabled

true

dfs.client.failover.proxy.provider.ns

org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider

dfs.ha.fencing.methods

sshfence

dfs.ha.fencing.ssh.private-key-files

/root/.ssh/id_rsa

dfs.namenode.name.dir

/home/hadoop-2.7.1/tmp/name

dfs.datanode.data.dir

/home/hadoop-2.7.1/tmp/data

dfs.replication

2

dfs.webhdfs.enabled

true

4>配置mapred  mapred-site.xml

cp mapred-site.xml.template mapred-site.xml

mapreduce.framework.name

yarn

5>配置yarn yarn-site.xml

yarn.nodemanager.aux-services

mapreduce_shuffle

yarn.resourcemanager.hostname

hadoop1

6>配置数据解读 salves

vim salves

hadoop3

hadoop4

hadoop5

7.scp 到 其他4台服务器上

scp -r hadoop-2.7.1 root@hadoop2:/home

scp -r hadoop-2.7.1 root@hadoop3:/home

scp -r hadoop-2.7.1 root@hadoop4:/home

scp -r hadoop-2.7.1 root@hadoop5:/home

8.统一在5台机器上启动 zk

cd /home/zookeeper-3.4.7/bin

./zkServer.sh start

9.启动jn journalnode 节点

cd /home/hadoop-2.7.1/sbin

./hadoop-daemons.sh start journalnode  [注意是daemons sss]

10.首次启动 格式化干干净净一下 后期启动千万千万不要执行这些命令

hdfs zkfc -formatZK

hadoop namenode -fromat

11.启动namenode 有两台 分别启动

hadoop1: hadoop-daemon.sh start namenode

hadoop2:

hdfs namenode -bootstrapStandby #这个命令把namenode 的数据同步到hadoop2

hadoop-daemon.sh start namenode #启动备份的namenode

12.启动datanode

hadoop-daemons.sh start datanode  [注意daemons ssssss]

13.启动 yarn

start-yarn.sh

14.在hadoop1 hadoop2上分别启动 zkfc

hadoop-daemon.sh start zkfc

hadoop-daemon.sh start zkfc

15.所有启动

jps 查看 hadoop 1 2 3 4 5

你可能感兴趣的:(第二步:hadoop 完全分布式集群安装)