ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject [5/5] ambari git commit: AMBARI-8669. UI: Support Hive Metastore HA (alexantonenko)
Date Thu, 11 Dec 2014 20:26:33 GMT
AMBARI-8669. UI: Support Hive Metastore HA (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 8ead0a50b8d07dd28e4ddc0c94c1b72ddd522588
Parents: 836df67
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Thu Dec 11 21:07:47 2014 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Thu Dec 11 22:24:45 2014 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 81 ++++++++++++++++++--
 ambari-web/app/controllers/main/service/item.js |  2 +-
 ambari-web/app/messages.js                      |  6 +-
 ambari-web/app/models/service_config.js         | 18 ++++-
 ambari-web/app/styles/application.less          |  3 +-
 .../main/host/details/deleteComponentPopup.hbs  |  4 +
 ambari-web/app/templates/wizard/step5.hbs       |  6 ++
 ambari-web/app/views/main/service/item.js       |  7 ++
 .../test/controllers/main/host/details_test.js  |  2 +-
 9 files changed, 114 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead0a50/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 2b15729..857fe72 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -209,6 +209,12 @@ App.MainHostDetailsController = Em.Controller.extend({
       bodyClass: Em.View.extend({
         templateName: require('templates/main/host/details/deleteComponentPopup')
       }),
+      isHiveMetastore: function () {
+        return componentName == 'HIVE_METASTORE';
+      }.property(),
+      deleteHiveMetastoreMsg: Em.View.extend({
+        template: Em.Handlebars.compile(Em.I18n.t('hosts.host.deleteComponent.popup.deleteHiveMetastore'))
+      }),
       isChecked: false,
       disablePrimary: function () {
         return !this.get('isChecked');
@@ -305,6 +311,9 @@ App.MainHostDetailsController = Em.Controller.extend({
     if (data.componentName == 'ZOOKEEPER_SERVER') {
       this.set('fromDeleteZkServer', true);
       this.loadConfigs();
+    } else if (data.componentName == 'HIVE_METASTORE') {
+      this.set('deleteHiveMetaStore', true);
+      this.loadConfigs('loadHiveConfigs');
     }
   },
 
@@ -424,12 +433,11 @@ App.MainHostDetailsController = Em.Controller.extend({
         })));
       return App.showAlertPopup(Em.I18n.t('host.host.addComponent.popup.dependedComponents.header'),
popupMessage);
     }
-    if (componentName === 'ZOOKEEPER_SERVER') {
+    if (componentName === 'ZOOKEEPER_SERVER' || componentName === 'HIVE_METASTORE') {
       return App.showConfirmationPopup(function () {
         self.primary(component);
-      }, Em.I18n.t('hosts.host.addComponent.addZooKeeper'));
-    }
-    else {
+      }, Em.I18n.t('hosts.host.addComponent.' + componentName ));
+    } else {
       if (this.get('securityEnabled') && componentName !== 'CLIENTS') {
         return App.showConfirmationPopup(function () {
           self.primary(component);
@@ -507,7 +515,6 @@ App.MainHostDetailsController = Em.Controller.extend({
    * @method primary
    */
   primary: function (component) {
-
     var self = this;
     componentsUtils.installHostComponent(self.get('content.hostName'), component);
   },
@@ -535,12 +542,71 @@ App.MainHostDetailsController = Em.Controller.extend({
         self.set('zkRequestId', data.Requests.id);
         self.addObserver('App.router.backgroundOperationsController.serviceTimestamp', self,
self.checkZkConfigs);
         self.checkZkConfigs();
+      }else if (params.componentName === 'HIVE_METASTORE'){
+       self.loadConfigs('loadHiveConfigs');
       }
     });
     return true;
   },
 
   /**
+   * Success callback for load configs request
+   * @param {object} data
+   * @method loadHiveConfigs
+   */
+  loadHiveConfigs: function (data) {
+    App.ajax.send({
+      name: 'admin.get.all_configurations',
+      sender: this,
+      data: {
+        urlParams: '(type=hive-site&tag=' + data.Clusters.desired_configs['hive-site'].tag
+ ')'
+      },
+      success: 'onLoadHiveConfigs'
+    });
+  },
+
+  /**
+   * update and save Hive hive.metastore.uris config to server
+   * @param {object} data
+   * @method onLoadHiveConfigs
+   */
+  onLoadHiveConfigs: function (data) {
+    var hiveMSHosts = this.getHiveHosts();
+
+    for (var i = 0; i < hiveMSHosts.length; i++) {
+      hiveMSHosts[i] = hiveMSHosts[i] + ":9083";
+    }
+    data.items[0].properties['hive.metastore.uris'] = hiveMSHosts.join(',');
+    App.ajax.send({
+      name: 'reassign.save_configs',
+      sender: this,
+      data: {
+        siteName: 'hive-site',
+        properties: data.items[0].properties,
+        service_config_version_note: Em.I18n.t('hosts.host.hive.configs.save.note')
+      }
+    });
+  },
+
+  /**
+   * Delete Hive Metastore is performed
+   * @type {bool}
+   */
+  deleteHiveMetaStore: false,
+
+  getHiveHosts: function () {
+    var hiveHosts = App.HostComponent.find().filterProperty('componentName', 'HIVE_METASTORE').mapProperty('hostName');
+    if (this.get('fromDeleteHost') || this.get('deleteHiveMetaStore')) {
+      this.set('deleteHiveMetaStore', false);
+      this.set('fromDeleteHost', false);
+      hiveHosts = hiveHosts.without(this.get('content.hostName'));
+    } else if (!hiveHosts.contains(this.get('content.hostName'))) {
+      hiveHosts.push(this.get('content.hostName'));
+    }
+    return hiveHosts;
+  },
+
+  /**
    * Send command to server to resfresh configs of selected component
    * @param {object} event
    * @method refreshComponentConfigs
@@ -607,11 +673,11 @@ App.MainHostDetailsController = Em.Controller.extend({
    * Load configs
    * @method loadConfigs
    */
-  loadConfigs: function () {
+  loadConfigs: function (callback) {
     App.ajax.send({
       name: 'config.tags',
       sender: this,
-      success: 'loadConfigsSuccessCallback'
+      success: callback ? callback : 'loadConfigsSuccessCallback'
     });
   },
 
@@ -1648,6 +1714,7 @@ App.MainHostDetailsController = Em.Controller.extend({
   deleteHostSuccessCallback: function (data) {
     var self = this;
     App.router.get('updateController').updateHost(function () {
+      self.loadConfigs('loadHiveConfigs');
       self.loadConfigs();
       App.router.transitionTo('hosts.index');
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead0a50/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index 2666032..be65323 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -52,7 +52,7 @@ App.MainServiceItemController = Em.Controller.extend({
       var hostNames = App.Host.find().mapProperty('hostName');
       this.set('allHosts', hostNames);
 
-      ['HBASE_MASTER', 'ZOOKEEPER_SERVER', 'FLUME_HANDLER'].forEach(function(componentName)
{
+      ['HBASE_MASTER', 'HIVE_METASTORE', 'ZOOKEEPER_SERVER', 'FLUME_HANDLER'].forEach(function(componentName)
{
         self.loadHostsWithoutComponent(componentName);
       });
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead0a50/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 201a312..4dbeb91 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2020,7 +2020,7 @@ Em.I18n.translations = {
   'hosts.host.installComponent.popup.confirm':'Confirm Install',
   'hosts.host.installComponent.msg':'Are you sure you want to install {0}?',
   'hosts.host.addComponent.msg':'Are you sure you want to add {0}?',
-  'hosts.host.addComponent.addZooKeeper':'Adding ZooKeeper Server may reconfigure such properties:<ul><li>ha.zookeeper.quorum</li><li>hbase.zookeeper.quorum</li><li>templeton.zookeeper.hosts</li><li>yarn.resourcemanager.zk-address</li><li>hive.zookeeper.quorum</li><li>hive.cluster.delegation.token.store.zookeeper.connectString</li></ul>',
+  'hosts.host.addComponent.ZOOKEEPER_SERVER':'Adding ZooKeeper Server may reconfigure such
properties:<ul><li>ha.zookeeper.quorum</li><li>hbase.zookeeper.quorum</li><li>templeton.zookeeper.hosts</li><li>yarn.resourcemanager.zk-address</li><li>hive.zookeeper.quorum</li><li>hive.cluster.delegation.token.store.zookeeper.connectString</li></ul>',
   'hosts.host.addComponent.deleteHostWithZooKeeper':'Deleting host with ZooKeeper Server
may reconfigure such properties:<ul><li>ha.zookeeper.quorum</li><li>hbase.zookeeper.quorum</li><li>templeton.zookeeper.hosts</li><li>yarn.resourcemanager.zk-address</li><li>hive.zookeeper.quorum</li><li>hive.cluster.delegation.token.store.zookeeper.connectString</li></ul>',
   'host.host.addComponent.popup.dependedComponents.body': '{0} requires {1} to be installed
along with it on the same host. Please add them first and then try adding {0}',
   'host.host.addComponent.popup.dependedComponents.header': 'Component dependencies',
@@ -2043,6 +2043,9 @@ Em.I18n.translations = {
   'hosts.host.hbase_regionserver.decommission.warning':'Last RegionServer can\'t be decommissioned',
   'hosts.host.decommissioned':'Decommissioned',
   'hosts.host.decommissioning':'Decommissioning',
+  'hosts.host.addComponent.HIVE_METASTORE':'Adding Hive Metastore will reconfigure such properties:<ul><li>hive.metastore.uris</li></ul>',
+  'hosts.host.deleteComponent.popup.deleteHiveMetastore':'Deleting <i>Hive Metastorer</i>
reconfigure such properties:<ul><li>hive.metastore.uris</li></ul>',
+  'hosts.host.hive.configs.save.note': 'This configuration is created by ambari while installing/deleting
hive component on a host',
 
   'hosts.component.passive.implied.host.mode.tooltip':'Cannot Turn Off Maintenance Mode because
Host is in Maintenance Mode',
   'hosts.component.passive.implied.service.mode.tooltip':'Cannot Turn Off Maintenance Mode
because {0} is in Maintenance Mode',
@@ -2309,6 +2312,7 @@ Em.I18n.translations = {
 
   'dashboard.services.hive.clients':'Hive Clients',
   'dashboard.services.hive.client':'Hive Client',
+  'dashboard.services.hive.metastore':'Hive Metastore',
 
   'dashboard.services.oozie.clients':'Oozie Clients',
   'dashboard.services.oozie.client':'Oozie Client',

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead0a50/ambari-web/app/models/service_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service_config.js b/ambari-web/app/models/service_config.js
index c4338db..cfd01d1 100644
--- a/ambari-web/app/models/service_config.js
+++ b/ambari-web/app/models/service_config.js
@@ -435,10 +435,6 @@ App.ServiceConfigProperty = Ember.Object.extend({
       case 'hivemetastore_host':
         this.set('value', masterComponentHostsInDB.findProperty('component', 'HIVE_SERVER').hostName);
         break;
-      case 'hive.metastore.uris':
-        var hiveHost = masterComponentHostsInDB.findProperty('component', 'HIVE_SERVER').hostName;
-        this.setDefaultValue(hostWithPrefix,'://' + hiveHost);
-        break;
       case 'hive_ambari_host':
         this.set('value', masterComponentHostsInDB.findProperty('component', 'HIVE_SERVER').hostName);
         break;
@@ -482,6 +478,20 @@ App.ServiceConfigProperty = Ember.Object.extend({
         var hiveServerHost = masterComponentHostsInDB.findProperty('component', 'HIVE_SERVER').hostName;
         this.set('value', hiveServerHost).set('defaultValue', hiveServerHost);
         break;
+      case 'hive.metastore.uris':
+        var hiveMSHosts = masterComponentHostsInDB.filterProperty('component', 'HIVE_METASTORE').mapProperty('hostName'),
+            hiveMSHostPort = hiveMSHosts,
+            regex = "\\w*:(\\d+)",
+            portValue = this.get('defaultValue').match(new RegExp(regex));
+
+        if (!portValue) return;
+        if (portValue[1]) {
+          for (var i = 0; i < hiveMSHosts.length; i++) {
+            hiveMSHostPort[i] = hiveMSHosts[i] + ":" + portValue[1];
+          }
+        }
+        this.setDefaultValue("(.*)", hiveMSHostPort);
+        break;
       case 'oozie_existing_mysql_host':
       case 'oozie_existing_postgresql_host':
       case 'oozie_existing_oracle_host':

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead0a50/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index c9556d1..aa5e8b7 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -4175,7 +4175,8 @@ table.graphs {
   .hostName {
     word-wrap: break-word!important;
     white-space: normal;
-    width: 220px
+    width: 220px;
+    display: inline-block;
   }
   .hostString {
     margin-bottom: 5px;

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead0a50/ambari-web/app/templates/main/host/details/deleteComponentPopup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/details/deleteComponentPopup.hbs b/ambari-web/app/templates/main/host/details/deleteComponentPopup.hbs
index 36cbeaa..0e89b1f 100644
--- a/ambari-web/app/templates/main/host/details/deleteComponentPopup.hbs
+++ b/ambari-web/app/templates/main/host/details/deleteComponentPopup.hbs
@@ -27,4 +27,8 @@
   <br />
   <div class='alert'>{{view deleteZkServerMsg}}</div>
 {{/if}}
+{{#if isHiveMetastore}}
+  <br />
+  <div class='alert'>{{view deleteHiveMetastoreMsg}}</div>
+{{/if}}
 <div class='alert'>{{view restartNagiosMsg}}</div>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead0a50/ambari-web/app/templates/wizard/step5.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step5.hbs b/ambari-web/app/templates/wizard/step5.hbs
index d08496b..3c48e18 100644
--- a/ambari-web/app/templates/wizard/step5.hbs
+++ b/ambari-web/app/templates/wizard/step5.hbs
@@ -61,6 +61,12 @@
                       <div class="hostName">
                         {{selectedHost}}<i class="icon-asterisks">&#10037;</i>
                       </div>
+                      {{#if showAddControl}}
+                        {{view App.AddControlView componentNameBinding="component_name"}}
+                      {{/if}}
+                      {{#if showRemoveControl}}
+                        {{view App.RemoveControlView componentNameBinding="component_name"
serviceComponentIdBinding="serviceComponentId"}}
+                      {{/if}}
                     {{else}}
                       <div {{bindAttr class="errorMessage:error: warnMessage:warning:
:control-group"}}>
                         {{#if view.shouldUseInputs}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead0a50/ambari-web/app/views/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/item.js b/ambari-web/app/views/main/service/item.js
index 5cb8bd8..c0bcd73 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/ambari-web/app/views/main/service/item.js
@@ -153,6 +153,13 @@ App.MainServiceItemView = Em.View.extend({
         component: 'HBASE_MASTER'
       },
       {
+       cssClass: 'icon-plus',
+       'label': '{0} {1}'.format(Em.I18n.t('add'), Em.I18n.t('dashboard.services.hive.metastore')),
+       service: 'HIVE',
+       component: 'HIVE_METASTORE',
+       isHidden: !App.get('isHadoop22Stack')
+      },
+      {
         cssClass: 'icon-plus',
         'label': '{0} {1}'.format(Em.I18n.t('add'), Em.I18n.t('dashboard.services.zookeeper.server')),
         service: 'ZOOKEEPER',

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead0a50/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index a36267b..15c7702 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -2285,7 +2285,7 @@ describe('App.MainHostDetailsController', function () {
       controller.deleteHostSuccessCallback();
       expect(App.router.get.calledWith('updateController')).to.be.true;
       expect(mock.updateHost.calledOnce).to.be.true;
-      expect(controller.loadConfigs.calledOnce).to.be.true;
+      expect(controller.loadConfigs.called).to.be.true;
       expect(App.router.transitionTo.calledWith('hosts.index')).to.be.true;
       expect(App.router.get.calledWith('clusterController')).to.be.true;
       expect(mock.getAllHostNames.calledOnce).to.be.true;


Mime
View raw message