具体安装步骤参考之前的文档 https://blog.csdn.net/liyyzz33/article/details/88689594
具体安装步骤参考之前的文档 https://blog.csdn.net/liyyzz33/article/details/88397249
这只需要根据以上安装好的集群进行修改配置
修改core-site.xml
vi core-site.xml
fs.defaultFS
hdfs://node1:9000
hadoop.tmp.dir
/data/hadoop/hddata/
hadoop.proxyuser.root.hosts
*
hadoop.proxyuser.root.groups
*
ha.zookeeper.quorum
node1:2181,node2:2181,node3:2181
ha.zookeeper.session-timeout.ms
1000
ms
修改hdfs-site.xml
vi hdfs-site.xml
dfs.replication
2
dfs.namenode.secondary.http-address
node2:50090
dfs.nameservices
myha01
dfs.ha.namenodes.myha01
nn1,nn2
dfs.namenode.rpc-address.myha01.nn1
node1:9000
dfs.namenode.http-address.myha01.nn1
node1:50070
dfs.namenode.rpc-address.myha01.nn2
node2:9000
dfs.namenode.http-address.myha01.nn2
node2:50070
dfs.namenode.shared.edits.dir
qjournal://node1:8485;node2:8485;node3:8485/myha01
dfs.journalnode.edits.dir
/data/hadoop/data/journaldata
dfs.ha.automatic-failover.enabled
true
dfs.client.failover.proxy.provider.myha01
org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider
dfs.ha.fencing.methods
sshfence
shell(/bin/true)
dfs.ha.fencing.ssh.private-key-files
/home/hadoop/.ssh/id_rsa
dfs.ha.fencing.ssh.connect-timeout
30000
ha.failover-controller.cli-check.rpc-timeout.ms
60000
修改mapred-site.xml
vi mapred-site.xml
mapreduce.framework.name
yarn
mapreduce.jobhistory.address
node1:10020
mapreduce.jobhistory.webapp.address
node1:19888
修改yarn-site.xml
vi yarn-site.xml
yarn.resourcemanager.ha.enabled
true
yarn.resourcemanager.cluster-id
yrc
yarn.resourcemanager.ha.rm-ids
rm1,rm2
yarn.resourcemanager.hostname.rm1
node2
yarn.resourcemanager.hostname.rm2
node3
yarn.resourcemanager.zk-address
node1:2181,node2:2181,node3:2181
yarn.nodemanager.aux-services
mapreduce_shuffle
yarn.log-aggregation-enable
true
yarn.log-aggregation.retain-seconds
86400
yarn.resourcemanager.recovery.enabled
true
yarn.resourcemanager.store.class
org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore
scp -r /data/hadoop/hadoop-3.1.2 root@node2:/data/hadoop/
scp -r /data/hadoop/hadoop-3.1.2 root@node2:/data/hadoop/
node1
[root@node1]# /data/hadoop/zookeeper/bin/zkServer.sh start
[root@node1]# jps
2674 Jps
2647 QuorumPeerMain
[root@node1 bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /data/hadoop/zookeeper/bin/../conf/zoo.cfg
Mode: follower
node2
[root@node1]# /data/hadoop/zookeeper/bin/zkServer.sh start
[root@node1]# jps
2674 Jps
2647 QuorumPeerMain
[root@node1 bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /data/hadoop/zookeeper/bin/../conf/zoo.cfg
Mode: follower
node3
[root@node1]# /data/hadoop/zookeeper/bin/zkServer.sh start
[root@node1]# jps
2674 Jps
2647 QuorumPeerMain
[root@node1 bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /data/hadoop/zookeeper/bin/../conf/zoo.cfg
Mode: leader
按照之前的规划,我的是在hadoop1、hadoop2、hadoop3上进行启动,启动命令如下
cd /data/hadoop/hadoop-2.7.7/sbin/
./hadoop-daemon.sh start journalnode
[root@node1 bin]# jps
2739 JournalNode
2788 Jps
2647 QuorumPeerMain
hadoop namenode -format
scp -r /data/hadoop/hddata root@node2:/data/hadoop/
重点强调:只能在nameonde节点进行
hdfs zkfc -formatZK
cd /data/hadoop/hadoop-2.7.7/sbin/
./start-dfs.sh
在主备 resourcemanager 中随便选择一台进行启动
cd /data/hadoop/hadoop-2.7.7/sbin/
./start-yarn.sh
若备用节点的 resourcemanager 没有启动起来,则手动启动起来,在node2,node3上进行手动启动
./yarn-daemon.sh start resourcemanager
./mr-jobhistory-daemon.sh start historyserver
HDFS
[root@node1]# hdfs haadmin -getServiceState nn1
standby
[root@node1]# hdfs haadmin -getServiceState nn2
active
YARN
[root@node1]# yarn rmadmin -getServiceState rm1
standby
[root@node1]# yarn rmadmin -getServiceState rm2
active
[root@node1]#
5、WEB界面进行查看
YARN