ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject ambari git commit: AMBARI-10457. Storm Nimbus HA. (Sriharsha Chintalapani via yusaku)
Date Thu, 30 Apr 2015 02:39:32 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 5f95f11bc -> 97c524d96


AMBARI-10457. Storm Nimbus HA. (Sriharsha Chintalapani via yusaku)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/97c524d9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/97c524d9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/97c524d9

Branch: refs/heads/trunk
Commit: 97c524d969fb7b1d405ade65e3237bf7cb8ccb78
Parents: 5f95f11
Author: Yusaku Sako <yusaku@hortonworks.com>
Authored: Wed Apr 29 19:38:54 2015 -0700
Committer: Yusaku Sako <yusaku@hortonworks.com>
Committed: Wed Apr 29 19:38:54 2015 -0700

----------------------------------------------------------------------
 .../stacks/HDP/2.3/services/STORM/metainfo.xml  |  23 +++
 ambari-web/app/controllers/main/host/details.js | 148 +++++++++++++++++++
 ambari-web/app/data/HDP2/site_properties.js     |  13 ++
 ambari-web/app/messages.js                      |   2 +
 .../app/utils/configs/config_property_helper.js |   3 +
 ambari-web/test/utils/config_test.js            |   2 +-
 6 files changed, 190 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/97c524d9/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/metainfo.xml
index b4dc4a1..092a4d0 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/metainfo.xml
@@ -40,6 +40,29 @@
           </packages>
         </osSpecific>
       </osSpecifics>
