You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2016/01/04 22:38:27 UTC
[34/50] [abbrv] ambari git commit: AMBARI-14392. Move logic to
ambari-web,
for adding parameters to hdfs-client.xml for HAWQ when HAWQ is installed on NN
HA cluster (mithmatt via odiachenko).
AMBARI-14392. Move logic to ambari-web, for adding parameters to hdfs-client.xml for HAWQ when HAWQ is installed on NN HA cluster (mithmatt via odiachenko).
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/746e90d1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/746e90d1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/746e90d1
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 746e90d1de23060d3d7f33f3995714a0950938b4
Parents: 83ea508
Author: Oleksandr Diachenko <od...@pivotal.io>
Authored: Wed Dec 30 11:27:14 2015 -0800
Committer: Oleksandr Diachenko <od...@pivotal.io>
Committed: Wed Dec 30 11:27:14 2015 -0800
----------------------------------------------------------------------
.../HAWQ/2.0.0/package/scripts/common.py | 17 +----
.../app/controllers/wizard/step7_controller.js | 42 ++++++++++++
.../test/controllers/wizard/step7_test.js | 71 ++++++++++++++++++++
3 files changed, 114 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/746e90d1/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py
index 49e86b6..c427c83 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py
@@ -91,22 +91,7 @@ def __update_hdfs_client():
import params
hdfs_client_dict = params.hdfs_client.copy()
- dfs_nameservice = params.hdfs_site.get('dfs.nameservices')
-
- # Adds additional parameters required for HDFS HA, if HDFS HA is enabled
- # Temporary logic, this logic will be moved to ambari-web to expose these parameters on UI once HDFS HA is enabled
- if dfs_nameservice:
- ha_namenodes = 'dfs.ha.namenodes.{0}'.format(dfs_nameservice)
- ha_nn_list = [ha_nn.strip() for ha_nn in params.hdfs_site[ha_namenodes].split(',')]
- required_keys = ('dfs.nameservices', ha_namenodes,
- 'dfs.namenode.rpc-address.{0}.{1}'.format(dfs_nameservice, ha_nn_list[0]),
- 'dfs.namenode.http-address.{0}.{1}'.format(dfs_nameservice, ha_nn_list[0]),
- 'dfs.namenode.rpc-address.{0}.{1}'.format(dfs_nameservice, ha_nn_list[1]),
- 'dfs.namenode.http-address.{0}.{1}'.format(dfs_nameservice, ha_nn_list[1]))
-
- for key in required_keys:
- hdfs_client_dict[key] = params.hdfs_site[key]
-
+
# security
if params.security_enabled:
hdfs_client_dict["hadoop.security.authentication"] = "kerberos"
http://git-wip-us.apache.org/repos/asf/ambari/blob/746e90d1/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 823d663..d10f348 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -688,6 +688,10 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
if (this.get('allSelectedServiceNames').contains('YARN')) {
configs = App.config.fileConfigsIntoTextarea(configs, 'capacity-scheduler.xml', []);
}
+ // if HA is enabled and HAWQ is selected to be installed -> Add HAWQ related configs
+ if (this.get('wizardController.name') === 'addServiceController' && App.get('isHaEnabled') && this.get('allSelectedServiceNames').contains('HAWQ')) {
+ this.addHawqConfigsOnNnHa(configs);
+ }
if (App.get('isKerberosEnabled') && this.get('wizardController.name') == 'addServiceController') {
this.addKerberosDescriptorConfigs(configs, this.get('wizardController.kerberosDescriptorConfigs') || []);
}
@@ -794,6 +798,44 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
},
/**
+ * For Namenode HA, HAWQ service requires additional config parameters in hdfs-client.xml
+ * This method ensures that these additional parameters are added to hdfs-client.xml
+ * @param configs existing configs on cluster
+ * @returns {Object[]} existing configs + additional config parameters in hdfs-client.xml
+ * @private
+ */
+ addHawqConfigsOnNnHa: function(configs) {
+ var nameService = configs.findProperty('id', 'dfs.nameservices__hdfs-site').value;
+ var propertyNames = [
+ 'dfs.nameservices',
+ 'dfs.ha.namenodes.' + nameService,
+ 'dfs.namenode.rpc-address.'+ nameService +'.nn1',
+ 'dfs.namenode.rpc-address.'+ nameService +'.nn2',
+ 'dfs.namenode.http-address.'+ nameService +'.nn1',
+ 'dfs.namenode.http-address.'+ nameService +'.nn2'
+ ];
+
+ propertyNames.forEach(function(propertyName, propertyIndex) {
+ var propertyFromHdfs = configs.findProperty('id', propertyName + '__hdfs-site');
+ var newProperty = App.config.createDefaultConfig(propertyName, 'HAWQ', 'hdfs-client.xml', true);
+ Em.setProperties(newProperty, {
+ description: propertyFromHdfs.description,
+ displayName: propertyFromHdfs.displayName,
+ displayType: 'string',
+ index: propertyIndex,
+ isOverridable: false,
+ isReconfigurable: false,
+ name: propertyFromHdfs.name,
+ value: propertyFromHdfs.value,
+ recommendedValue: propertyFromHdfs.recommendedValue
+ });
+
+ configs.push(App.ServiceConfigProperty.create(newProperty));
+ });
+ return configs;
+ },
+
+ /**
* render configs, distribute them by service
* and wrap each in ServiceConfigProperty object
* @param stepConfigs
http://git-wip-us.apache.org/repos/asf/ambari/blob/746e90d1/ambari-web/test/controllers/wizard/step7_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js
index 3c23c54..ac7b3c3 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -1608,6 +1608,77 @@ describe('App.InstallerStep7Controller', function () {
});
});
+ describe('#addHawqConfigsOnNnHa', function () {
+ var configs = [
+ {
+ id: 'dfs.nameservices__hdfs-site',
+ description: 'dfs.nameservices__hdfs-site',
+ displayName: 'dfs.nameservices',
+ displayType: 'string',
+ name: 'dfs.nameservices',
+ value: 'haservice',
+ recommendedValue: 'haservice'
+ },
+ {
+ id: 'dfs.ha.namenodes.haservice__hdfs-site',
+ description: 'dfs.ha.namenodes.haservice__hdfs-site',
+ displayName: 'dfs.ha.namenodes.haservice',
+ displayType: 'string',
+ name: 'dfs.ha.namenodes.haservice',
+ value: 'nn1,nn2',
+ recommendedValue: 'nn1,nn2'
+ },
+ {
+ id: 'dfs.namenode.rpc-address.haservice.nn1__hdfs-site',
+ description: 'dfs.namenode.rpc-address.haservice.nn1__hdfs-site',
+ displayName: 'dfs.namenode.rpc-address.haservice.nn1',
+ displayType: 'string',
+ name: 'dfs.namenode.rpc-address.haservice.nn1',
+ value: 'c6401.ambari.apache.org:8020',
+ recommendedValue: 'c6401.ambari.apache.org:8020'
+ },
+ {
+ id: 'dfs.namenode.rpc-address.haservice.nn2__hdfs-site',
+ description: 'dfs.namenode.rpc-address.haservice.nn2__hdfs-site',
+ displayName: 'dfs.namenode.rpc-address.haservice.nn2',
+ displayType: 'string',
+ name: 'dfs.namenode.rpc-address.haservice.nn2',
+ value: 'c6402.ambari.apache.org:8020',
+ recommendedValue: 'c6402.ambari.apache.org:8020'
+ },
+ {
+ id: 'dfs.namenode.http-address.haservice.nn1__hdfs-site',
+ description: 'dfs.namenode.http-address.haservice.nn1__hdfs-site',
+ displayName: 'dfs.namenode.http-address.haservice.nn1',
+ displayType: 'string',
+ name: 'dfs.namenode.http-address.haservice.nn1',
+ value: 'c6401.ambari.apache.org:50070',
+ recommendedValue: 'c6401.ambari.apache.org:50070'
+ },
+ {
+ id: 'dfs.namenode.http-address.haservice.nn2__hdfs-site',
+ description: 'dfs.namenode.http-address.haservice.nn2__hdfs-site',
+ displayName: 'dfs.namenode.http-address.haservice.nn2',
+ displayType: 'string',
+ name: 'dfs.namenode.http-address.haservice.nn2',
+ value: 'c6402.ambari.apache.org:50070',
+ recommendedValue: 'c6402.ambari.apache.org:50070'
+ }
+ ];
+
+ it('should copy properties from hdfs-site to hdfs-client for HAWQ', function() {
+ var oldConfigs = configs.slice();
+ installerStep7Controller.addHawqConfigsOnNnHa(configs);
+ oldConfigs.forEach(function(property){
+ // find the same property in hdfs-client for HAWQ and see if attribute value matches with the corresponding property's attribute value in hdfs-site
+ expect(configs.findProperty('id', property.name + '__hdfs-client').description).to.be.eql(property.description);
+ expect(configs.findProperty('id', property.name + '__hdfs-client').displayName).to.be.eql(property.displayName);
+ expect(configs.findProperty('id', property.name + '__hdfs-client').value).to.be.eql(property.value);
+ expect(configs.findProperty('id', property.name + '__hdfs-client').recommendedValue).to.be.eql(property.recommendedValue);
+ });
+ });
+ });
+
describe('#errorsCount', function () {
it('should ignore configs with widgets (enhanced configs)', function () {