Просмотр исходного кода

AMBARI-1595. Add Oracle option for Hive Metastore during Ambari cluster install. (Xi Wang via yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1456282 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 лет назад
Родитель
Сommit
5e1a663cd8

+ 3 - 0
CHANGES.txt

@@ -122,6 +122,9 @@ Trunk (unreleased changes):
 
  IMPROVEMENTS
 
+ AMBARI-1595. Add Oracle option for Hive Metastore during Ambari
+ cluster install. (Xi Wang via yusaku)
+
  AMBARI-1632. Provide property filtering capability on service config
  sections. (yusaku)
 

+ 16 - 5
ambari-web/app/controllers/main/service/info/configs.js

@@ -635,15 +635,26 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
       var hiveDb = globals.findProperty('name', 'hive_database');
       if (hiveDb.value === 'New MySQL Database') {
         if (globals.someProperty('name', 'hive_ambari_host')) {
-          globals.findProperty('name', 'hive_ambari_host').name = 'hive_mysql_hostname';
+          globals.findProperty('name', 'hive_ambari_host').name = 'hive_hostname';
         }
-        globals = globals.without(globals.findProperty('name', 'hive_existing_host'));
-        globals = globals.without(globals.findProperty('name', 'hive_existing_database'));
-      } else {
-        globals.findProperty('name', 'hive_existing_host').name = 'hive_mysql_hostname';
+        globals = globals.without(globals.findProperty('name', 'hive_existing_mysql_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_mysql_database'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_oracle_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_oracle_database'));
+      } else if (hiveDb.value === 'Existing MySQL Database'){
+        globals.findProperty('name', 'hive_existing_mysql_host').name = 'hive_hostname';
+        globals = globals.without(globals.findProperty('name', 'hive_ambari_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_ambari_database'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_oracle_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_oracle_database'));
+      } else{ //existing oracle database
+        globals.findProperty('name', 'hive_existing_oracle_host').name = 'hive_hostname';
         globals = globals.without(globals.findProperty('name', 'hive_ambari_host'));
         globals = globals.without(globals.findProperty('name', 'hive_ambari_database'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_mysql_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_mysql_database'));
       }
+
     }
   },
 

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

@@ -62,18 +62,35 @@ App.WizardStep8Controller = Em.Controller.extend({
     if (globals.someProperty('name', 'hive_database')) {
       //TODO: Hive host depends on the type of db selected. Change puppet variable name if postgres is not the default db
       var hiveDb = globals.findProperty('name', 'hive_database');
+      var hiveDbType = {name: 'hive_database_type'};
+
       if (hiveDb.value === 'New MySQL Database') {
         if (globals.someProperty('name', 'hive_ambari_host')) {
-          globals.findProperty('name', 'hive_ambari_host').name = 'hive_mysql_hostname';
+          globals.findProperty('name', 'hive_ambari_host').name = 'hive_hostname';
+          hiveDbType.value = 'mysql';
         }
-        globals = globals.without(globals.findProperty('name', 'hive_existing_host'));
-        globals = globals.without(globals.findProperty('name', 'hive_existing_database'));
-      } else {
-        globals.findProperty('name', 'hive_existing_host').name = 'hive_mysql_hostname';
+        globals = globals.without(globals.findProperty('name', 'hive_existing_mysql_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_mysql_database'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_oracle_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_oracle_database'));
+      } else if (hiveDb.value === 'Existing MySQL Database'){
+        globals.findProperty('name', 'hive_existing_mysql_host').name = 'hive_hostname';
+        hiveDbType.value = 'mysql';
         globals = globals.without(globals.findProperty('name', 'hive_ambari_host'));
         globals = globals.without(globals.findProperty('name', 'hive_ambari_database'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_oracle_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_oracle_database'));
+      } else{ //existing oracle database
+        globals.findProperty('name', 'hive_existing_oracle_host').name = 'hive_hostname';
+        hiveDbType.value = 'oracle';
+        globals = globals.without(globals.findProperty('name', 'hive_ambari_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_ambari_database'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_mysql_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_mysql_database'));
       }
+      globals.push(hiveDbType);
     }
+
     this.set('globals', globals);
   },
 
@@ -578,9 +595,15 @@ App.WizardStep8Controller = Em.Controller.extend({
 
       dbComponent.set('component_value', 'MySQL (New Database)');
 
-    } else {
+    } else if(hiveDb.value === 'Existing MySQL Database'){
+
+      var db = App.db.getServiceConfigProperties().findProperty('name', 'hive_existing_mysql_database');
+
+      dbComponent.set('component_value', db.value + ' (' + hiveDb.value + ')');
+
+    } else { // existing oracle database
 
-      var db = App.db.getServiceConfigProperties().findProperty('name', 'hive_existing_database');
+      var db = App.db.getServiceConfigProperties().findProperty('name', 'hive_existing_oracle_database');
 
       dbComponent.set('component_value', db.value + ' (' + hiveDb.value + ')');
 

+ 2 - 2
ambari-web/app/data/config_mapping.js

@@ -342,9 +342,9 @@ module.exports = [
    */
   {
     "name": "javax.jdo.option.ConnectionURL",
-    "templateName": ["hive_mysql_hostname", "hive_database_name"],
+    "templateName": ["hive_database_type", "hive_hostname", "hive_database_name"],
     "foreignKey": null,
-    "value": "jdbc:mysql://<templateName[0]>/<templateName[1]>?createDatabaseIfNotExist=true",
+    "value": "jdbc:<templateName[0]>://<templateName[1]>/<templateName[2]>?createDatabaseIfNotExist=true",
     "filename": "hive-site.xml"
   },
   {

+ 38 - 4
ambari-web/app/data/config_properties.js

@@ -850,7 +850,11 @@ module.exports =
         },
         {
           displayName: 'Existing MySQL Database',
-          foreignKeys: ['hive_existing_database', 'hive_existing_host']
+          foreignKeys: ['hive_existing_mysql_database', 'hive_existing_mysql_host']
+        },
+        {
+          displayName: 'Existing Oracle Database',
+          foreignKeys: ['hive_existing_oracle_database', 'hive_existing_oracle_host']
         }
       ],
       "description": "MySQL will be installed by Ambari",
@@ -862,13 +866,14 @@ module.exports =
       "serviceName": "HIVE",
       "category": "Hive Metastore"
     },
+    // for existing MySQL
     {
       "id": "puppet var",
-      "name": "hive_existing_database",
+      "name": "hive_existing_mysql_database",
       "displayName": "Database Type",
       "value": "",
       "defaultValue": "MySQL",
-      "description": "Using an existing database for Hive Metastore",
+      "description": "Using an existing MySQL database for Hive Metastore",
       "displayType": "masterHost",
       "isVisible": false,
       "isReconfigurable": false,
@@ -908,7 +913,35 @@ module.exports =
     */
     {
       "id": "puppet var",
-      "name": "hive_existing_host",
+      "name": "hive_existing_mysql_host",
+      "displayName": "Database host",
+      "description": "Specify the host on which the existing database is hosted",
+      "defaultValue": "",
+      "isReconfigurable": false,
+      "displayType": "host",
+      "isVisible": false,
+      "domain": "global",
+      "serviceName": "HIVE",
+      "category": "Hive Metastore"
+    },
+    // for existing Oracle
+    {
+      "id": "puppet var",
+      "name": "hive_existing_oracle_database",
+      "displayName": "Database Type",
+      "value": "",
+      "defaultValue": "Oracle",
+      "description": "Using an existing Oracle database for Hive Metastore",
+      "displayType": "masterHost",
+      "isVisible": false,
+      "isReconfigurable": false,
+      "domain": "global",
+      "serviceName": "HIVE",
+      "category": "Hive Metastore"
+    },
+    {
+      "id": "puppet var",
+      "name": "hive_existing_oracle_host",
       "displayName": "Database host",
       "description": "Specify the host on which the existing database is hosted",
       "defaultValue": "",
@@ -919,6 +952,7 @@ module.exports =
       "serviceName": "HIVE",
       "category": "Hive Metastore"
     },
+    // for new MySQL
     {
       "id": "puppet var",
       "name": "hive_ambari_database",