Explorar el Código

AMBARI-14284. Push yarn.resourcemanager.ha and yarn.resourcemanager.scheduler.ha properties when RM HA is enabled on cluster with hawq(Bhuvnesh Chaudhary via odiachenko).

Oleksandr Diachenko hace 9 años
padre
commit
3a9b0bbaf5

+ 51 - 8
ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js

@@ -26,10 +26,18 @@ App.RMHighAvailabilityWizardStep4Controller = App.HighAvailabilityProgressPageCo
 
   clusterDeployState: 'RM_HIGH_AVAILABILITY_DEPLOY',
 
-  commands: ['stopRequiredServices', 'installResourceManager', 'reconfigureYARN', 'startAllServices'],
+  commands: ['stopRequiredServices', 'installResourceManager', 'reconfigureYARN', 'reconfigureHAWQ', 'startAllServices'],
 
   tasksMessagesPrefix: 'admin.rm_highAvailability.wizard.step',
 
+  initializeTasks: function () {
+    this._super();
+    var numSpliced = 0;
+    if (!App.Service.find().someProperty('serviceName', 'HAWQ')) {
+      this.get('tasks').splice(this.get('tasks').findProperty('command', 'reconfigureHAWQ').get('id'), 1);
+    }
+  },
+
   stopRequiredServices: function () {
     this.stopServices(['HDFS']);
   },
@@ -40,32 +48,49 @@ App.RMHighAvailabilityWizardStep4Controller = App.HighAvailabilityProgressPageCo
   },
 
   reconfigureYARN: function () {
-    this.loadConfigsTags();
+    this.loadConfigsTags("Yarn");
+  },
+
+  reconfigureHAWQ: function () {
+    this.loadConfigsTags("Hawq");
   },
 
-  loadConfigsTags: function () {
+  loadConfigsTags: function (service) {
+    onLoadServiceConfigsTags = 'onLoad' + service + "ConfigsTags"
     App.ajax.send({
       name: 'config.tags',
       sender: this,
-      success: 'onLoadConfigsTags',
+      success: onLoadServiceConfigsTags,
       error: 'onTaskError'
     });
   },
 
-  onLoadConfigsTags: function (data) {
+  onLoadYarnConfigsTags: function (data) {
     App.ajax.send({
       name: 'reassign.load_configs',
       sender: this,
       data: {
         urlParams: '(type=yarn-site&tag=' + data.Clusters.desired_configs['yarn-site'].tag + ')'
       },
-      success: 'onLoadConfigs',
+      success: 'onLoadYarnConfigs',
+      error: 'onTaskError'
+    });
+  },
+
+  onLoadHawqConfigsTags: function (data) {
+    App.ajax.send({
+      name: 'reassign.load_configs',
+      sender: this,
+      data: {
+        urlParams: '(type=yarn-client&tag=' + data.Clusters.desired_configs['yarn-client'].tag + ')'
+      },
+      success: 'onLoadHawqConfigs',
       error: 'onTaskError'
     });
   },
 
-  onLoadConfigs: function (data) {
-    var propertiesToAdd = this.get('content.configs');
+  onLoadYarnConfigs: function (data) {
+    var propertiesToAdd = this.get('content.configs').filterProperty('filename', 'yarn-site');
     propertiesToAdd.forEach(function (property) {
       data.items[0].properties[property.name] = property.value;
     });
@@ -83,6 +108,24 @@ App.RMHighAvailabilityWizardStep4Controller = App.HighAvailabilityProgressPageCo
     });
   },
 
+  onLoadHawqConfigs: function (data) {
+    var propertiesToAdd = this.get('content.configs').filterProperty('filename', 'yarn-client');
+    propertiesToAdd.forEach(function (property) {
+      data.items[0].properties[property.name] = property.value;
+    });
+
+    var configData = this.reconfigureSites(['yarn-client'], data, Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format(App.format.role('RESOURCEMANAGER')));
+
+    App.ajax.send({
+      name: 'common.service.configurations',
+      sender: this,
+      data: {
+        desired_config: configData
+      },
+      success: 'onSaveConfigs',
+      error: 'onTaskError'
+    });
+  },
   onSaveConfigs: function () {
     this.onTaskCompleted();
   },

+ 26 - 2
ambari-web/app/data/HDP2/rm_ha_properties.js

@@ -22,9 +22,10 @@ module.exports =
     serviceName: 'MISC',
     displayName: 'MISC',
     configCategories: [
-      App.ServiceConfigCategory.create({ name: 'YARN', displayName: 'YARN'})
+      App.ServiceConfigCategory.create({ name: 'YARN', displayName: 'YARN'}),
+      App.ServiceConfigCategory.create({ name: 'HAWQ', displayName: 'HAWQ'})
     ],
-    sites: ['yarn-site'],
+    sites: ['yarn-site', 'hawq-site'],
     configs: [
     /**********************************************HDFS***************************************/
       {
@@ -160,6 +161,29 @@ module.exports =
         "category": "YARN",
         "filename": "yarn-site",
         serviceName: 'MISC'
+      },
+    /**********************************************HAWQ***************************************/
+      {
+        "name": "yarn.resourcemanager.ha",
+        "displayName": "yarn.resourcemanager.ha",
+        "description": "Comma separated yarn resourcemanager host addresses with port",
+        "isReconfigurable": false,
+        "recommendedValue": "",
+        "value": "",
+        "category": "HAWQ",
+        "filename": "yarn-client",
+        serviceName: 'MISC'
+      },
+      {
+        "name": "yarn.resourcemanager.scheduler.ha",
+        "displayName": "yarn.resourcemanager.scheduler.ha",
+        "description": "Comma separated yarn resourcemanager scheduler addresses with port",
+        "isReconfigurable": false,
+        "recommendedValue": "",
+        "value": "",
+        "category": "HAWQ",
+        "filename": "yarn-client",
+        serviceName: 'MISC'
       }
     ]
   }

