Hadoop2 Namenode ha + federated + Resource Manager ha Experiment

Source: Internet
Author: User
Tags failover

The Hadoop version of the experiment was 2.5.2, the hardware environment is 5 virtual machines, using the CentOS6.6 operating system, the virtual machine IP and hostname are:
192.168.63.171 Node1.zhch
192.168.63.172 Node2.zhch
192.168.63.173 Node3.zhch
192.168.63.174 Node4.zhch
192.168.63.175 Node5.zhch

SSH password-free, firewall, JDK here is not a repeat. The role assignments for virtual machines are:
Node1 main Namenode1, Master Resource Manager, zookeeper, Journalnode
Node2 to prepare namendoe1, zookeeper, Journalnode
Node3 main Namenode2, resource Manager, Zookeeper, Journalnode, Datanode
Node4 to prepare Namenode2, Datanode
Node5 to Datanode

Step and Namenode ha installation configuration is basically the same, you need to install zookeeper cluster, the main difference is core-site.xml, hdfs-site.xml, yarn-site.xml configuration files, the rest of the file configuration and Namenode The HA installation configuration is basically the same.

First, configure Hadoop
# # Unzip [[email protected] program]$ tar-zxf hadoop-2.5.2.tar.gz## Create folder [[email protected] program]$ mkdir Hadoop-2.5.2/name[[email protected] program]$ mkdir hadoop-2.5.2/data[[email protected] program]$ mkdir Hadoop-2.5.2/journal[[email protected] program]$ mkdir hadoop-2.5.2/tmp## configuration hadoop-env.sh[[email  Protected] program]$ CD hadoop-2.5.2/etc/hadoop/[[email protected] hadoop]$ vim hadoop-env.shexport JAVA_HOME=/ usr/lib/java/jdk1.7.0_80## configuration yarn-env.sh[[email protected] hadoop]$ vim yarn-env.shexport JAVA_HOME=/usr/lib/ java/jdk1.7.0_80## configuration slaves[[email protected] hadoop]$ vim slavesnode3.zhchnode4.zhchnode5.zhch## Configuration mapred-site.xml[[email protected] hadoop]$ CP mapred-site.xml.template mapred-site.xml[[email  Protected] hadoop]$ vim mapred-site.xml<configuration><property> <name>mapreduce.framework.name </name> <value>yarn</value></property><property> <name>mapreduce.jobhistory.address</name> <value>node2.zhch:10020</value> </property> <property> <name >mapreduce.jobhistory.webapp.address</name> <value>node2.zhch:19888</value> </property ></configuration>## configuration core-site.xml[[email protected] hadoop]$ vim core-site.xml<configuration ><property> <name>fs.defaultFS</name> <value>hdfs://mycluster</value></ Property><property> <name>io.file.buffer.size</name> <value>131072</value></ Property><property> <name>hadoop.tmp.dir</name> <value>file:/home/yyl/program/ Hadoop-2.5.2/tmp</value></property><property> <name>hadoop.proxyuser.hduser.hosts</ Name> <value>*</value></property><property> <name> Hadoop.proxyuser.hduser.groups</name> <value>*</value></property><property> < Name>ha.zookeeper.quOrum</name> <value>node1.zhch:2181,node2.zhch:2181,node3.zhch:2181</value></property> <property> <name>ha.zookeeper.session-timeout.ms</name> <value>1000</value></ property></configuration>## configuration hdfs-site.xml[[email protected] hadoop]$ vim hdfs-site.xml< Configuration><property> <name>dfs.namenode.name.dir</name> <value>file:/home/yyl/ Program/hadoop-2.5.2/name</value></property><property> <name>dfs.datanode.data.dir</  Name> <value>file:/home/yyl/program/hadoop-2.5.2/data</value></property><property> <name>dfs.replication</name> <value>1</value></property><property> <name >dfs.webhdfs.enabled</name> <value>true</value></property><property> <name >dfs.permissions</name> <value>false</value></property><property> <name>d fs.permissions.enabled</name> <value>false</value></property><property> <name >dfs.nameservices</name> <value>mycluster,yourcluster</value></property><property > <name>dfs.ha.namenodes.mycluster</name> <value>nn1,nn2</value></property>< Property> <name>dfs.namenode.rpc-address.mycluster.nn1</name> <value>node1.zhch:9000</ Value></property><property> <name>dfs.namenode.rpc-address.mycluster.nn2</name> < Value>node2.zhch:9000</value></property><property> <name> Dfs.namenode.servicerpc-address.mycluster.nn1</name> <value>node1.zhch:53310</value></ Property><property> <name>dfs.namenode.servicerpc-address.mycluster.nn2</name> <value >node2.zhch:53310</value></property><property> <name> Dfs.namenode.http-address.mycluster.nn1</name&gT <value>node1.zhch:50070</value></property><property> <name> Dfs.namenode.http-address.mycluster.nn2</name> <value>node2.zhch:50070</value></property ><property> <name>dfs.ha.namenodes.yourcluster</name> <value>nn1,nn2</value> </property><property> <name>dfs.namenode.rpc-address.yourcluster.nn1</name> <value >node3.zhch:9000</value></property><property> <name> Dfs.namenode.rpc-address.yourcluster.nn2</name> <value>node4.zhch:9000</value></property ><property> <name>dfs.namenode.servicerpc-address.yourcluster.nn1</name> <value> Node3.zhch:53310</value></property><property> <name> Dfs.namenode.servicerpc-address.yourcluster.nn2</name> <value>node4.zhch:53310</value></ Property><property> <name>dfs.namenode.http-address.yourcluster.nn1</Name> <value>node3.zhch:50070</value></property><property> <name> Dfs.namenode.http-address.yourcluster.nn2</name> <value>node4.zhch:50070</value></property ><property> <name>dfs.namenode.shared.edits.dir</name> <value>qjournal://node1.zhch :8485;node2.zhch:8485;node3.zhch:8485/mycluster</value></property><property> <name> Dfs.client.failover.proxy.provider.mycluster</name> <value> org.apache.hadoop.hdfs.server.namenode.ha.configuredfailoverproxyprovider</value></property>< Property> <name>dfs.client.failover.proxy.provider.yourcluster</name> <value> org.apache.hadoop.hdfs.server.namenode.ha.configuredfailoverproxyprovider</value></property>< Property> <name>dfs.ha.fencing.methods</name> <value>sshfence</value></property ><property> <name>dfs.ha.fencing.ssh.private-key-fileS</name> <value>/home/yyl/.ssh/id_rsa</value></property><property> <name> Dfs.ha.fencing.ssh.connect-timeout</name> <value>30000</value></property><property > <name>dfs.journalnode.edits.dir</name> <value>/home/yyl/program/hadoop-2.5.2/journal</  Value></property><property> <name>dfs.ha.automatic-failover.enabled.mycluster</name> <value>true</value></property><property> <name> Dfs.ha.automatic-failover.enabled.yourcluster</name> <value>true</value></property>< Property> <name>ha.failover-controller.cli-check.rpc-timeout.ms</name> <value>60000</ Value></property><property> <name>ipc.client.connect.timeout</name> <value> 60000</value></property><property> <name>dfs.image.transfer.bandwidthpersec</name > <value>4194304</value></property></configuration>## configuration yarn-site.xml[[email protected] hadoop]$ vim Yarn-site.xml<configuration><property> <name>yarn.nodemanager.aux-services</name> < Value>mapreduce_shuffle</value></property><property> <name> Yarn.nodemanager.aux-services.mapreduce.shuffle.class</name> <value> Org.apache.hadoop.mapred.shufflehandler</value></property><property> <name> Yarn.resourcemanager.connect.retry-interval.ms</name> <value>2000</value></property> <property> <name>yarn.resourcemanager.ha.enabled</name> <value>true</value></ Property><property> <name>yarn.resourcemanager.ha.automatic-failover.enabled</name> < Value>true</value></property><property> <name> Yarn.resourcemanager.ha.automatic-failover.embedded</name> <value>true</value></property&Gt;<property> <name>yarn.resourcemanager.cluster-id</name> <value>yarn-cluster</value ></property><property> <name>yarn.resourcemanager.ha.rm-ids</name> <value>rm1, Rm2</value></property><property> <name>yarn.resourcemanager.ha.id</name> <value >rm1</value></property><property> <name>yarn.resourcemanager.scheduler.class</ Name> <value>org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler</value> </property><property> <name>yarn.resourcemanager.recovery.enabled</name> <value> True</value></property><property> <name> Yarn.app.mapreduce.am.scheduler.connection.wait.interval-ms</name> <value>5000</value></ Property><property> <name>yarn.resourcemanager.store.class</name> <value> Org.apache.hadoop.yarn.server.resourcemanager.recoVery. Zkrmstatestore</value></property><property> <name>yarn.resourcemanager.zk-address</ Name> <value>node1.zhch:2181,node2.zhch:2181,node3.zhch:2181</value></property>< Property> <name>yarn.resourcemanager.zk.state-store.address</name> <value>node1.zhch:2181, Node2.zhch:2181,node3.zhch:2181</value></property><property> <name> Yarn.resourcemanager.address.rm1</name> <value>node1.zhch:23140</value></property>< Property> <name>yarn.resourcemanager.address.rm2</name> <value>node3.zhch:23140</value ></property><property> <name>yarn.resourcemanager.scheduler.address.rm1</name> < Value>node1.zhch:23130</value></property><property> <name> Yarn.resourcemanager.scheduler.address.rm2</name> <value>node3.zhch:23130</value></ Property><property> &LT;NAME&GT;YARN.REsourcemanager.admin.address.rm1</name> <value>node1.zhch:23141</value></property>< Property> <name>yarn.resourcemanager.admin.address.rm2</name> <value>node3.zhch:23141</ Value></property><property> <name>yarn.resourcemanager.resource-tracker.address.rm1</ Name> <value>node1.zhch:23125</value></property><property> <name> Yarn.resourcemanager.resource-tracker.address.rm2</name> <value>node3.zhch:23125</value></ Property><property> <name>yarn.resourcemanager.webapp.address.rm1</name> <value> Node1.zhch:23188</value></property><property> <name> Yarn.resourcemanager.webapp.address.rm2</name> <value>node3.zhch:23188</value></property ><property> <name>yarn.resourcemanager.webapp.https.address.rm1</name> <value> node1.zhch:23189</value></property><Property> <name>yarn.resourcemanager.webapp.https.address.rm2</name> <value>node3.zhch : 23189</value></property></configuration>## distributed to individual nodes [[email protected] hadoop]$ Cd/home/yyl /program/[[email protected] program]$ scp-rp hadoop-2.5.2 [email protected]:/home/yyl/program/[[email  protected] program]$ scp-rp hadoop-2.5.2 [email protected]:/home/yyl/program/[[email protected] program]$ SCP-RP hadoop-2.5.2 [email protected]:/home/yyl/program/[[email protected] program]$ SCP-RP hadoop-2.5.2 [email protected]:/home/yyl/program/## Modify the main namenode2 (NODE3.ZHCH) and the Namenode2 (NODE4.ZHCH) The value of Dfs.namenode.shared.edits.dir in the Hdfs-site.xml configuration file is qjournal://node1.zhch:8485;node2.zhch:8485;node3.zhch:8485/ Yourcluster, the remaining property values do not change. # # Modify Resource Manager (NODE3.ZHCH) The value of yarn.resourcemanager.ha.id in the Yarn-site.xml configuration file is Rm2 and the remaining property values are unchanged. # # Set the HADOOP environment variable on each node [[email protected] ~]$ vim. Bash_profile Export hadoop_prefix=/home/yyl/Program/hadoop-2.5.2export hadoop_common_home= $HADOOP _prefixexport hadoop_hdfs_home= $HADOOP _prefixexport HADOOP_ Mapred_home= $HADOOP _prefixexport hadoop_yarn_home= $HADOOP _prefixexport hadoop_conf_dir= $HADOOP _prefix/etc/ Hadoopexport path= $PATH: $HADOOP _prefix/bin: $HADOOP _prefix/sbin


