Repository: ambari Updated Branches: refs/heads/trunk 39873e83a -> 3a9b0bbaf
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). Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3a9b0bba Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3a9b0bba Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3a9b0bba Branch: refs/heads/trunk Commit: 3a9b0bbaf5458cbc72c96a243ec839483d939daa Parents: 39873e8 Author: Oleksandr Diachenko <[email protected]> Authored: Thu Dec 17 11:03:21 2015 -0800 Committer: Oleksandr Diachenko <[email protected]> Committed: Thu Dec 17 11:03:21 2015 -0800 ---------------------------------------------------------------------- .../resourceManager/step4_controller.js | 59 +++++++++++++++++--- ambari-web/app/data/HDP2/rm_ha_properties.js | 28 +++++++++- ambari-web/app/messages.js | 3 +- .../utils/configs/rm_ha_config_initializer.js | 47 +++++++++++++++- .../resourceManager/step3_controller_test.js | 11 ++++ 5 files changed, 136 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/3a9b0bba/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js index 697ed1a..2617721 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js +++ b/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(); }, http://git-wip-us.apache.org/repos/asf/ambari/blob/3a9b0bba/ambari-web/app/data/HDP2/rm_ha_properties.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/data/HDP2/rm_ha_properties.js b/ambari-web/app/data/HDP2/rm_ha_properties.js index 59bb24b..5c85297 100644 --- a/ambari-web/app/data/HDP2/rm_ha_properties.js +++ b/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' } ] } http://git-wip-us.apache.org/repos/asf/ambari/blob/3a9b0bba/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index 82b3b4a..3858bd2 100644 --- a/ambari-web/app/messages.js +++ b/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.', http://git-wip-us.apache.org/repos/asf/ambari/blob/3a9b0bba/ambari-web/app/utils/configs/rm_ha_config_initializer.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/configs/rm_ha_config_initializer.js b/ambari-web/app/utils/configs/rm_ha_config_initializer.js index 5f239c6..44bd45b 100644 --- a/ambari-web/app/utils/configs/rm_ha_config_initializer.js +++ b/ambari-web/app/utils/configs/rm_ha_config_initializer.js @@ -20,6 +20,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 * * @class {RmHaConfigInitializer} @@ -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; } }); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/3a9b0bba/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js index b2e8f59..fedcb8e 100644 --- a/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js +++ b/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'); + }); + }); });
