Browse Source

AMBARI-4506 Add properties to storm-site.xml for Storm metrics. (Denys Buzhor)

aBabiichuk 11 years ago
parent
commit
aa25d928fa

+ 3 - 3
ambari-server/src/main/resources/stacks/HDP/2.1.1/services/STORM/configuration/storm-site.xml

@@ -113,7 +113,7 @@
   </property>
   <property>
     <name>nimbus.childopts</name>
-    <value>-Xmx1024m</value>
+    <value></value>
     <description></description>
   </property>
   <property>
@@ -243,7 +243,7 @@
   </property>
   <property>
     <name>supervisor.childopts</name>
-    <value>-Xmx256m</value>
+    <value></value>
     <description></description>
   </property>
   <property>
@@ -273,7 +273,7 @@
   </property>
   <property>
     <name>worker.childopts</name>
-    <value>-Xmx768m</value>
+    <value></value>
     <description></description>
   </property>
   <property>

+ 35 - 0
ambari-web/app/controllers/wizard/step7_controller.js

@@ -308,7 +308,39 @@ App.WizardStep7Controller = Em.Controller.extend({
       }
     }
   },
+  /**
+   *  Resolve dependency between configs.
+   *  @param serviceName {String}
+   *  @param configs {Mixed}
+   */
+  resolveServiceDependencyConfigs: function (serviceName, configs) {
+    switch (serviceName) {
+      case 'STORM':
+        this.resolveStormConfigs(configs);
+        break;
+      default:
+        break;
+    }
+  },
 
+  resolveStormConfigs: function(configs) {
+    var dependentConfigs, gangliaServerHost;
+    dependentConfigs = ['nimbus.childopts', 'supervisor.childopts', 'worker.childopts'];
+    // if Ganglia selected or installed, set ganglia host to configs
+    if (this.get('installedServiceNames').contains('STORM') && this.get('installedServiceNames').contains('GANGLIA')) return;
+    if (this.get('allSelectedServiceNames').contains('GANGLIA') || this.get('installedServiceNames').contains('GANGLIA')) {
+      gangliaServerHost = this.get('wizardController').getDBProperty('masterComponentHosts').findProperty('component', 'GANGLIA_SERVER').hostName;
+      dependentConfigs.forEach(function(configName){
+        var config = configs.findProperty('name', configName);
+        config.value = config.defaultValue.format(gangliaServerHost);
+      }, this);
+    } else {
+      // if Ganglia not selected remove config
+      dependentConfigs.forEach(function(configName){
+        configs.removeAt(configs.indexOf(configs.findProperty('name', configName)));
+      }, this);
+    }
+  },
   /**
    * On load function
    */