+ 2 - 1
ambari-web/app/messages.js

@@ -1325,7 +1325,8 @@ Em.I18n.translations = {
   'admin.rm_highAvailability.wizard.step4.task0.title': 'Stop Required Services',
   'admin.rm_highAvailability.wizard.step4.task1.title': 'Install Additional ResourceManager',
   'admin.rm_highAvailability.wizard.step4.task2.title': 'Reconfigure YARN',
-  'admin.rm_highAvailability.wizard.step4.task3.title': 'Start All Services',
+  'admin.rm_highAvailability.wizard.step4.task3.title': 'Reconfigure HAWQ',
+  'admin.rm_highAvailability.wizard.step4.task4.title': 'Start All Services',
   'admin.rm_highAvailability.wizard.step4.notice.inProgress':'Please wait while ResourceManager HA is being deployed.',
   'admin.rm_highAvailability.wizard.step4.notice.completed':'ResourceManager HA has been enabled successfully.',
 

+ 46 - 1
ambari-web/app/utils/configs/rm_ha_config_initializer.js

@@ -19,6 +19,21 @@
 var App = require('app');
 require('utils/configs/config_initializer_class');
 
+/**
+ * Settings for <code>rm_hosts_with_port</code> initializer
+ * Used for configs that have to be updated with Yarn Resourcemanager HA hosts
+ * addresses and a port to the <code>rmhost1:port,rmhost2:port</code>
+ *
+ * @param {int} port
+ * @returns {{type: string, port: *}}
+ */
+function getRmHaHostsWithPort(port) {
+  return {
+    type: 'rm_hosts_with_port',
+    port: port
+  };
+}
+
 /**
  * Initializer for configs that are updated when Resource Manager HA-mode is activated
  *
@@ -33,7 +48,37 @@ App.RmHaConfigInitializer = App.HaConfigInitializerClass.create({
     'yarn.resourcemanager.webapp.address.rm1': App.HaConfigInitializerClass.getHostWithPortConfig('RESOURCEMANAGER', true, '', '', 'webAddressPort', true),
     'yarn.resourcemanager.webapp.address.rm2': App.HaConfigInitializerClass.getHostWithPortConfig('RESOURCEMANAGER', false, '', '', 'webAddressPort', true),
     'yarn.resourcemanager.webapp.https.address.rm1': App.HaConfigInitializerClass.getHostWithPortConfig('RESOURCEMANAGER', true, '', '', 'httpsWebAddressPort', true),
-    'yarn.resourcemanager.webapp.https.address.rm2': App.HaConfigInitializerClass.getHostWithPortConfig('RESOURCEMANAGER', false, '', '', 'httpsWebAddressPort', true)
+    'yarn.resourcemanager.webapp.https.address.rm2': App.HaConfigInitializerClass.getHostWithPortConfig('RESOURCEMANAGER', false, '', '', 'httpsWebAddressPort', true),
+    'yarn.resourcemanager.ha': getRmHaHostsWithPort(8032),
+    'yarn.resourcemanager.scheduler.ha': getRmHaHostsWithPort(8030)
+  },
+
+  initializerTypes: [
+    {name: 'rm_hosts_with_port', method: '_initRmHaHostsWithPort'},
+  ],
+  
+  /**
+   * Initializer for configs that should be updated with yarn resourcemanager ha host addresses with port
+   *
+   * @param {configProperty} configProperty
+   * @param {extendedTopologyLocalDB} localDB
+   * @param {HaConfigDependencies} dependencies
+   * @param {object} initializer
+   * @returns {object}
+   * @private
+   * @method _initRmHaHostsWithPort
+   */
+  _initRmHaHostsWithPort: function (configProperty, localDB, dependencies, initializer) {
+    var rmHosts = localDB.masterComponentHosts.filterProperty('component', 'RESOURCEMANAGER').getEach('hostName');
+    for (rmHost in rmHosts) {
+      rmHosts[rmHost] = rmHosts[rmHost] + ":" + initializer.port;
+    }
+    var value = rmHosts.join(',');
+    Em.setProperties(configProperty, {
+      'value': value,
+      'recommendedValue': value
+    });
+   return configProperty;
   }
 
 });

+ 11 - 0
ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js

@@ -268,6 +268,12 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function () {
           }),
           Em.Object.create({
             name: 'yarn.resourcemanager.webapp.https.address.rm2'
+          }),
+          Em.Object.create({
+            name: 'yarn.resourcemanager.ha'
+          }),
+          Em.Object.create({
+            name: 'yarn.resourcemanager.scheduler.ha'
           })
         ]
       };
@@ -316,6 +322,11 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function () {
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.zk-address').get('recommendedValue')).to.equal('h2:2222,h3:2222');
     });
 
+    it('Setting new HAWQ RM properties values', function () {
+      expect(configs.configs.findProperty('name', 'yarn.resourcemanager.ha').get('value')).to.equal('h0:8032,h1:8032');
+      expect(configs.configs.findProperty('name', 'yarn.resourcemanager.scheduler.ha').get('recommendedValue')).to.equal('h0:8030,h1:8030');
+    });
+
   });
 
 });