浏览代码

AMBARI-1145. Cluster Management refactoring. (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1431654 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 年之前
父节点
当前提交
a17b159112

+ 22 - 5
ambari-web/app/controllers/wizard.js

@@ -249,13 +249,30 @@ App.WizardController = Em.Controller.extend({
 
     var self = this;
     var clusterName = this.get('content.cluster.name');
-    var url = (App.testMode) ? '/data/wizard/deploy/2_hosts/poll_1.json' : App.apiPrefix + '/clusters/' + clusterName + '/services?ServiceInfo/state=INIT';
+    var url;
     var method = (App.testMode) ? 'GET' : 'PUT';
-    var data = '{"ServiceInfo": {"state": "INSTALLED"}}';
+    var data;
 
-    if(this.get('content.controllerName') === 'addHostController'){
-      url = App.apiPrefix + '/clusters/' + clusterName + '/host_components?HostRoles/state=INIT';
-      data = '{"HostRoles": {"state": "INSTALLED"}}';
+    switch (this.get('content.controllerName')) {
+      case 'addHostController':
+        if (isRetry) {
+          url = App.apiPrefix + '/clusters/' + clusterName + '/host_components?HostRoles/state!=INSTALLED';
+          data = '{"HostRoles": {"state": "INSTALLED"}}';
+        } else {
+          url = App.apiPrefix + '/clusters/' + clusterName + '/host_components?HostRoles/state=INIT';
+          data = '{"HostRoles": {"state": "INSTALLED"}}';
+        }
+        break;
+      case 'installerController':
+      default:
+        if (isRetry) {
+          url = (App.testMode) ? '/data/wizard/deploy/2_hosts/poll_1.json' : App.apiPrefix + '/clusters/' + clusterName + '/host_components?HostRoles/state!=INSTALLED';
+          data = '{"HostRoles": {"state": "INSTALLED"}}';
+        } else {
+          url = (App.testMode) ? '/data/wizard/deploy/2_hosts/poll_1.json' : App.apiPrefix + '/clusters/' + clusterName + '/services?ServiceInfo/state=INIT';
+          data = '{"ServiceInfo": {"state": "INSTALLED"}}';
+        }
+        break;
     }
 
     $.ajax({

+ 2 - 2
ambari-web/app/controllers/wizard/step3_controller.js

@@ -287,7 +287,7 @@ App.WizardStep3Controller = Em.Controller.extend({
         }
       },
       statusCode: require('data/statusCodes')
-    }).retry({times: App.times, timeout: App.timeout}).then(null,
+    }).retry({times: App.maxRetries, timeout: App.timeout}).then(null,
       function () {
         App.showReloadPopup();
         console.log('Bootstrap failed');
@@ -394,7 +394,7 @@ App.WizardStep3Controller = Em.Controller.extend({
         }
       },
       statusCode: require('data/statusCodes')
-    }).retry({times: App.times, timeout: App.timeout}).then(null, function () {
+    }).retry({times: App.maxRetries, timeout: App.timeout}).then(null, function () {
         App.showReloadPopup();
         console.log('Error: Getting registered host information from the server');
       });

+ 1 - 1
ambari-web/app/controllers/wizard/step7_controller.js

@@ -39,7 +39,7 @@ App.WizardStep7Controller = Em.Controller.extend({
   slaveHostToGroup: null,
 
   isSubmitDisabled: function () {
-    return !this.stepConfigs.everyProperty('errorCount', 0);
+    return !this.stepConfigs.filterProperty('showConfig', true).everyProperty('errorCount', 0);
   }.property('stepConfigs.@each.errorCount'),
 
   selectedServiceNames: function () {

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

@@ -833,8 +833,6 @@ App.WizardStep8Controller = Em.Controller.extend({
         return { "ServiceComponentInfo": { "component_name": _component.component_name } };
       });
 
-      debugger;
-
       // Service must be specified in terms of a query for creating multiple components at the same time.
       // See AMBARI-1018.
       var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/services?ServiceInfo/service_name=' + _service;
@@ -947,6 +945,12 @@ App.WizardStep8Controller = Em.Controller.extend({
                   hostNames.pushObject(_masterHost.hostName);
                 }, this);
                 break;
+              case 'HCAT':
+                // install HCAT (client) on NAGIOS_SERVER host
+                masterHosts.filterProperty('component', 'NAGIOS_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
+                  hostNames.pushObject(_masterHost.hostName);
+                }, this);
+                break;
             }
             hostNames = hostNames.uniq();
             this.registerHostsToComponent(hostNames, _client.component_name);
@@ -1248,7 +1252,7 @@ App.WizardStep8Controller = Em.Controller.extend({
     configs.forEach(function (_configProperty) {
       hiveProperties[_configProperty.name] = _configProperty.value;
     }, this);
-    hiveProperties['hive.metastore.uris'] = 'thrift://' + this.get('globals').findProperty('hivemetastore_host').value + ':9083';
+    hiveProperties['hive.metastore.uris'] = 'thrift://' + this.get('globals').findProperty('name', 'hivemetastore_host').value + ':9083';
     hiveProperties['javax.jdo.option.ConnectionURL'] =
       'jdbc:mysql://' + this.get('globals').findProperty('name', 'hive_mysql_host').value +
       '/' + this.get('globals').findProperty('name', 'hive_database_name').value + '?createDatabaseIfNotExist=true';

+ 2 - 2
ambari-web/app/controllers/wizard/step9_controller.js

@@ -226,7 +226,7 @@ App.WizardStep9Controller = Em.Controller.extend({
     var method = 'PUT';
 
     if (this.get('content.controllerName') === 'addHostController') {
-      url = App.apiPrefix + '/clusters/' + clusterName + '/host_components?HostRoles/state=INSTALLED';
+      url = App.apiPrefix + '/clusters/' + clusterName + '/host_components?HostRoles/component_name=GANGLIA_MONITOR|HostRoles/component_name=HBASE_REGIONSERVER|HostRoles/component_name=DATANODE|HostRoles/component_name=TASKTRACKER&HostRoles/state=INSTALLED';
       data = '{"HostRoles": {"state": "STARTED"}}';
     }
 
@@ -581,7 +581,7 @@ App.WizardStep9Controller = Em.Controller.extend({
       },
 
       statusCode: require('data/statusCodes')
-    }).retry({times: App.times, timeout: App.timeout}).then(null,
+    }).retry({times: App.maxRetries, timeout: App.timeout}).then(null,
       function () {
         App.showReloadPopup();
         console.log('Install services all retries failed');

+ 11 - 10
ambari-web/app/data/config_properties.js

@@ -413,8 +413,8 @@ module.exports =
       "name": "dfs_name_dir",
       "displayName": "NameNode directories",
       "description": "NameNode directories for HDFS to store the file system image",
-      "defaultValue": "/grid/0/hadoop/hdfs/namenode\n/grid/1/hadoop/hdfs/namenode\n",
-      "defaultDirectory": "hadoop/hdfs/namenode",
+      "defaultValue": "",
+      "defaultDirectory": "/hadoop/hdfs/namenode",
       "isReconfigurable": false,
       "displayType": "directories",
       "isVisible": true,
@@ -440,8 +440,8 @@ module.exports =
       "name": "fs_checkpoint_dir",
       "displayName": "SecondaryNameNode Checkpoint directory",
       "description": "Directory on the local filesystem where the Secondary NameNode should store the temporary images to merge",
-      "defaultValue": "/grid/0/hadoop/hdfs/namesecondary",
-      "defaultDirectory": "hadoop/hdfs/namesecondary",
+      "defaultValue": "",
+      "defaultDirectory": "/hadoop/hdfs/namesecondary",
       "isReconfigurable": false,
       "displayType": "directory",
       "isVisible": true,
@@ -468,8 +468,8 @@ module.exports =
       "name": "dfs_data_dir",
       "displayName": "DataNode directories",
       "description": "DataNode directories for HDFS to store the data blocks",
-      "defaultValue": "/tmp/hadoop/hdfs/data",
-      "defaultDirectory": "hadoop/hdfs/data",
+      "defaultValue": "",
+      "defaultDirectory": "/hadoop/hdfs/data",
       "isReconfigurable": false,
       "displayType": "directories",
       "isVisible": true,
@@ -1261,8 +1261,8 @@ module.exports =
       "name": "mapred_local_dir",
       "displayName": "MapReduce local directories",
       "description": "Directories for MapReduce to store intermediate data files",
-      "defaultValue": "/grid/0/hadoop/mapred\n/grid/1/hadoop/mapred\n",
-      "defaultDirectory": "hadoop/mapred",
+      "defaultValue": "",
+      "defaultDirectory": "/hadoop/mapred",
       "displayType": "directories",
       "isReconfigurable": false,
       "isVisible": true,
@@ -2139,6 +2139,7 @@ module.exports =
       "displayName": "Oozie Data Dir",
       "description": "Data directory in which the Oozie DB exists",
       "defaultValue": "",
+      "defaultDirectory": "/hadoop/oozie/data",
       "isReconfigurable": false,
       "displayType": "directory",
       "isVisible": true,
@@ -2191,8 +2192,8 @@ module.exports =
       "name": "zk_data_dir",
       "displayName": "ZooKeeper directory",
       "description": "Data directory for ZooKeeper",
-      "defaultValue": "/grid/0/hadoop/zookeeper",
-      "defaultDirectory": "hadoop/zookeeper",
+      "defaultValue": "",
+      "defaultDirectory": "/hadoop/zookeeper",
       "isReconfigurable": false,
       "displayType": "directory",
       "isVisible": true,

+ 5 - 4
ambari-web/app/initialize.js

@@ -19,16 +19,17 @@
 
 window.App = require('app');
 
-App.testMode = true;
+App.testMode = false;
 App.skipBootstrap = false;
-App.alwaysGoToInstaller = true;
+App.alwaysGoToInstaller = false;
 App.apiPrefix = '/api/v1';
 App.defaultStackVersion = 'HDP-1.2.0';
 App.defaultLocalStackVersion = 'HDPLocal-1.2.0';
+App.addServicesEnabled = false;
 // default AJAX timeout
 App.timeout = 20000;
-// retry times
-App.times = 3;
+// max number of retries for certain AJAX calls
+App.maxRetries = 3;
 App.bgOperationsUpdateInterval = 6000;
 App.componentsUpdateInterval = 6000;
 App.contentUpdateInterval = 15000;

+ 1 - 0
ambari-web/app/mappers/service_mapper.js

@@ -21,6 +21,7 @@ App.servicesMapper = App.QuickDataMapper.create({
     'MAPREDUCE',
     'HBASE',
     'HIVE',
+    'HCATALOG',
     'WEBHCAT',
     'OOZIE',
     'GANGLIA',

+ 2 - 0
ambari-web/app/models/component.js

@@ -42,6 +42,8 @@ App.Component = DS.Model.extend({
       case 'JOBTRACKER':
       case 'ZOOKEEPER_SERVER':
       case 'HIVE_SERVER':
+      case 'HIVE_METASTORE':
+      case 'MYSQL_SERVER':
       case 'HBASE_MASTER':
       case 'NAGIOS_SERVER':
       case 'GANGLIA_SERVER':

+ 3 - 1
ambari-web/app/models/host_component.js

@@ -40,11 +40,13 @@ App.HostComponent = DS.Model.extend({
       case 'JOBTRACKER':
       case 'ZOOKEEPER_SERVER':
       case 'HIVE_SERVER':
+      case 'HIVE_METASTORE':
+      case 'MYSQL_SERVER':
       case 'HBASE_MASTER':
       case 'NAGIOS_SERVER':
       case 'GANGLIA_SERVER':
       case 'OOZIE_SERVER':
-      case 'TEMPLETON_SERVER':
+      case 'WEBHCAT_SERVER':
         return true;
       default:
         return false;

+ 2 - 1
ambari-web/app/models/service.js

@@ -66,7 +66,6 @@ App.Service = DS.Model.extend({
       "HBASE",
       "OOZIE",
       "HIVE",
-      "WEBHCAT",
       "ZOOKEEPER",
       "PIG",
       "SQOOP"
@@ -103,6 +102,8 @@ App.Service = DS.Model.extend({
         return 'Oozie';
       case 'hive':
         return 'Hive/HCat';
+      case 'hcatalog':
+        return 'HCat';
       case 'zookeeper':
         return 'ZooKeeper';
       case 'pig':

+ 23 - 15
ambari-web/app/models/service_config.js

@@ -176,11 +176,13 @@ App.ServiceConfigProperty = Ember.Object.extend({
         this.unionAllMountPoints(!isOnlyFirstOneNeeded);
         break;
       case 'fs_checkpoint_dir':
-      case 'zk_data_dir' :
+      case 'zk_data_dir':
+      case 'oozie_data_dir':
         this.unionAllMountPoints(isOnlyFirstOneNeeded);
         break;
     }
   },
+  
   unionAllMountPoints: function (isOnlyFirstOneNeeded) {
     var hostname = '';
     var mountPointsPerHost = [];
@@ -221,20 +223,24 @@ App.ServiceConfigProperty = Ember.Object.extend({
           setOfHostNames.push(host.hostName);
         }, this);
         break;
-
       case 'mapred_local_dir':
         temp = slaveComponentHostsInDB.findProperty('componentName', 'TASKTRACKER');
         temp.hosts.forEach(function (host) {
           setOfHostNames.push(host.hostName);
         }, this);
         break;
-
       case 'zk_data_dir':
         var components = masterComponentHostsInDB.filterProperty('component', 'ZOOKEEPER_SERVER');
         components.forEach(function (component) {
           setOfHostNames.push(component.hostName);
         }, this);
         break;
+      case 'oozie_data_dir':
+        var components = masterComponentHostsInDB.filterProperty('component', 'OOZIE_SERVER');
+        components.forEach(function (component) {
+          setOfHostNames.push(component.hostName);
+        }, this);
+        break;
     }
 
     var allMountPoints = [];
@@ -250,8 +256,9 @@ App.ServiceConfigProperty = Ember.Object.extend({
       });
 
       mountPointsPerHost.forEach(function (mPoint) {
-        if( !allMountPoints.findProperty("mountpoint", mPoint.mountpoint) )
+        if( !allMountPoints.findProperty("mountpoint", mPoint.mountpoint)) {
           allMountPoints.push(mPoint);
+        }
       }, this);
     }
     if (allMountPoints.length == 0) {
@@ -261,28 +268,29 @@ App.ServiceConfigProperty = Ember.Object.extend({
     if (!isOnlyFirstOneNeeded) {
       allMountPoints.forEach(function (eachDrive) {
         var mPoint = this.get('value');
-        if (!mPoint)
+        if (!mPoint) {
           mPoint = "";
-        if (eachDrive.mountpoint.charAt(eachDrive.mountpoint.length - 1) === "/")
-          mPoint += ( eachDrive.mountpoint + this.get('defaultDirectory') + "\n" );
-        else
-          mPoint += ( eachDrive.mountpoint + "/" + this.get('defaultDirectory') + "\n" );
-
+        }
+        if (eachDrive.mountpoint === "/") {
+          mPoint += this.get('defaultDirectory') + "\n";
+        } else {
+          mPoint += eachDrive.mountpoint + this.get('defaultDirectory') + "\n";
+        }
         this.set('value', mPoint);
         this.set('defaultValue', mPoint);
       }, this);
     } else {
       var mPoint = allMountPoints[0].mountpoint;
-      if (mPoint.charAt(mPoint.length - 1) === "/")
+      if (mPoint === "/") {
+        mPoint = this.get('defaultDirectory') + "\n";
+      } else {
         mPoint = mPoint + this.get('defaultDirectory') + "\n";
-      else
-        mPoint = mPoint + "/" + this.get('defaultDirectory') + "\n";
+      }
       this.set('value', mPoint);
       this.set('defaultValue', mPoint);
-
     }
-
   },
+
   isValid: function () {
     return this.get('errorMessage') === '';
   }.property('errorMessage'),

+ 2 - 2
ambari-web/app/templates/main/host/summary.hbs

@@ -95,9 +95,9 @@
               <div class="span8">
                 {{#each component in view.clients}}
                 {{#if component.isLast}}
-                {{component.service.displayName}}
+                {{component.displayName}}
                 {{else}}
-                {{component.service.displayName}},
+                {{component.displayName}},
                 {{/if}}
                 {{/each}}
               </div>

+ 2 - 0
ambari-web/app/templates/main/service.hbs

@@ -20,6 +20,7 @@
   <div id="services-menu" class="well span2" style="padding: 8px 0">
     {{view App.MainServiceMenuView}}
     {{#if controller.isAdmin}}
+    {{#if App.addServicesEnabled}}
     <div class="add-service-button">
       <a class="btn" {{action addService href="true"}}>
         <i class="icon-plus"></i>
@@ -27,6 +28,7 @@
       </a>
     </div>
     {{/if}}
+    {{/if}}
   </div>
   <div class="span10">
     {{outlet}}

+ 2 - 2
ambari-web/app/views/main/host/summary.js

@@ -109,8 +109,8 @@ App.MainHostSummaryView = Em.View.extend({
         //temporary fix because of different data in hostComponents and serviceComponents
         return;
       }
-      if(!component.get('isSlave') && !component.get('isMaster')) {
-        if(clients.length){
+      if (!component.get('isSlave') && !component.get('isMaster')) {
+        if (clients.length) {
           clients[clients.length-1].set('isLast', false);
         }
         component.set('isLast', true);

+ 1 - 1
ambari-web/app/views/main/service/menu.js

@@ -21,7 +21,7 @@ var App = require('app');
 App.MainServiceMenuView = Em.CollectionView.extend({
   content:function () {
     var items = App.router.get('mainServiceController.content').filter(function(item){
-      if(['PIG', 'SQOOP'].contains(item.get('id'))){
+      if(['PIG', 'SQOOP', 'HCATALOG'].contains(item.get('id'))){
         return false;
       }
       return true;