@@ -339,6 +371,9 @@ App.WizardStep7Controller = Em.Controller.extend({
       this.getConfigTags();
       this.setInstalledServiceConfigs(this.get('serviceConfigTags'), configs);
     }
+    if (this.get('allSelectedServiceNames').contains('STORM') || this.get('installedServiceNames').contains('STORM')) {
+      this.resolveServiceDependencyConfigs('STORM', configs);
+    }
     //STEP 6: Distribute configs by service and wrap each one in App.ServiceConfigProperty (configs -> serviceConfigs)
     var serviceConfigs = App.config.renderConfigs(configs, storedConfigs, this.get('allSelectedServiceNames'), this.get('installedServiceNames'), localDB);
     if (this.get('wizardController.name') === 'addServiceController') {

+ 7 - 2
ambari-web/app/controllers/wizard/step8_controller.js

@@ -1385,9 +1385,14 @@ App.WizardStep8Controller = Em.Controller.extend({
   createStormSiteObj: function () {
     var configs = this.get('configs').filterProperty('filename', 'storm-site.xml');
     var stormProperties = {};
+    var specialProperties = ["storm.zookeeper.servers", "nimbus.childopts", "supervisor.childopts", "worker.childopts"];
     configs.forEach(function (_configProperty) {
-      if (_configProperty.name == "storm.zookeeper.servers") {
-        stormProperties[_configProperty.name] = JSON.stringify(_configProperty.value).replace(/"/g, "'");
+      if (specialProperties.contains(_configProperty.name)) {
+        if (_configProperty.name == "storm.zookeeper.servers") {
+          stormProperties[_configProperty.name] = JSON.stringify(_configProperty.value).replace(/"/g, "'");
+        } else {
+          stormProperties[_configProperty.name] = JSON.stringify(_configProperty.value).replace(/"/g,"");
+        }
       } else {
         stormProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
       }

+ 12 - 9
ambari-web/app/data/HDP2/site_properties.js

@@ -981,12 +981,13 @@ module.exports =
       "name": "nimbus.childopts",
       "displayName": "nimbus.childopts",
       "description": "",
-      "defaultValue": "",
+      "defaultValue": "-javaagent:/var/lib/storm/jmxetric-1.0.4.jar=host={0},port=8649,wireformat31x=true,mode=multicast,config=/var/lib/storm/jmxetric-conf.xml,process=Nimbus_JVM -Xmx1024m",
       "isReconfigurable": true,
-      "isVisible": true,
+      "isVisible": false,
       "isRequiredByAgent": true,
       "serviceName": "STORM",
-      "category": "Nimbus"
+      "category": "Nimbus",
+      "filename": "storm-site.xml"
     },
     {
       "id": "site property",
@@ -1128,14 +1129,15 @@ module.exports =
       "id":"site property",
       "description":"",
       "isReconfigurable": true,
-      "isVisible":true,
+      "isVisible":false,
       "isRequiredByAgent":true,
       "serviceName":"STORM",
       "category":"Supervisor",
       "displayName":"supervisor.childopts",
       "name":"supervisor.childopts",
-      "defaultValue":"-Xmx256m",
-      "displayType":"string"
+      "defaultValue":"-javaagent:/var/lib/storm/jmxetric-1.0.4.jar=host={0},port=8650,wireformat31x=true,mode=multicast,config=/var/lib/storm/jmxetric-conf.xml,process=Supervisor_JVM -Xmx256m",
+      "displayType":"string",
+      "filename": "storm-site.xml"
     },
     {
       "id":"site property",
@@ -1354,14 +1356,15 @@ module.exports =
       "id": "site property",
       "description": "",
       "isReconfigurable": true,
-      "isVisible": true,
+      "isVisible": false,
       "isRequiredByAgent": true,
       "serviceName": "STORM",
       "category": "Advanced",
       "displayName": "worker.childopts",
       "name": "worker.childopts",
-      "defaultValue": "-Xmx768m",
-      "displayType": "string"
+      "defaultValue": "-javaagent:/var/lib/storm/jmxetric-1.0.4.jar=host={0},port=8650,wireformat31x=true,mode=multicast,config=/var/lib/storm/jmxetric-conf.xml,process=Worker_%ID%_JVM -Xmx768m",
+      "displayType": "string",
+      "filename": "storm-site.xml"
     },
 
   /**********************************************tez-site***************************************/

+ 1 - 7
ambari-web/app/utils/configs/defaults_providers/storm_defaults_provider.js

@@ -26,12 +26,9 @@ App.STORMDefaultsProvider = App.DefaultsProvider.create({
    * List of the configs that should be calculated
    */
   configsTemplate: {
-    'supervisor.childopts': null,
-    'nimbus.childopts': null,
     'drpc.childopts': null,
     'ui.childopts': null,
-    'logviewer.childopts': null,
-    'worker.childopts': null
+    'logviewer.childopts': null
   },
 
   // @todo fill with correct values
@@ -43,12 +40,9 @@ App.STORMDefaultsProvider = App.DefaultsProvider.create({
     if (!this.clusterDataIsValid()) {
       return configs;
     }
-    configs['supervisor.childopts'] = '-Xmx256m';
-    configs['nimbus.childopts'] = '-Xmx1024m';
     configs['drpc.childopts'] = '-Xmx768m';
     configs['ui.childopts'] = '-Xmx768m';
     configs['logviewer.childopts'] = '-Xmx128m';
-    configs['worker.childopts'] = '-Xmx768m';
     return configs;
   },
 

+ 1 - 16
ambari-web/app/utils/configs/validators/storm_configs_validator.js

@@ -23,20 +23,9 @@ App.STORMConfigsValidator = App.ServiceConfigsValidator.create({
    * List of the configs that should be validated
    */
   configValidators: {
-    'supervisor.childopts': 'supervisorChildOpts',
-    'nimbus.childopts': 'nimbusChildOpts',
     'drpc.childopts': 'drpcChildOpts',
     'ui.childopts': 'uiChildOpts',
-    'logviewer.childopts': 'logviewerChildOpts',
-    'worker.childopts': 'workerChildOpts'
-  },
-
-  supervisorChildOpts: function(config) {
-    return this.validateXmxValue(config);
-  },
-
-  nimbusChildOpts: function(config) {
-    return this.validateXmxValue(config);
+    'logviewer.childopts': 'logviewerChildOpts'
   },
 
   drpcChildOpts: function(config) {
@@ -49,9 +38,5 @@ App.STORMConfigsValidator = App.ServiceConfigsValidator.create({
 
   logviewerChildOpts: function(config) {
     return this.validateXmxValue(config);
-  },
-
-  workerChildOpts: function(config) {
-    return this.validateXmxValue(config);
   }
 });