+      <components>
+        <component>
+          <name>NIMBUS</name>
+          <displayName>Nimbus</displayName>
+          <category>MASTER</category>
+          <cardinality>1+</cardinality>
+          <versionAdvertised>true</versionAdvertised>
+          <dependencies>
+            <dependency>
+              <name>ZOOKEEPER/ZOOKEEPER_SERVER</name>
+              <scope>cluster</scope>
+              <auto-deploy>
+                <enabled>true</enabled>
+              </auto-deploy>
+            </dependency>
+          </dependencies>
+          <commandScript>
+            <script>scripts/nimbus.py</script>
+            <scriptType>PYTHON</scriptType>
+            <timeout>1200</timeout>
+          </commandScript>
+        </component>
+      </components>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/97c524d9/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index d23fc79..15df59f 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -233,6 +233,12 @@ App.MainHostDetailsController = Em.Controller.extend({
       deleteHiveMetastoreMsg: Em.View.extend({
         template: Em.Handlebars.compile(Em.I18n.t('hosts.host.deleteComponent.popup.deleteHiveMetastore'))
       }),
+      isNimbus: function () {
+        return componentName == 'NIMBUS';
+      }.property(),
+      deleteNimbusMsg: Em.View.extend({
+        template: Em.Handlebars.compile(Em.I18n.t('hosts.host.deleteComponent.popup.deleteNimbus'))
+      }),
       isChecked: false,
       disablePrimary: function () {
         return !this.get('isChecked');
@@ -329,6 +335,9 @@ App.MainHostDetailsController = Em.Controller.extend({
     } else if (data.componentName == 'HIVE_METASTORE') {
       this.set('deleteHiveMetaStore', true);
       this.loadConfigs('loadHiveConfigs');
+    } else if(data.componentName == 'NIMBUS') {
+      this.set('deleteNimbusHost', true);
+      this.loadConfigs('loadStormConfigs');
     }
   },
 
@@ -449,6 +458,7 @@ App.MainHostDetailsController = Em.Controller.extend({
       self = this,
       hiveHost = event.hiveMetastoreHost ? event.hiveMetastoreHost : "";
       component = event.context,
+      hostName = this.get('content.hostName'),
       componentName = component.get('componentName'),
       missedComponents = !!hiveHost ? [] : componentsUtils.checkComponentDependencies(componentName,
{
         scope: 'host',
@@ -474,6 +484,12 @@ App.MainHostDetailsController = Em.Controller.extend({
           self.loadConfigs("loadHiveConfigs");
         }, Em.I18n.t('hosts.host.addComponent.' + componentName ));
         break;
+      case 'NIMBUS':
+        returnFunc = App.showConfirmationPopup(function() {
+            self.set('nimbusHost', hostName);
+            self.loadConfigs("loadStormConfigs");
+        }, Em.I18n.t('hosts.host.addComponent.' + componentName));
+        break;
       default:
         returnFunc = this.addClientComponent(component);
       }
@@ -627,6 +643,114 @@ App.MainHostDetailsController = Em.Controller.extend({
     this.get('isOozieConfigLoaded').resolve();
   },
 
+
+  /**
+   * Success callback for Storm load configs request
+   * @param {object} data
+   * @method loadStormConfigs
+   */
+  loadStormConfigs: function (data) {
+    App.ajax.send({
+      name: 'admin.get.all_configurations',
+      sender: this,
+      data: {
+          urlParams: '(type=storm-site&tag=' + data.Clusters.desired_configs['storm-env'].tag
+')'
+      },
+      success: 'onLoadStormConfigs'
+    });
+  },
+
+  /**
+   * update and save Storm related configs to server
+   * @param {object} data
+   * @method onLoadStormConfigs
+   */
+   onLoadStormConfigs: function (data) {
+    var
+      nimbusHost = this.get('nimbusHost'),
+      stormNimbusHosts = this.getStormNimbusHosts(),
+      configs = {},
+      attributes = {};
+
+       data.items.forEach(function (item) {
+           configs[item.type] = item.properties;
+           attributes[item.type] = item.properties_attributes || {};
+       }, this);
+
+       configs['storm-site']['nimbus.seeds'] = stormNimbusHosts.join(',');
+       var groups = [
+           {
+               properties: {
+                   'storm-site': configs['storm-site'],
+                   'storm-env': configs['storm-env']
+               },
+               properties_attributes: {
+                   'storm-site': attributes['storm-site'],
+                   'storm-env': attributes['storm-env']
+               }
+           },
+           {
+               properties: {
+                   'core-site': configs['core-site']
+               },
+               properties_attributes: {
+                   'core-site': attributes['core-site']
+               }
+           }
+       ];
+    this.saveStormConfigsBatch(groups, nimbusHost);
+   },
+
+     /**
+   * save configs' sites in batch
+   * @param nimbusHost
+   * @param groups
+   */
+  saveStormConfigsBatch: function (groups, nimbusHost) {
+    groups.forEach(function (group) {
+      var desiredConfigs = [],
+        tag = 'version' + (new Date).getTime(),
+        properties = group.properties;
+
+      for (var site in properties) {
+        if (!properties.hasOwnProperty(site) || Em.isNone(properties[site])) continue;
+        desiredConfigs.push({
+          "type": site,
+          "tag": tag,
+          "properties": properties[site],
+          "properties_attributes": group.properties_attributes[site],
+          "service_config_version_note": Em.I18n.t('hosts.host.storm.configs.save.note')
+        });
+      }
+      if (desiredConfigs.length > 0) {
+        App.ajax.send({
+          name: 'common.service.configurations',
+          sender: this,
+          data: {
+            desired_config: desiredConfigs,
+            stormNimbusHost: nimbusHost
+          },
+          success: 'installStormNimbus'
+        });
+      }
+      //clear nimbus host not to send second request to install component
+      nimbusHost = null;
+    }, this);
+  },
+
+  /**
+   * success callback for saveStormConfigsBatch method
+   * @param data
+   * @param opt
+   * @param params
+   */
+  installStormNimbus: function(data, opt, params) {
+    if (params.stormNimbusHost) {
+      componentsUtils.installHostComponent(params.stormNimbusHost, App.StackServiceComponent.find("NIMBUS"));
+    }
+  },
+  /**
+
   /**
    * Success callback for load configs request
    * @param {object} data
@@ -777,6 +901,30 @@ App.MainHostDetailsController = Em.Controller.extend({
   },
 
   /**
+   * Delete Storm Nimbus is performed
+   * @type {bool}
+   */
+  deleteNimbusHost: false,
+
+  getStormNimbusHosts: function () {
+    var
+      stormNimbusHosts = App.HostComponent.find().filterProperty('componentName', 'NIMBUS').mapProperty('hostName'),
+      nimbusHost = this.get('nimbusHost');
+
+    if(!!nimbusHost){
+      stormNimbusHosts.push(nimbusHost);
+      this.set('nimbusHost', '');
+    }
+
+    if (this.get('fromDeleteHost') || this.get('deleteNimbusHost')) {
+      this.set('deleteNimbusHost', false);
+      this.set('fromDeleteHost', false);
+      return stormNimbusHosts.without(this.get('content.hostName'));
+    }
+    return stormNimbusHosts.sort();
+  },
+
+  /**
    * Send command to server to resfresh configs of selected component
    * @param {object} event
    * @method refreshComponentConfigs

http://git-wip-us.apache.org/repos/asf/ambari/blob/97c524d9/ambari-web/app/data/HDP2/site_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2/site_properties.js b/ambari-web/app/data/HDP2/site_properties.js
index 274b673..a35104e 100644
--- a/ambari-web/app/data/HDP2/site_properties.js
+++ b/ambari-web/app/data/HDP2/site_properties.js
@@ -1032,6 +1032,19 @@ var hdp2properties = [
   },
   {
     "id": "site property",
+    "name": "nimbus.seeds",
+    "displayName": "nimbus.seeds",
+    "displayType": "masterHosts",
+    "isOverridable": false,
+    "serviceName": "STORM",
+    "filename": "storm-site.xml",
+    "category": "NIMBUS",
+    "stack": {
+      "HDP": "2.3"
+    }
+  },
+  {
+    "id": "site property",
     "name": "nimbus.thrift.port",
     "displayName": "nimbus.thrift.port",
     "displayType": "int",

http://git-wip-us.apache.org/repos/asf/ambari/blob/97c524d9/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 3b4105b..9bf0108 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2152,6 +2152,8 @@ Em.I18n.translations = {
   'hosts.host.zooKeeper.configs.save.note': 'This configuration is created by ambari while
installing/deleting zookeeper component on a host',
   'hosts.host.addComponent.securityNote':'You are running your cluster in secure mode. You
must set up the keytab for {0} on {1} before you proceed. Otherwise, the component will not
be able to start properly.',
   'hosts.host.addComponent.popup.confirm':'Confirm Add',
+  'hosts.host.deleteComponent.popup.deleteNimbus':'Deleting <i>Storm Nimbus</i>
will reconfigure the <b>nimbus.seeds</b> property if it is defined.',
+  'hosts.host.storm.configs.save.note': 'This configuration is created by ambari while installing/deleting
storm component on a host',
   'hosts.host.datanode.decommission':'Decommission DataNode',
   'hosts.host.datanode.recommission':'Recommission DataNode',
   'hosts.host.nodemanager.decommission':'Decommission NodeManager',

http://git-wip-us.apache.org/repos/asf/ambari/blob/97c524d9/ambari-web/app/utils/configs/config_property_helper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/config_property_helper.js b/ambari-web/app/utils/configs/config_property_helper.js
index 76b294f..333214c 100644
--- a/ambari-web/app/utils/configs/config_property_helper.js
+++ b/ambari-web/app/utils/configs/config_property_helper.js
@@ -204,6 +204,9 @@ module.exports = {
       case 'nimbus.host':
         configProperty.set('value', masterComponentHostsInDB.findProperty('component', 'NIMBUS').hostName);
         break;
+      case 'nimbus.seeds':
+        configProperty.set('value', masterComponentHostsInDB.filterProperty('component',
'NIMBUS').mapProperty('hostName'));
+        break;
       case 'falconserver_host':
         configProperty.set('value', masterComponentHostsInDB.findProperty('component', 'FALCON_SERVER').hostName);
         break;

http://git-wip-us.apache.org/repos/asf/ambari/blob/97c524d9/ambari-web/test/utils/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/config_test.js b/ambari-web/test/utils/config_test.js
index 1649db9..d529560 100644
--- a/ambari-web/test/utils/config_test.js
+++ b/ambari-web/test/utils/config_test.js
@@ -432,7 +432,7 @@ describe('App.config', function () {
   });
 
   describe('#preDefinedSiteProperties-stack-attribute', function() {
-    var HDP23Only = ['nfs.dump.dir', 'nfs.exports.allowed.hosts'];
+    var HDP23Only = ['nfs.dump.dir', 'nfs.exports.allowed.hosts', 'nimbus.seeds'];
     it('should ignore properties that not belongs to stack HDP - 2.2', function() {
       setups.setupStackVersion(this, 'HDP-2.2');
       expect(App.config.get('preDefinedSiteProperties').mapProperty('name')).to.not.include.members(HDP23Only);


Mime
View raw message