You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/01/23 18:49:25 UTC

ambari git commit: AMBARI-9302. 'hive.metastore.uris', hadoop.proxyuser..hosts values isn't updated after Metastore/HiveServer2 reassign (alexantonenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk a1e130fa1 -> dcf47a45f


AMBARI-9302. 'hive.metastore.uris', hadoop.proxyuser.<username>.hosts values isn't updated after Metastore/HiveServer2 reassign (alexantonenko)


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

Branch: refs/heads/trunk
Commit: dcf47a45f9c5a05f1d6f279f408d37a7b11c78b6
Parents: a1e130f
Author: Alex Antonenko <hi...@gmail.com>
Authored: Fri Jan 23 18:16:11 2015 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Fri Jan 23 19:48:43 2015 +0200

----------------------------------------------------------------------
 .../main/service/reassign/step4_controller.js   | 41 +++++++++++++++++---
 1 file changed, 36 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/dcf47a45/ambari-web/app/controllers/main/service/reassign/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/reassign/step4_controller.js b/ambari-web/app/controllers/main/service/reassign/step4_controller.js
index 7e970ac..dc70225 100644
--- a/ambari-web/app/controllers/main/service/reassign/step4_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign/step4_controller.js
@@ -45,7 +45,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
     'WEBHCAT_SERVER': ['HDFS', 'ZOOKEEPER', 'HBASE', 'FLUME', 'SQOOP', 'STORM'],
     'HIVE_SERVER': ['HDFS', 'ZOOKEEPER', 'HBASE', 'FLUME', 'SQOOP', 'STORM'],
     'HIVE_METASTORE': ['HDFS', 'ZOOKEEPER', 'HBASE', 'FLUME', 'SQOOP', 'STORM'],
-    'MYSQL_SERVER': ['HDFS', 'ZOOKEEPER', 'HBASE', 'FLUME', 'SQOOP', 'STORM'],
+    'MYSQL_SERVER': ['HDFS', 'ZOOKEEPER', 'HBASE', 'FLUME', 'SQOOP', 'STORM']
   },
 
   /**
@@ -476,13 +476,12 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
       case 'OOZIE_SERVER':
         urlParams.push('(type=oozie-site&tag=' + data.Clusters.desired_configs['oozie-site'].tag + ')');
         break;
-      case 'WEBHCAT_SERVER':
-        urlParams.push('(type=webhcat-site&tag=' + data.Clusters.desired_configs['webhcat-site'].tag + ')');
       case 'HIVE_SERVER':
-        urlParams.push('(type=hive-site&tag=' + data.Clusters.desired_configs['hive-site'].tag + ')');
-        break;
       case 'HIVE_METASTORE':
         urlParams.push('(type=hive-site&tag=' + data.Clusters.desired_configs['hive-site'].tag + ')');
+        urlParams.push('(type=webhcat-site&tag=' + data.Clusters.desired_configs['webhcat-site'].tag + ')');
+        urlParams.push('(type=hive-env&tag=' + data.Clusters.desired_configs['hive-env'].tag + ')');
+        urlParams.push('(type=core-site&tag=' + data.Clusters.desired_configs['core-site'].tag + ')');
         break;
       case 'MYSQL_SERVER':
         urlParams.push('(type=hive-site&tag=' + data.Clusters.desired_configs['hive-site'].tag + ')');
@@ -526,6 +525,10 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
       this.setSpecificResourceMangerConfigs(configs, targetHostName);
     }
 
+    if (componentName === 'HIVE_METASTORE' || componentName === 'HIVE_SERVER') {
+      this.setSpecificHiveConfigs(configs, targetHostName);
+    }
+
     this.saveClusterStatus(secureConfigs, this.getComponentDir(configs, componentName));
     this.saveConfigsToServer(configs);
     this.saveServiceProperties(configs);
@@ -623,6 +626,34 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
   },
 
   /**
+   * set specific configs which applies only to Hive related configs
+   * @param configs
+   * @param targetHostName
+   */
+  setSpecificHiveConfigs: function (configs, targetHostName) {
+    var sourceHostName = this.get('content.reassignHosts.source');
+    var hiveMSHosts = App.HostComponent.find().filterProperty('componentName', 'HIVE_METASTORE').mapProperty('hostName');
+    if (this.get('content.reassign.component_name') === 'HIVE_METASTORE') hiveMSHosts = hiveMSHosts.removeObject(sourceHostName).addObject(targetHostName);
+    var hiveServerHosts = App.HostComponent.find().filterProperty('componentName', 'HIVE_SERVER').mapProperty('hostName');
+    if (this.get('content.reassign.component_name') === 'HIVE_SERVER') hiveServerHosts = hiveServerHosts.removeObject(sourceHostName).addObject(targetHostName);
+    var hiveMasterHosts = hiveMSHosts.concat(hiveServerHosts).uniq().join(',');
+    var hiveUser = configs['hive-env']['hive_user'];
+    var webhcatUser = configs['hive-env']['webhcat_user'];
+
+    var port = configs['hive-site']['hive.metastore.uris'].match(/:[0-9]{2,4}/);
+    port = port ? port[0].slice(1) : "9083";
+
+    for (var i = 0; i < hiveMSHosts.length; i++) {
+      hiveMSHosts[i] = "thrift://" + hiveMSHosts[i] + ":" + port;
+    }
+
+    configs['hive-site']['hive.metastore.uris'] = hiveMSHosts.join(',');
+    configs['webhcat-site']['templeton.hive.properties'] = configs['webhcat-site']['templeton.hive.properties'].replace(/thrift.+[0-9]{2,},/i, hiveMSHosts.join('\\,') + ",");
+    configs['core-site']['hadoop.proxyuser.' + hiveUser + '.hosts'] = hiveMasterHosts;
+    configs['core-site']['hadoop.proxyuser.' + webhcatUser + '.hosts'] = hiveMasterHosts;
+  },
+
+  /**
    * set secure configs for component
    * @param secureConfigs
    * @param configs