second, format and start

# # Start Zookeeper Cluster # # Execute command on main namenode1 (NODE1.ZHCH), main Namenode2 (NODE3.ZHCH): $HADOOP _home/bin/hdfs Zkfc-formatzk[[email  protected] ~]$ HDFs zkfc-formatzk[[email protected] ~]$ hdfs zkfc-formatzk[[email protected] ~]$ ZkCli . sh[zk:localhost:2181 (CONNECTED) 0] ls/[hadoop-ha, zookeeper][zk:localhost:2181 (CONNECTED) 1] ls/hadoop-ha[ Mycluster, yourcluster]## on node1.zhch node2.zhch node3.zhch journalnode:[[email protected] ~]$ hadoop-daemon.sh start journalnodestarting journalnode, logging to/home/yyl/program/hadoop-2.5.2/logs/ Hadoop-yyl-journalnode-node1.zhch.out[[email protected] ~]$ jps1985 QuorumPeerMain2222 Jps2176 journalnode[[ Email protected] ~]$ hadoop-daemon.sh start journalnodestarting journalnode, logging to/home/yyl/program/ Hadoop-2.5.2/logs/hadoop-yyl-journalnode-node2.zhch.out[[email protected] ~]$ jps1783 Jps1737 JournalNode1638 Quorumpeermain[[email protected] ~]$ hadoop-daemon.sh start journalnodestarting journalnode, logging to/Home/yyl/program/hadoop-2.5.2/logs/hadoop-yyl-journalnode-node3.zhch.out[[email protected] ~]$ jps1658 JournalNode1495 QuorumPeerMain1704 jps## formatted NODE1.ZHCH] namenode[[email protected HDFs on main namenode1 (~]$) Namenode-format-clusterid c1## Start the Namenode process on the main namenode1 (NODE1.ZHCH) [[email protected] ~]$ hadoop-daemon.sh Start namenodestarting Namenode, logging to/home/yyl/program/hadoop-2.5.2/logs/hadoop-yyl-namenode-node1.zhch.out[ [email protected] ~]$ jps2286 NameNode1985 QuorumPeerMain2369 Jps2176 journalnode## in preparation namenode1 (NODE2.ZHCH) on synchronization metadata [[email protected] ~]$ HDFs namenode-bootstrapstandby## start the node2.zhch process on standby namenode1 (namenode) [[Email  protected] ~]$ hadoop-daemon.sh start namenodestarting namenode, logging to/home/yyl/program/hadoop-2.5.2/logs/ Hadoop-yyl-namenode-node2.zhch.out[[email protected] ~]$ jps1923 Jps1737 JournalNode1638 QuorumPeerMain1840 namenode## format namenode[[email protected] ~]$ HDFs namenode-format-clu on main namenode2 (NODE3.ZHCH)Sterid c1## Start the Namenode process on the main namenode2 (NODE3.ZHCH) [[email protected] ~]$ hadoop-daemon.sh start namenodestarting Namenode, logging to/home/yyl/program/hadoop-2.5.2/logs/hadoop-yyl-namenode-node3.zhch.out[[email protected ] ~]$ jps1658 JournalNode1495 QuorumPeerMain1767 NameNode1850 jps## synchronizing meta data on standby namenode2 (NODE4.ZHCH) [[email  Protected] ~]$ HDFs namenode-bootstrapstandby## start the node4.zhch process on standby namenode2 (Namenode) [[email protected] ~]$ hadoop-daemon.sh start namenodestarting namenode, logging to/home/yyl/program/hadoop-2.5.2/logs/ Hadoop-yyl-namenode-node4.zhch.out[[email protected] ~]$ jps1602 Jps1519 namenode## start datanode[[email  Protected] ~]$ hadoop-daemons.sh start datanodenode4.zhch:starting datanode, logging to/home/yyl/program/hadoop-2.5.2 /logs/hadoop-yyl-datanode-node4.zhch.outnode5.zhch:starting Datanode, logging to/home/yyl/program/hadoop-2.5.2/ Logs/hadoop-yyl-datanode-node5.zhch.outnode3.zhch:starting Datanode, logging to/home/yyl/program/hadoop-2.5.2/logs/hadoop-yyl-datanode-node3.zhch.out## start yarn[[email protected] ~]$ start-yarn.shstarting yarn Daemonsstarting ResourceManager, logging to/home/yyl/program/hadoop-2.5.2/logs/ Yarn-yyl-resourcemanager-node1.zhch.outnode3.zhch:starting NodeManager, logging to/home/yyl/program/hadoop-2.5.2/ Logs/yarn-yyl-nodemanager-node3.zhch.outnode4.zhch:starting NodeManager, logging to/home/yyl/program/hadoop-2.5.2 /logs/yarn-yyl-nodemanager-node4.zhch.outnode5.zhch:starting NodeManager, logging to/home/yyl/program/ hadoop-2.5.2/logs/yarn-yyl-nodemanager-node5.zhch.out## start on all Namenode zookeeperfailovercontroller[[email  Protected] ~]$ hadoop-daemon.sh start zkfcstarting zkfc, logging to/home/yyl/program/hadoop-2.5.2/logs/ Hadoop-yyl-zkfc-node1.zhch.out[[email protected] ~]$ hadoop-daemon.sh start zkfcstarting zkfc, logging to/home/ Yyl/program/hadoop-2.5.2/logs/hadoop-yyl-zkfc-node2.zhch.out[[email protected] ~]$ hadoop-daemon.sh start Zkfcstarting ZKFC, logging To/home/yyl/program/hadoop-2.5.2/logs/hadoop-yyl-zkfc-node3.zhch.out[[email protected] ~]$ hadoop-daemon.sh start Zkfcstarting ZKFC, logging to/home/yyl/program/hadoop-2.5.2/logs/hadoop-yyl-zkfc-node4.zhch.out## in preparation resource Manager (NODE3.ZHCH) start resource manager[[email protected] ~]$ yarn-daemon.sh start resourcemanagerstarting ResourceManager, logging to/home/yyl/program/hadoop-2.5.2/logs/yarn-yyl-resourcemanager-node3.zhch.out## View Resource Manager status [[email protected] ~]$ yarn rmadmin-getservicestate rm1active[[email protected] ~]$ Yarn Rmadmin-getservicestate Rm2standby


Third, verification













Open two terminals, connect to the main resource manager, run the JPS command in Terminal A to view the resource Manager process ID, run the MapReduce program in Terminal B, and then kill the resource manager process in Terminal a The last observation is whether the MapReduce task can be executed properly after the main resource manager process has been hung.






Hadoop2 Namenode ha + federated + Resource Manager ha Experiment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.