You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2014/08/12 14:07:50 UTC
git commit: AMBARI-6826 FE: Ambari installer should populate default
configs via /recommendations. (ababiichuk)
Repository: ambari
Updated Branches:
refs/heads/trunk d7a4c60d5 -> 382e7f3df
AMBARI-6826 FE: Ambari installer should populate default configs via /recommendations. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/382e7f3d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/382e7f3d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/382e7f3d
Branch: refs/heads/trunk
Commit: 382e7f3dfd547e4945caecf03164d939fb19b32c
Parents: d7a4c60
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Tue Aug 12 15:04:30 2014 +0300
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Tue Aug 12 15:07:37 2014 +0300
----------------------------------------------------------------------
.../stacks/HDP-2.1/recommendations_configs.json | 175 +++++++++++++++++++
.../controllers/main/service/info/configs.js | 18 +-
.../app/controllers/wizard/step7_controller.js | 80 +++++++--
ambari-web/app/data/service_configs.js | 2 +
ambari-web/app/models/stack_service.js | 6 +-
ambari-web/app/utils/ajax/ajax.js | 19 +-
ambari-web/app/utils/config.js | 46 +++--
7 files changed, 316 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/382e7f3d/ambari-web/app/assets/data/stacks/HDP-2.1/recommendations_configs.json
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/data/stacks/HDP-2.1/recommendations_configs.json b/ambari-web/app/assets/data/stacks/HDP-2.1/recommendations_configs.json
new file mode 100644
index 0000000..4efe599
--- /dev/null
+++ b/ambari-web/app/assets/data/stacks/HDP-2.1/recommendations_configs.json
@@ -0,0 +1,175 @@
+{
+ "hosts": ["ab2test-5.c.pramod-thangali.internal", "ab2test-6.c.pramod-thangali.internal", "ab2test-7.c.pramod-thangali.internal"],
+ "services": ["HDFS", "MAPREDUCE2", "YARN", "TEZ", "NAGIOS", "GANGLIA", "HIVE", "HCATALOG", "WEBHCAT", "SQOOP", "OOZIE", "ZOOKEEPER", "FALCON", "STORM", "FLUME", "PIG"],
+ "recommendations": {
+ "blueprint": {
+ "host_groups": [
+ {
+ "name": "host-group-3",
+ "components": [
+ {
+ "name": "NAMENODE"
+ },
+ {
+ "name": "STORM_UI_SERVER"
+ },
+ {
+ "name": "GANGLIA_SERVER"
+ },
+ {
+ "name": "ZOOKEEPER_SERVER"
+ },
+ {
+ "name": "STORM_REST_API"
+ },
+ {
+ "name": "NIMBUS"
+ },
+ {
+ "name": "DRPC_SERVER"
+ },
+ {
+ "name": "MYSQL_SERVER"
+ },
+ {
+ "name": "NAGIOS_SERVER"
+ }
+ ]
+ },
+ {
+ "name": "host-group-1",
+ "components": [
+ {
+ "name": "YARN_CLIENT"
+ },
+ {
+ "name": "NODEMANAGER"
+ },
+ {
+ "name": "HDFS_CLIENT"
+ },
+ {
+ "name": "HIVE_CLIENT"
+ },
+ {
+ "name": "SQOOP"
+ },
+ {
+ "name": "GANGLIA_MONITOR"
+ },
+ {
+ "name": "DATANODE"
+ },
+ {
+ "name": "FLUME_HANDLER"
+ },
+ {
+ "name": "MAPREDUCE2_CLIENT"
+ },
+ {
+ "name": "SUPERVISOR"
+ },
+ {
+ "name": "OOZIE_CLIENT"
+ },
+ {
+ "name": "ZOOKEEPER_CLIENT"
+ },
+ {
+ "name": "PIG"
+ },
+ {
+ "name": "ZOOKEEPER_SERVER"
+ },
+ {
+ "name": "JOURNALNODE"
+ },
+ {
+ "name": "ZKFC"
+ },
+ {
+ "name": "TEZ_CLIENT"
+ },
+ {
+ "name": "FALCON_CLIENT"
+ },
+ {
+ "name": "HCAT"
+ }
+ ]
+ },
+ {
+ "name": "host-group-2",
+ "components": [
+ {
+ "name": "FALCON_SERVER"
+ },
+ {
+ "name": "OOZIE_SERVER"
+ },
+ {
+ "name": "HIVE_SERVER"
+ },
+ {
+ "name": "APP_TIMELINE_SERVER"
+ },
+ {
+ "name": "HISTORYSERVER"
+ },
+ {
+ "name": "HIVE_METASTORE"
+ },
+ {
+ "name": "ZOOKEEPER_SERVER"
+ },
+ {
+ "name": "RESOURCEMANAGER"
+ },
+ {
+ "name": "WEBHCAT_SERVER"
+ },
+ {
+ "name": "SECONDARY_NAMENODE"
+ }
+ ]
+ }
+ ],
+ "configurations": {
+ "core-site": {},
+ "global": {
+ "properties": {}
+ },
+ "hbase-site": {},
+ "hdfs-site": {},
+ "yarn-site": {}
+ }
+ },
+ "blueprint_cluster_binding": {
+ "host_groups": [
+ {
+ "name": "host-group-3",
+ "hosts": [
+ {
+ "fqdn": "ab2test-5.c.pramod-thangali.internal"
+ }
+ ]
+ },
+ {
+ "name": "host-group-1",
+ "hosts": [
+ {
+ "fqdn": "ab2test-7.c.pramod-thangali.internal"
+ }
+ ]
+ },
+ {
+ "name": "host-group-2",
+ "hosts": [
+ {
+ "fqdn": "ab2test-6.c.pramod-thangali.internal"
+ }
+ ]
+ }
+ ]
+ }
+}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/382e7f3d/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index 20b4222..b2cd153 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -193,6 +193,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
restartHosts: Em.A(),
+ //TODO after moving validation/recommendation to BE defaultsInfo must be deleted
defaultsInfo: null,
/**
* On load function
@@ -637,7 +638,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
App.config.OnNnHAHideSnn(serviceConfig);
}
- if (serviceName || serviceConfig.serviceName === 'MISC') {
+ if ((serviceName || serviceConfig.serviceName === 'MISC') && !App.supports.serverRecommendValidate) {
// set recommended Defaults first then load the configs (including set validator)
var s = App.StackService.find().findProperty('serviceName', this.get('content.serviceName'));
var defaultsProvider = s.get('defaultsProviders');
@@ -647,6 +648,13 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
Em.run(this, 'setDefaults');
}
} else {
+ if (App.supports.serverRecommendValidate) {
+ var serviceConfig = App.config.createServiceConfig(this.get('content.serviceName'));
+ this.loadConfigs(this.get('allConfigs'), serviceConfig);
+ this.checkOverrideProperty(serviceConfig);
+ this.checkDatabaseProperties(serviceConfig);
+ this.get('stepConfigs').pushObject(serviceConfig);
+ }
this.set('selectedService', this.get('stepConfigs').objectAt(0));
this.checkForSecureConfig(this.get('selectedService'));
this.set('dataIsLoaded', true);
@@ -656,6 +664,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
}
},
+ //TODO after moving validation/recommendation to BE getInfoForDefaults must be deleted
setDefaults: function(){
var serviceConfig = App.config.createServiceConfig(this.get('content.serviceName'));
this.loadConfigs(this.get('allConfigs'), serviceConfig);
@@ -720,6 +729,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
}, this)
},
+ //TODO after moving validation/recommendation to BE getInfoForDefaults must be deleted
/**
* Get info about hosts and host components to configDefaultsProviders
* @returns {{masterComponentHosts: Array, slaveComponentHosts: Array, hosts: {}}}
@@ -750,6 +760,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
}
},
+ //TODO after moving validation/recommendation to BE getInfoForDefaultsSuccessCallback must be deleted
getInfoForDefaultsSuccessCallback: function (response) {
var defaultsInfo = {
masterComponentHosts: this.getMasterComponents(),
@@ -760,6 +771,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
this.setRecommendedDefaults(this.get('advancedConfigs'));
},
+ //TODO after moving validation/recommendation to BE getSlaveComponents must be deleted
/**
* parse json response and build slave components array
* @param response
@@ -790,6 +802,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
return slaveComponentHosts;
},
+ //TODO after moving validation/recommendation to BE getMasterComponents must be deleted
/**
* build master components array of data from HostComponent model
* @return {Array}
@@ -806,6 +819,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
});
return masterComponentHosts;
},
+
+ //TODO after moving validation/recommendation to BE getHostsInfo must be deleted
/**
* parse json response and build hosts map
* @param response
@@ -886,6 +901,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
}
},
+ //TODO after moving validation/recommendation to BE setRecommendedDefaults must be deleted
/**
* set recommended defaults for advanced configs for current service
* @param {Array} advancedConfigs
http://git-wip-us.apache.org/repos/asf/ambari/blob/382e7f3d/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index 0df2bf5..962baa4 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -113,6 +113,8 @@ App.WizardStep7Controller = Em.Controller.extend({
serviceConfigsData: require('data/service_configs'),
+ recommendedConfigs: null,
+
/**
* Are advanced configs loaded
* @type {bool}
@@ -383,6 +385,7 @@ App.WizardStep7Controller = Em.Controller.extend({
service.set('configs', serviceConfig.get('configs'));
},
+ //TODO after moving validation/recommendation to BE _getRecommendedDefaultsForComponent must be deleted
/**
* Get object with recommended default values for config properties
* Format:
@@ -414,6 +417,7 @@ App.WizardStep7Controller = Em.Controller.extend({
return recommendedDefaults;
},
+ //TODO after moving validation/recommendation to BE getInfoForDefaults must be deleted
/**
* Get info about hosts and host components to configDefaultsProviders
* Work specifically in Add Service wizard
@@ -596,9 +600,11 @@ App.WizardStep7Controller = Em.Controller.extend({
var s = App.StackService.find(component.get('serviceName')),
defaultGroupSelected = component.get('selectedConfigGroup.isDefault');
- if (s && s.get('configsValidator')) {
- var recommendedDefaults = this._getRecommendedDefaultsForComponent(component.get('serviceName'));
- s.get('configsValidator').set('recommendedDefaults', recommendedDefaults);
+ if(!App.supports.serverRecommendValidate) {
+ if (s && s.get('configsValidator')) {
+ var recommendedDefaults = this._getRecommendedDefaultsForComponent(component.get('serviceName'));
+ s.get('configsValidator').set('recommendedDefaults', recommendedDefaults);
+ }
}
configs.forEach(function (serviceConfigProperty) {
@@ -715,12 +721,25 @@ App.WizardStep7Controller = Em.Controller.extend({
this.resolveServiceDependencyConfigs('STORM', configs);
}
//STEP 6: Distribute configs by service and wrap each one in App.ServiceConfigProperty (configs -> serviceConfigs)
- this.setStepConfigs(configs, storedConfigs);
- this.checkHostOverrideInstaller();
- this.activateSpecialConfigs();
- this.selectProperService();
- if (this.get('content.skipConfigStep')) {
- App.router.send('next');
+ var self = this;
+ if (App.supports.serverRecommendValidate) {
+ this.loadDefaultConfigs(function() {
+ self.setStepConfigs(configs, storedConfigs);
+ self.checkHostOverrideInstaller();
+ self.activateSpecialConfigs();
+ self.selectProperService();
+ if (self.get('content.skipConfigStep')) {
+ App.router.send('next');
+ }
+ });
+ } else {
+ this.setStepConfigs(configs, storedConfigs);
+ this.checkHostOverrideInstaller();
+ this.activateSpecialConfigs();
+ this.selectProperService();
+ if (this.get('content.skipConfigStep')) {
+ App.router.send('next');
+ }
}
},
/**
@@ -751,7 +770,7 @@ App.WizardStep7Controller = Em.Controller.extend({
masterComponentHosts: this.get('wizardController.content.masterComponentHosts'),
slaveComponentHosts: this.get('wizardController.content.slaveComponentHosts')
};
- var serviceConfigs = App.config.renderConfigs(configs, storedConfigs, this.get('allSelectedServiceNames'), this.get('installedServiceNames'), localDB);
+ var serviceConfigs = App.config.renderConfigs(configs, storedConfigs, this.get('allSelectedServiceNames'), this.get('installedServiceNames'), localDB, this.get('recommendedConfigs'));
if (this.get('wizardController.name') === 'addServiceController') {
serviceConfigs.setEach('showConfig', true);
serviceConfigs.setEach('selected', false);
@@ -806,8 +825,7 @@ App.WizardStep7Controller = Em.Controller.extend({
selectProperService: function () {
if (this.get('wizardController.name') === 'addServiceController') {
this.set('selectedService', this.get('stepConfigs').filterProperty('selected', true).get('firstObject'));
- }
- else {
+ } else {
this.set('selectedService', this.get('stepConfigs').filterProperty('showConfig', true).objectAt(0));
}
},
@@ -906,6 +924,42 @@ App.WizardStep7Controller = Em.Controller.extend({
}, false, []));
}
},
+
+ loadDefaultConfigs: function(callback) {
+ var selectedServices = App.StackService.find().filterProperty('isSelected').mapProperty('serviceName');
+ var installedServices = App.StackService.find().filterProperty('isInstalled').mapProperty('serviceName');
+ var services = installedServices.concat(selectedServices).uniq();
+ this.set('isDefaultsLoaded', false);
+ var hostNames = Object.keys(this.get('content.hosts'));
+ App.ajax.send({
+ 'name': 'wizard.step7.loadrecommendations.configs',
+ 'sender': this,
+ 'data': {
+ stackVersionUrl: App.get('stackVersionURL'),
+ hosts: hostNames,
+ services: services,
+ recommendations: App.router.get('installerController.recommendations')
+ },
+ 'success': 'loadDefaultConfigsSuccess'
+ })
+ .retry({
+ times: App.maxRetries,
+ timeout: App.timeout
+ })
+ .then(function () {
+ callback();
+ }, function () {
+ App.showReloadPopup();
+ console.log('Load recommendations failed');
+ });
+ },
+
+ loadDefaultConfigsSuccess: function(data) {
+ if (!data) {
+ console.warn('error while loading default config values');
+ }
+ this.set("recommendedConfigs", Em.get(data.resources[0] , "recommendations.blueprint.configurations"));
+ },
/**
* Check if Oozie or Hive use existing database then need
* to restore missed properties
@@ -1139,7 +1193,7 @@ App.WizardStep7Controller = Em.Controller.extend({
*/
activateSpecialConfigs: function () {
var miscConfigs = this.get('stepConfigs').findProperty('serviceName', 'MISC').configs;
- miscConfigs = App.config.miscConfigVisibleProperty(miscConfigs, this.get('selectedServiceNames'));
+ App.config.miscConfigVisibleProperty(miscConfigs, this.get('selectedServiceNames'));
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/382e7f3d/ambari-web/app/data/service_configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/service_configs.js b/ambari-web/app/data/service_configs.js
index bd957df..f7e4442 100644
--- a/ambari-web/app/data/service_configs.js
+++ b/ambari-web/app/data/service_configs.js
@@ -18,6 +18,7 @@
var App = require('app');
require('models/service_config');
+//TODO after moving validation/recommendation to BE belov requirement must be deleted
require('utils/configs/defaults_providers/user_defaults_provider');
require('utils/configs/validators/user_configs_validator');
@@ -29,6 +30,7 @@ module.exports = [
Em.Object.create({
serviceName: 'MISC',
displayName: 'Misc',
+ //TODO after moving validation/recommendation to BE configsValidator and defaultsProviders must be deleted
configsValidator: App.userConfigsValidator,
defaultsProviders: [App.userDefaultsProvider.create()],
configCategories: [
http://git-wip-us.apache.org/repos/asf/ambari/blob/382e7f3d/ambari-web/app/models/stack_service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_service.js b/ambari-web/app/models/stack_service.js
index 61c89fa..551c01f 100644
--- a/ambari-web/app/models/stack_service.js
+++ b/ambari-web/app/models/stack_service.js
@@ -20,6 +20,7 @@ var App = require('app');
require('utils/helper');
require('mixins/models/service_mixin');
require('models/service_config');
+//TODO after moving validation/recommendation to BE belove requirements must be deleted
require('utils/configs/defaults_providers/yarn_defaults_provider');
require('utils/configs/defaults_providers/tez_defaults_provider');
require('utils/configs/defaults_providers/hive_defaults_provider');
@@ -159,12 +160,12 @@ App.StackService = DS.Model.extend(App.ServiceModelMixin, {
customReviewHandler: function () {
return App.StackService.reviewPageHandlers[this.get('serviceName')];
}.property('serviceName'),
-
+ //TODO after moving validation/recommendation to BE defaultsProviders must be deleted
defaultsProviders: function () {
var defaultConfigsHandler = App.StackService.defaultConfigsHandler[this.get('serviceName')];
return defaultConfigsHandler && defaultConfigsHandler.defaultsProviders;
}.property('serviceName'),
-
+ //TODO after moving validation/recommendation to BE configsValidator must be deleted
configsValidator: function () {
var defaultConfigsHandler = App.StackService.defaultConfigsHandler[this.get('serviceName')];
return defaultConfigsHandler && defaultConfigsHandler.configsValidator;
@@ -253,6 +254,7 @@ App.StackService.reviewPageHandlers = {
}
};
+//TODO after moving validation/recommendation to BE defaultConfigsHandler must be deleted
App.StackService.defaultConfigsHandler = {
YARN: {defaultsProviders: [App.YARNDefaultsProvider.create()], configsValidator: App.YARNConfigsValidator},
MAPREDUCE2: {defaultsProviders: [App.YARNDefaultsProvider.create()], configsValidator: App.MapReduce2ConfigsValidator},
http://git-wip-us.apache.org/repos/asf/ambari/blob/382e7f3d/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 832d347..fc1f81c 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -1246,7 +1246,24 @@ var urls = {
return {
data: JSON.stringify({
hosts: data.hosts,
- services: data.services
+ services: data.services,
+ recommend: "host_groups"
+ })
+ }
+ }
+ },
+
+ 'wizard.step7.loadrecommendations.configs': {
+ 'real': '{stackVersionUrl}/recommendations',
+ 'mock': '/data/stacks/HDP-2.1/recommendations_configs.json',
+ 'type': 'POST',
+ 'format': function (data) {
+ return {
+ data: JSON.stringify({
+ hosts: data.hosts,
+ services: data.services,
+ recommendations: data.recommendations,
+ recommend: "configurations"
})
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/382e7f3d/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index d3d9a14..c69695e 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -630,7 +630,7 @@ App.config = Em.Object.create({
* @param localDB
* @return {Array}
*/
- renderConfigs: function (configs, storedConfigs, allSelectedServiceNames, installedServiceNames, localDB) {
+ renderConfigs: function (configs, storedConfigs, allSelectedServiceNames, installedServiceNames, localDB, recommended) {
var renderedServiceConfigs = [];
var services = [];
@@ -670,23 +670,43 @@ App.config = Em.Object.create({
// Use calculated default values for some configs
var recommendedDefaults = {};
- if (!storedConfigs && service.get('defaultsProviders')) {
- service.get('defaultsProviders').forEach(function (defaultsProvider) {
- var defaults = defaultsProvider.getDefaults(localDB);
- for (var name in defaults) {
- var config = configsByService.findProperty('name', name);
- if (!config) {
- continue;
+ if (App.supports.serverRecommendValidate) {
+ if (!storedConfigs && service.get('configTypes')) {
+ Object.keys(service.get('configTypes')).forEach(function (type) {
+ if (!recommended || !recommended[type]) {
+ return;
}
- if (!!defaults[name]) {
+ var defaults = recommended[type].properties;
+ for (var name in defaults) {
+ var config = configsByService.findProperty('name', name);
+ if (!config) {
+ continue;
+ }
recommendedDefaults[name] = defaults[name];
config.set('value', defaults[name]);
config.set('defaultValue', defaults[name]);
- } else {
- recommendedDefaults[name] = config.get('defaultValue');
}
- }
- });
+ });
+ }
+ } else {
+ if (!storedConfigs && service.get('defaultsProviders')) {
+ service.get('defaultsProviders').forEach(function (defaultsProvider) {
+ var defaults = defaultsProvider.getDefaults(localDB);
+ for (var name in defaults) {
+ var config = configsByService.findProperty('name', name);
+ if (!config) {
+ continue;
+ }
+ if (!!defaults[name]) {
+ recommendedDefaults[name] = defaults[name];
+ config.set('value', defaults[name]);
+ config.set('defaultValue', defaults[name]);
+ } else {
+ recommendedDefaults[name] = config.get('defaultValue');
+ }
+ }
+ });
+ }
}
if (service.get('configsValidator')) {
service.get('configsValidator').set('recommendedDefaults', recommendedDefaults);