<? XML version = "1.0"?> <! -- Licensed under the Apache license, version 2.0 (the "License"); you may not use this file license t in compliance with the license. you may obtain a copy of the license at http://www.apache.org/licenses/LICENSE-2.0 unless required by applicable law or agreed to in writing, software distributed under the license is distributed on an "as is" basis, without warranties or conditions of any kind, either Express or implied. See the license for the specific language governing permissions and limitations under the license. See accompanying license file. --> <configuration> <! -- Site specific yarn configuration properties --> <property> <Name> yarn. resourceManager. ha. enabled </Name> <value> true </value> </property> <Name> yarn. resourceManager. ha. rm-IDs </Name> <value> RM1, RM2 </value> </property> <Name> yarn. resourceManager. hostname. rm1 </Name> <value> RM1 </value> </property> <Name> yarn. resourceManager. hostname. RM2 </Name> <value> RM2 </value> </prop Erty> <property> <Name> yarn. resourceManager. recovery. enabled </Name> <value> true </value> </property> <Name> yarn. resourceManager. store. class </Name> <value> Org. apache. hadoop. yarn. server. resourceManager. recovery. zkrmstatestore </value> </property> <Name> yarn. resourceManager. ZK-address </Name> <value> zk1: 2181, ZK2: 2181, zk3: 2181 </value> </property> <Name> yarn. resourcemanage R. Ha. ID </Name> <value> RM1 </value> <description> Each RM node is configured separately. For example, RM1 and RM2 </description> </property> <Name> yarn. resourceManager. cluster-id </Name> <value> hbasecluster </value> </property> <Name> yarn. resourceManager. address. rm1 </Name> <value> RM1: 8080 </value> </property> <Name> yarn. resourceManager. scheduler. address. rm1 </Name> <value> RM1: 8081 </value> </property> <Name> yarn. resourceManager. resource-tracker.address.rm1 </Name> <value> RM1: 8082 </value> </property> <Name> yarn. resourceManager. admin. address. rm1 </Name> <value> RM1: 23141 </value> </property> <Name> yarn. resourceManager. ha. admin. address. rm1 </Name> <value> RM1: 23142 </value> </property> <Name> yarn. resourceManager. webapp. address. rm1 </Name> <value> RM1: 23188 </value> </property> <Name> yarn. resourceManager. address. RM2 </Name> <value> RM2: 8080 </value> </property> <Name> yarn. resourceManager. scheduler. address. RM2 </Name> <value> RM2: 8081 </value> </property> <Name> yarn. resourceManager. resource-tracker.address.rm2 </Name> <value> RM2: 8082 </value> </property> <Name> yarn. resourceManager. admin. address. RM2 </Name> <value> RM2: 23141 </value> </property> <Name> yarn. resourceManager. ha. admin. address. RM2 </Name> <value> RM2: 23142 </value> </property> <Name> yarn. resourceManager. webapp. address. RM2 </Name> <value> RM2: 23188 </value> </property> <Name> yarn. nodemanager. aux-services </Name> <value> mapreduce_shuffle </value> </property> <Name> yarn. nodemanager. aux-services.mapreduce_shuffle.class </Name> <value> Org. apache. hadoop. mapred. shufflehandler </value> </property> </configuration>
1. Note that yarn. ResourceManager. Ha. ID is separately configured for each RM node.
2. After configuration, use the frontend mode to start and check whether the configuration is correct.
yarn resourcemanager
3. Use the Service Startup command. Note that each RM node needs to be started.
yarn-daemon.sh start resourcemanager
4. Verification: Normally, the RM1 (IP = 103) node is an active node, and the RM2 (IP = 104) node is a backup node.
As shown in the figure, this is the normal startup result:
Kill the process on RM1 and restart it. Now let's look at it again:
It is found that RM2 has become an active node. If the process on RM2 is killed and restarted, RM1 switches back to the active node and RM2 switches back to the STANDBY state.