JunjianS opened a new issue #7094:
URL: https://github.com/apache/dolphinscheduler/issues/7094


   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   when RM HA is enabled,set yarnHaIps="hadoop01,hadoop02", if thadoop01 is 
down,ds can't get the active RM correctly,  i think this is a bug in 2.0.0 and 
1.3.9, 
   
   method getAcitveRMName in 1.3.9
   
   ```
           public static String getAcitveRMName(String rmIds) {
   
               String[] rmIdArr = rmIds.split(Constants.COMMA);
   
               int activeResourceManagerPort = 
PropertyUtils.getInt(Constants.HADOOP_RESOURCE_MANAGER_HTTPADDRESS_PORT, 8088);
   
               String yarnUrl = "http://%s:"; + activeResourceManagerPort + 
"/ws/v1/cluster/info";
   
               String state = null;
               try {
                   /**
                    * send http get request to rm1
                    */
                   state = getRMState(String.format(yarnUrl, rmIdArr[0]));
   
                   if (Constants.HADOOP_RM_STATE_ACTIVE.equals(state)) {
                       return rmIdArr[0];
                   } else if (Constants.HADOOP_RM_STATE_STANDBY.equals(state)) {
                       state = getRMState(String.format(yarnUrl, rmIdArr[1]));
                       if (Constants.HADOOP_RM_STATE_ACTIVE.equals(state)) {
                           return rmIdArr[1];
                       }
                   } else {
                       return null;
                   }
               } catch (Exception e) {
                   state = getRMState(String.format(yarnUrl, rmIdArr[1]));
                   if (Constants.HADOOP_RM_STATE_ACTIVE.equals(state)) {
                       return rmIdArr[0];
                   }
               }
               return null;
           }
   ```
   
   
   methos getAcitveRMName in 2.0.0
   
   ```
          public static String getAcitveRMName(String rmIds) {
   
               String[] rmIdArr = rmIds.split(Constants.COMMA);
   
               int activeResourceManagerPort = 
PropertyUtils.getInt(Constants.HADOOP_RESOURCE_MANAGER_HTTPADDRESS_PORT, 8088);
   
               String yarnUrl = "http://%s:"; + activeResourceManagerPort + 
"/ws/v1/cluster/info";
   
               try {
   
                   /**
                    * send http get request to rm
                    */
   
                   for (String rmId : rmIdArr) {
                       String state = getRMState(String.format(yarnUrl, rmId));
                       if (Constants.HADOOP_RM_STATE_ACTIVE.equals(state)) {
                           return rmId;
                       }
                   }
   
               } catch (Exception e) {
                   logger.error("yarn ha application url generation failed, 
message:{}", e.getMessage());
               }
               return null;
           }
   ```
   
   ### What you expected to happen
   
   when RM HA is enabled,i think ds should get active RM correctly ,as long as 
one RM works,even when all the others are down .
   
   
   
   ### How to reproduce
   
   when RM HA is enabled,set yarnHaIps="hadoop01,hadoop02", make thadoop01  
down,ds can't get the active RM correctly。
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   2.0.0
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to