Browse Source

AMBARI-4205. Add Existing Postgres Database option for Hive and Oozie Database during Ambari cluster install. (Michael Harp via mahadev)

Mahadev Konar 11 years ago
parent
commit
929a0ddf95
17 changed files with 278 additions and 14 deletions
  1. 8 0
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/package/scripts/hive.py
  2. 3 1
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/package/scripts/hive_service.py
  3. 2 0
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/package/scripts/params.py
  4. 3 1
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/OOZIE/package/scripts/oozie.py
  5. 3 1
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/OOZIE/package/scripts/oozie_service.py
  6. 2 0
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/OOZIE/package/scripts/params.py
  7. 7 0
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive.py
  8. 3 1
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py
  9. 2 0
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py
  10. 3 1
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/package/scripts/oozie.py
  11. 3 1
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/package/scripts/oozie_service.py
  12. 2 0
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/package/scripts/params.py
  13. 38 2
      ambari-web/app/controllers/main/service/info/configs.js
  14. 42 6
      ambari-web/app/controllers/wizard/step8_controller.js
  15. 71 0
      ambari-web/app/data/HDP2/global_properties.js
  16. 72 0
      ambari-web/app/data/global_properties.js
  17. 14 0
      ambari-web/app/views/wizard/controls_view.js

+ 8 - 0
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/package/scripts/hive.py

@@ -156,6 +156,14 @@ def jdbc_connector():
             creates=params.target,
             path=["/bin", "/usr/bin/"])
 
+  elif params.hive_jdbc_driver == "org.postgresql.Driver":
+    cmd = format("hive mkdir -p {artifact_dir} ; cp /usr/share/java/{jdbc_jar_name} {target}")
+
+    Execute(cmd,
+            not_if=format("test -f {target}"),
+            creates=params.target,
+            path=["/bin", "usr/bin/"])
+
   elif params.hive_jdbc_driver == "oracle.jdbc.driver.OracleDriver":
     cmd = format(
       "mkdir -p {artifact_dir} ; curl -kf --retry 10 {driver_curl_source} -o {driver_curl_target} &&  "

+ 3 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/package/scripts/hive_service.py

@@ -44,7 +44,9 @@ def hive_service(
             not_if=no_op_test
     )
 
-    if params.hive_jdbc_driver == "com.mysql.jdbc.Driver" or params.hive_jdbc_driver == "oracle.jdbc.driver.OracleDriver":
+    if params.hive_jdbc_driver == "com.mysql.jdbc.Driver" or \
+       params.hive_jdbc_driver == "org.postgresql.Driver" or \
+       params.hive_jdbc_driver == "oracle.jdbc.driver.OracleDriver":
       db_connection_check_command = format(
         "{java64_home}/bin/java -cp {check_db_connection_jar}:/usr/share/java/{jdbc_jar_name} org.apache.ambari.server.DBConnectionVerification {hive_jdbc_connection_url} {hive_metastore_user_name} {hive_metastore_user_passwd!p} {hive_jdbc_driver}")
       Execute(db_connection_check_command,

+ 2 - 0
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/package/scripts/params.py

@@ -37,6 +37,8 @@ hive_lib = '/usr/lib/hive/lib/'
 hive_jdbc_driver = config['configurations']['hive-site']['javax.jdo.option.ConnectionDriverName']
 if hive_jdbc_driver == "com.mysql.jdbc.Driver":
   jdbc_jar_name = "mysql-connector-java.jar"
+elif hive_jdbc_driver == "org.postgresql.Driver":
+  jdbc_jar_name = "postgresql-jdbc.jar"
 elif hive_jdbc_driver == "oracle.jdbc.driver.OracleDriver":
   jdbc_jar_name = "ojdbc6.jar"
 

+ 3 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/OOZIE/package/scripts/oozie.py

@@ -62,7 +62,9 @@ def oozie(is_server=False
          owner=params.oozie_user
     )
 
-  if params.jdbc_driver_name == "com.mysql.jdbc.Driver" or params.jdbc_driver_name == "oracle.jdbc.driver.OracleDriver":
+  if params.jdbc_driver_name == "com.mysql.jdbc.Driver" or \
+     params.jdbc_driver_name == "org.postgresql.Driver" or \
+     params.jdbc_driver_name == "oracle.jdbc.driver.OracleDriver":
     Execute(format("/bin/sh -c 'cd /usr/lib/ambari-agent/ &&\
     curl -kf --retry 5 {jdk_location}{check_db_connection_jar_name}\
      -o {check_db_connection_jar_name}'"),

+ 3 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/OOZIE/package/scripts/oozie_service.py

@@ -29,7 +29,9 @@ def oozie_service(action = 'start'): # 'start' or 'stop'
   if action == 'start':
     start_cmd = format("cd {oozie_tmp_dir} && /usr/lib/oozie/bin/oozie-start.sh")
     
-    if params.jdbc_driver_name == "com.mysql.jdbc.Driver" or params.jdbc_driver_name == "oracle.jdbc.driver.OracleDriver":
+    if params.jdbc_driver_name == "com.mysql.jdbc.Driver" or \
+       params.jdbc_driver_name == "org.postgresql.Driver" or \
+       params.jdbc_driver_name == "oracle.jdbc.driver.OracleDriver":
       db_connection_check_command = format("{java_home}/bin/java -cp {check_db_connection_jar}:{jdbc_driver_jar} org.apache.ambari.server.DBConnectionVerification {oozie_jdbc_connection_url} {oozie_metastore_user_name} {oozie_metastore_user_passwd!p} {jdbc_driver_name}")
     else:
       db_connection_check_command = None

+ 2 - 0
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/OOZIE/package/scripts/params.py

@@ -67,6 +67,8 @@ jdbc_driver_name = default("/configurations/oozie-site/oozie.service.JPAService.
 
 if jdbc_driver_name == "com.mysql.jdbc.Driver":
   jdbc_driver_jar = "/usr/share/java/mysql-connector-java.jar"
+elif jdbc_driver_name == "org.postgresql.Driver":
+  jdbc_driver_jar = "/usr/lib/oozie/libserver/postgresql-9.0-801.jdbc4.jar"
 elif jdbc_driver_name == "oracle.jdbc.driver.OracleDriver":
   jdbc_driver_jar = "/usr/share/java/ojdbc6.jar"
 else:

+ 7 - 0
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive.py

@@ -160,6 +160,13 @@ def jdbc_connector():
             not_if=format("test -f {target}"),
             creates=params.target,
             path=["/bin", "/usr/bin/"])
+  elif params.hive_jdbc_driver == "org.postgresql.Driver":
+    cmd = format("hive mkdir -p {artifact_dir} ; cp /usr/share/java/{jdbc_jar_name} {target}")
+
+    Execute(cmd,
+            not_if=format("test -f {target}"),
+            creates=params.target,
+            path=["/bin", "usr/bin/"])
 
   elif params.hive_jdbc_driver == "oracle.jdbc.driver.OracleDriver":
     cmd = format(

+ 3 - 1
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py

@@ -44,7 +44,9 @@ def hive_service(
             not_if=no_op_test
     )
 
-    if params.hive_jdbc_driver == "com.mysql.jdbc.Driver" or params.hive_jdbc_driver == "oracle.jdbc.driver.OracleDriver":
+    if params.hive_jdbc_driver == "com.mysql.jdbc.Driver" or \
+       params.hive_jdbc_driver == "org.postgresql.Driver" or \
+       params.hive_jdbc_driver == "oracle.jdbc.driver.OracleDriver":
       db_connection_check_command = format(
         "{java64_home}/bin/java -cp {check_db_connection_jar}:/usr/share/java/{jdbc_jar_name} org.apache.ambari.server.DBConnectionVerification {hive_jdbc_connection_url} {hive_metastore_user_name} {hive_metastore_user_passwd!p} {hive_jdbc_driver}")
       Execute(db_connection_check_command,

+ 2 - 0
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py

@@ -38,6 +38,8 @@ hive_lib = '/usr/lib/hive/lib/'
 hive_jdbc_driver = config['configurations']['hive-site']['javax.jdo.option.ConnectionDriverName']
 if hive_jdbc_driver == "com.mysql.jdbc.Driver":
   jdbc_jar_name = "mysql-connector-java.jar"
+elif hive_jdbc_driver == "org.postgresql.Driver":
+  jdbc_jar_name = "postgresql-jdbc.jar"
 elif hive_jdbc_driver == "oracle.jdbc.driver.OracleDriver":
   jdbc_jar_name = "ojdbc6.jar"
 

+ 3 - 1
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/package/scripts/oozie.py

@@ -64,7 +64,9 @@ def oozie(is_server=False # TODO: see if see can remove this
       owner=params.oozie_user
     )
 
-  if params.jdbc_driver_name == "com.mysql.jdbc.Driver" or params.jdbc_driver_name == "oracle.jdbc.driver.OracleDriver":
+  if params.jdbc_driver_name == "com.mysql.jdbc.Driver" or \
+     params.jdbc_driver_name == "org.postgresql.Driver" or \
+     params.jdbc_driver_name == "oracle.jdbc.driver.OracleDriver":
     Execute(format("/bin/sh -c 'cd /usr/lib/ambari-agent/ &&\
     curl -kf --retry 5 {jdk_location}{check_db_connection_jar_name}\
      -o {check_db_connection_jar_name}'"),

+ 3 - 1
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/package/scripts/oozie_service.py

@@ -29,7 +29,9 @@ def oozie_service(action = 'start'): # 'start' or 'stop'
   if action == 'start':
     start_cmd = format("cd {oozie_tmp_dir} && /usr/lib/oozie/bin/oozie-start.sh")
     
-    if params.jdbc_driver_name == "com.mysql.jdbc.Driver" or params.jdbc_driver_name == "oracle.jdbc.driver.OracleDriver":
+    if params.jdbc_driver_name == "com.mysql.jdbc.Driver" or \
+       params.jdbc_driver_name == "org.postgresql.Driver" or \
+       params.jdbc_driver_name == "oracle.jdbc.driver.OracleDriver":
       db_connection_check_command = format("{java_home}/bin/java -cp {check_db_connection_jar}:{jdbc_driver_jar} org.apache.ambari.server.DBConnectionVerification {oozie_jdbc_connection_url} {oozie_metastore_user_name} {oozie_metastore_user_passwd!p} {jdbc_driver_name}")
     else:
       db_connection_check_command = None

+ 2 - 0
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/package/scripts/params.py

@@ -67,6 +67,8 @@ jdbc_driver_name = default("/configurations/oozie-site/oozie.service.JPAService.
 
 if jdbc_driver_name == "com.mysql.jdbc.Driver":
   jdbc_driver_jar = "/usr/share/java/mysql-connector-java.jar"
+elif jdbc_driver_name == "org.postgresql.Driver":
+  jdbc_driver_jar = "/usr/lib/oozie/libserver/postgresql-9.0-801.jdbc4.jar"
 elif jdbc_driver_name == "oracle.jdbc.driver.OracleDriver":
   jdbc_driver_jar = "/usr/share/java/ojdbc6.jar"
 else:

+ 38 - 2
ambari-web/app/controllers/main/service/info/configs.js

@@ -1041,6 +1041,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
         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'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_postgresql_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_postgresql_database'));
       } else if (hiveDb.value === 'Existing MySQL Database') {
         var existingMySqlHost = globals.findProperty('name', 'hive_existing_mysql_host');
         if (existingMySqlHost) {
@@ -1050,7 +1052,21 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
         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 = globals.without(globals.findProperty('name', 'hive_existing_postgresql_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_postgresql_database'));
+      } else if (hiveDb.value === 'Existing Postgresql Database') {
+        var existingPostgreSqlHost = globals.findProperty('name', 'hive_existing_postgresql_host');
+        if (existingPostgreSqlHost) {
+          existingPostgreSqlHost.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'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_oracle_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_oracle_database'));
+      }
+      else { //existing oracle database
         var existingOracleHost = globals.findProperty('name', 'hive_existing_oracle_host');
         if (existingOracleHost) {
           existingOracleHost.name = 'hive_hostname';
@@ -1059,6 +1075,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
         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 = globals.without(globals.findProperty('name', 'hive_existing_postgresql_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_postgresql_database'));
       }
 
     }
@@ -1078,6 +1096,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
         globals = globals.without(globals.findProperty('name', 'oozie_existing_mysql_database'));
         globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_host'));
         globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_database'));
+        globals = globals.without(globals.findProperty('name', 'oozie_existing_postgresql_host'));
+        globals = globals.without(globals.findProperty('name', 'oozie_existing_postgresql_database'));
       } else if (oozieDb.value === 'New MySQL Database') {
         var ambariHost = globals.findProperty('name', 'oozie_ambari_host');
         if (ambariHost) {
@@ -1088,6 +1108,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
         globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_host'));
         globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_database'));
         globals = globals.without(globals.findProperty('name', 'oozie_derby_database'));
+        globals = globals.without(globals.findProperty('name', 'oozie_existing_postgresql_host'));
+        globals = globals.without(globals.findProperty('name', 'oozie_existing_postgresql_database'));
 
       } else if (oozieDb.value === 'Existing MySQL Database') {
         var existingMySqlHost = globals.findProperty('name', 'oozie_existing_mysql_host');
@@ -1099,7 +1121,21 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
         globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_host'));
         globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_database'));
         globals = globals.without(globals.findProperty('name', 'oozie_derby_database'));
-      } else { //existing oracle database
+        globals = globals.without(globals.findProperty('name', 'oozie_existing_postgresql_host'));
+        globals = globals.without(globals.findProperty('name', 'oozie_existing_postgresql_database'));
+      } else if (oozieDb.value === 'Existing Postgresql Database') {
+        var existingPostgreSqlHost = globals.findProperty('name', 'oozie_existing_postgresql_host');
+        if (existingPostgreSqlHost) {
+          existingPostgreSqlHost.name = 'oozie_hostname';
+        }
+        globals = globals.without(globals.findProperty('name', 'oozie_ambari_host'));
+        globals = globals.without(globals.findProperty('name', 'oozie_ambari_database'));
+        globals = globals.without(globals.findProperty('name', 'oozie_existing_mysql_host'));
+        globals = globals.without(globals.findProperty('name', 'oozie_existing_mysql_database'));
+        globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_host'));
+        globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_database'));
+      }
+      else { //existing oracle database
         var existingOracleHost = globals.findProperty('name', 'oozie_existing_oracle_host');
         if (existingOracleHost) {
           existingOracleHost.name = 'oozie_hostname';

+ 42 - 6
ambari-web/app/controllers/wizard/step8_controller.js

@@ -217,6 +217,8 @@ App.WizardStep8Controller = Em.Controller.extend({
         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'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_postgresql_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_postgresql_database'));
       } else if (hiveDb.value === 'Existing MySQL Database'){
         globals.findProperty('name', 'hive_hostname').value = globals.findProperty('name', 'hive_existing_mysql_host').value;
         hiveDbType.value = 'mysql';
@@ -224,13 +226,26 @@ App.WizardStep8Controller = Em.Controller.extend({
         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 = globals.without(globals.findProperty('name', 'hive_existing_postgresql_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_postgresql_database'));
+      }  else if (hiveDb.value === 'Existing Postgresql Database'){
+          globals.findProperty('name', 'hive_hostname').value = globals.findProperty('name', 'hive_existing_postgresql_host').value;
+          hiveDbType.value = 'postgresql';
+          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'));
+          globals = globals.without(globals.findProperty('name', 'hive_existing_mysql_host'));
+          globals = globals.without(globals.findProperty('name', 'hive_existing_mysql_database'));
+        } else { //existing oracle database
         globals.findProperty('name', 'hive_hostname').value = globals.findProperty('name', 'hive_existing_oracle_host').value;
         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 = globals.without(globals.findProperty('name', 'hive_existing_postgresql_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_postgresql_database'));
       }
       globals.push(hiveDbType);
     }
@@ -248,7 +263,9 @@ App.WizardStep8Controller = Em.Controller.extend({
         globals = globals.without(globals.findProperty('name', 'oozie_existing_mysql_database'));
         globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_host'));
         globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_database'));
-      } else if (oozieDb.value === 'Existing MySQL Database') {
+        globals = globals.without(globals.findProperty('name', 'oozie_existing_postgresql_host'));
+        globals = globals.without(globals.findProperty('name', 'oozie_existing_postgresql_database'));
+      }  else if (oozieDb.value === 'Existing MySQL Database') {
         globals.findProperty('name', 'oozie_hostname').value = globals.findProperty('name', 'oozie_existing_mysql_host').value;
         oozieDbType.value = 'mysql';
         globals = globals.without(globals.findProperty('name', 'oozie_ambari_host'));
@@ -256,7 +273,18 @@ App.WizardStep8Controller = Em.Controller.extend({
         globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_host'));
         globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_database'));
         globals = globals.without(globals.findProperty('name', 'oozie_derby_database'));
-      } else { // existing oracle database
+        globals = globals.without(globals.findProperty('name', 'oozie_existing_postgresql_host'));
+        globals = globals.without(globals.findProperty('name', 'oozie_existing_postgresql_database'));
+      } else if (oozieDb.value === 'Existing Postgresql Database'){
+          globals.findProperty('name', 'oozie_hostname').value = globals.findProperty('name', 'oozie_existing_postgresql_host').value;
+          oozieDbType.value = 'postgresql';
+          globals = globals.without(globals.findProperty('name', 'oozie_ambari_host'));
+          globals = globals.without(globals.findProperty('name', 'oozie_ambari_database'));
+          globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_host'));
+          globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_database'));
+          globals = globals.without(globals.findProperty('name', 'oozie_existing_mysql_host'));
+          globals = globals.without(globals.findProperty('name', 'oozie_existing_mysql_database'));
+        } else { // existing oracle database
         globals.findProperty('name', 'oozie_hostname').value = globals.findProperty('name', 'oozie_existing_oracle_host').value;
         oozieDbType.value = 'oracle';
         globals = globals.without(globals.findProperty('name', 'oozie_ambari_host'));
@@ -264,6 +292,8 @@ App.WizardStep8Controller = Em.Controller.extend({
         globals = globals.without(globals.findProperty('name', 'oozie_existing_mysql_host'));
         globals = globals.without(globals.findProperty('name', 'oozie_existing_mysql_database'));
         globals = globals.without(globals.findProperty('name', 'oozie_derby_database'));
+        globals = globals.without(globals.findProperty('name', 'oozie_existing_postgresql_host'));
+        globals = globals.without(globals.findProperty('name', 'oozie_existing_postgresql_database'));
       }
       globals.push(oozieDbType);
     }
@@ -598,7 +628,10 @@ App.WizardStep8Controller = Em.Controller.extend({
     } else if(hiveDb.value === 'Existing MySQL Database'){
       var db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name', 'hive_existing_mysql_database');
       dbComponent.set('component_value', db.value + ' (' + hiveDb.value + ')');
-    } else { // existing oracle database
+    } else if(hiveDb.value === 'Existing Postgresql Database'){
+      var db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name', 'hive_existing_postgresql_database');
+      dbComponent.set('component_value', db.value + ' (' + hiveDb.value + ')');
+     } else { // existing oracle database
       var db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name', 'hive_existing_oracle_database');
       dbComponent.set('component_value', db.value + ' (' + hiveDb.value + ')');
     }
@@ -646,7 +679,10 @@ App.WizardStep8Controller = Em.Controller.extend({
     } */else if(oozieDb.value === 'Existing MySQL Database'){
       var db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name', 'oozie_existing_mysql_database');
       dbComponent.set('component_value', db.value + ' (' + oozieDb.value + ')');
-    } else { // existing oracle database
+    } else if(oozieDb.value === 'Existing Postgresql Database'){
+      var db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name', 'oozie_existing_postgresql_database');
+      dbComponent.set('component_value', db.value + ' (' + oozieDb.value + ')');
+    }  else { // existing oracle database
       var db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name', 'oozie_existing_oracle_database');
       dbComponent.set('component_value', db.value + ' (' + oozieDb.value + ')');
     }
@@ -1491,4 +1527,4 @@ App.WizardStep8Controller = Em.Controller.extend({
     this.get('ajaxQueue').pushObject(params);
   }
 
-});
+});

+ 71 - 0
ambari-web/app/data/HDP2/global_properties.js

@@ -584,6 +584,22 @@ module.exports =
       "category": "Hive Metastore",
       "index": 1
     },
+    // for existing Postgresql
+    {
+      "id": "puppet var",
+      "name": "hive_existing_postgresql_database",
+      "displayName": "Database Type",
+      "value": "",
+      "defaultValue": "Postgresql",
+      "description": "Using an existing Postgresql database for Hive Metastore",
+      "displayType": "masterHost",
+      "isOverridable": false,
+      "isVisible": false,
+      "isReconfigurable": false,
+      "serviceName": "HIVE",
+      "category": "Hive Metastore",
+      "index": 1
+    },
     // for existing Oracle
     {
       "id": "puppet var",
@@ -630,6 +646,10 @@ module.exports =
           displayName: 'Existing MySQL Database',
           foreignKeys: ['hive_existing_mysql_database', 'hive_existing_mysql_host']
         },
+        {
+            displayName: 'Existing Postgresql Database',
+            foreignKeys: ['hive_existing_postgresql_database', 'hive_existing_postgresql_host']
+        },
         {
           displayName: 'Existing Oracle Database',
           foreignKeys: ['hive_existing_oracle_database', 'hive_existing_oracle_host'],
@@ -677,6 +697,22 @@ module.exports =
       "category": "Hive Metastore",
       "index": 3
     },
+    {
+      "id": "puppet var",
+      "name": "hive_existing_postgresql_host",
+      "displayName": "Database Host",
+      "description": "Specify the host on which the existing database is hosted",
+      "defaultValue": "",
+      "isReconfigurable": false,
+      "displayType": "host",
+      "isOverridable": false,
+      "isRequiredByAgent": false,
+      "isVisible": false,
+      "isObserved": true,
+      "serviceName": "HIVE",
+      "category": "Hive Metastore",
+      "index": 3
+    },
     {
       "id": "puppet var",
       "name": "hive_existing_oracle_host",
@@ -860,6 +896,22 @@ module.exports =
       "category": "Oozie Server",
       "index": 1
     },
+    // for existing Postgresql
+    {
+      "id": "puppet var",
+      "name": "oozie_existing_postgresql_database",
+      "displayName": "Database Type",
+      "value": "",
+      "defaultValue": "Postgresql",
+      "description": "Using an existing Postgresql database for Oozie Metastore",
+      "displayType": "masterHost",
+      "isOverridable": false,
+      "isVisible": false,
+      "isReconfigurable": false,
+      "serviceName": "OOZIE",
+      "category": "Oozie Server",
+      "index": 1
+    },
     // for new MySQL
     {
       "id": "puppet var",
@@ -927,6 +979,11 @@ module.exports =
           displayName: 'Existing MySQL Database',
           foreignKeys: ['oozie_existing_mysql_database', 'oozie_existing_mysql_host'],
           hidden: !App.supports.hiveOozieExtraDatabases
+        },
+                {
+          displayName: 'Existing Postgresql Database',
+          foreignKeys: ['oozie_existing_postgresql_database', 'oozie_existing_postgresql_host'],
+          hidden: !App.supports.hiveOozieExtraDatabases
         },
         {
           displayName: 'Existing Oracle Database',
@@ -987,6 +1044,20 @@ module.exports =
       "isObserved": true,
       "serviceName": "OOZIE",
       "category": "Oozie Server"
+    },
+        {
+      "id": "puppet var",
+      "name": "oozie_existing_postgresql_host",
+      "displayName": "Database Host",
+      "description": "Specify the host on which the existing database is hosted",
+      "defaultValue": "",
+      "isReconfigurable": false,
+      "isOverridable": false,
+      "displayType": "host",
+      "isVisible": false,
+      "isObserved": true,
+      "serviceName": "OOZIE",
+      "category": "Oozie Server"
     },
     {
       "id": "puppet var",

+ 72 - 0
ambari-web/app/data/global_properties.js

@@ -554,6 +554,22 @@ module.exports =
       "category": "Hive Metastore",
       "index": 1
     },
+    // for existing Postgresql
+    {
+      "id": "puppet var",
+      "name": "hive_existing_postgresql_database",
+      "displayName": "Database Type",
+      "value": "",
+      "defaultValue": "Postgresql",
+      "description": "Using an existing Postgresql database for Hive Metastore",
+      "displayType": "masterHost",
+      "isOverridable": false,
+      "isVisible": false,
+      "isReconfigurable": false,
+      "serviceName": "HIVE",
+      "category": "Hive Metastore",
+      "index": 1
+    },
     // for existing Oracle
     {
       "id": "puppet var",
@@ -600,6 +616,10 @@ module.exports =
           displayName: 'Existing MySQL Database',
           foreignKeys: ['hive_existing_mysql_database', 'hive_existing_mysql_host']
         },
+        {
+          displayName: 'Existing Postgresql Database',
+          foreignKeys: ['hive_existing_postgresql_database', 'hive_existing_postgresql_host'],
+          },
         {
           displayName: 'Existing Oracle Database',
           foreignKeys: ['hive_existing_oracle_database', 'hive_existing_oracle_host'],
@@ -663,6 +683,22 @@ module.exports =
       "category": "Hive Metastore",
       "index": 3
     },
+    {
+        "id": "puppet var",
+        "name": "hive_existing_postgresql_host",
+        "displayName": "Database Host",
+        "description": "Specify the host on which the existing database is hosted",
+        "defaultValue": "",
+        "isReconfigurable": false,
+        "displayType": "host",
+        "isOverridable": false,
+        "isRequiredByAgent": false,
+        "isVisible": false,
+        "isObserved": true,
+        "serviceName": "HIVE",
+        "category": "Hive Metastore",
+        "index": 3
+      },
     {
       "id": "puppet var",
       "name": "hive_ambari_host",
@@ -799,6 +835,22 @@ module.exports =
       "category": "Oozie Server",
       "index": 0
     },
+    // for existing Postgresql
+    {
+      "id": "puppet var",
+      "name": "oozie_existing_postgresql_database",
+      "displayName": "Database Type",
+      "value": "",
+      "defaultValue": "Postgresql",
+      "description": "Using an existing Postgresql database for Oozie Metastore",
+      "displayType": "masterHost",
+      "isOverridable": false,
+      "isVisible": false,
+      "isReconfigurable": false,
+      "serviceName": "OOZIE",
+      "category": "Oozie Server",
+      "index": 1
+    },
     // for existing Oracle
     {
       "id": "puppet var",
@@ -864,6 +916,10 @@ module.exports =
           foreignKeys: ['oozie_existing_mysql_database', 'oozie_existing_mysql_host'],
           hidden: !App.supports.hiveOozieExtraDatabases
         },
+                {
+          displayName: 'Existing Postgresql Database',
+          foreignKeys: ['oozie_existing_postgresql_database', 'oozie_existing_postgresql_host'],
+          },
         {
           displayName: 'Existing Oracle Database',
           foreignKeys: ['oozie_existing_oracle_database', 'oozie_existing_oracle_host'],
@@ -910,6 +966,22 @@ module.exports =
       "category": "Oozie Server",
       "index": 3
     },
+    {
+      "id": "puppet var",
+      "name": "oozie_existing_postgres_host",
+      "displayName": "Database Host",
+      "description": "Specify the host on which the existing database is hosted",
+      "defaultValue": "",
+      "isReconfigurable": false,
+      "isOverridable": false,
+      "displayType": "host",
+      "isRequiredByAgent": false,
+      "isVisible": false,
+      "isObserved": true,
+      "serviceName": "OOZIE",
+      "category": "Oozie Server",
+      "index": 3
+    },
     {
       "id": "puppet var",
       "name": "oozie_existing_oracle_host",

+ 14 - 0
ambari-web/app/views/wizard/controls_view.js

@@ -222,6 +222,10 @@ App.ServiceConfigRadioButtons = Ember.View.extend({
               connectionUrl.set('value', "jdbc:mysql://" + this.get('hostName') + "/" + this.get('databaseName') + "?createDatabaseIfNotExist=true");
               dbClass.set('value', "com.mysql.jdbc.Driver");
               break;
+            case 'Existing Postgresql Database':
+              connectionUrl.set('value', "jdbc:postgresql://" + this.get('hostName') + ":5432/" + this.get('databaseName'));
+              dbClass.set('value', "org.postgresql.Driver");
+              break;
             case 'Existing Oracle Database':
               connectionUrl.set('value', "jdbc:oracle:thin:@//" + this.get('hostName') + ":1521/" + this.get('databaseName'));
               dbClass.set('value', "oracle.jdbc.driver.OracleDriver");
@@ -237,6 +241,10 @@ App.ServiceConfigRadioButtons = Ember.View.extend({
               connectionUrl.set('value', "jdbc:mysql://" + this.get('hostName') + "/" + this.get('databaseName'));
               dbClass.set('value', "com.mysql.jdbc.Driver");
               break;
+            case 'Existing Postgresql Database':
+              connectionUrl.set('value', "jdbc:postgresql://" + this.get('hostName') + ":5432/" + this.get('databaseName'));
+              dbClass.set('value', "org.postgresql.Driver");
+              break;
             case 'Existing Oracle Database':
               connectionUrl.set('value', "jdbc:oracle:thin:@//" + this.get('hostName') + ":1521/" + this.get('databaseName'));
               dbClass.set('value', "oracle.jdbc.driver.OracleDriver");
@@ -274,6 +282,9 @@ App.ServiceConfigRadioButtons = Ember.View.extend({
         case 'Existing MySQL Database':
           hostname = this.get('categoryConfigsAll').findProperty('name', 'hive_existing_mysql_host');
           break;
+        case 'Existing Postgresql Database':
+          hostname = this.get('categoryConfigsAll').findProperty('name', 'hive_existing_postgresql_host');
+          break;
         case 'Existing Oracle Database':
           hostname = this.get('categoryConfigsAll').findProperty('name', 'hive_existing_oracle_host');
           break;
@@ -292,6 +303,9 @@ App.ServiceConfigRadioButtons = Ember.View.extend({
         case 'Existing MySQL Database':
           hostname = this.get('categoryConfigsAll').findProperty('name', 'oozie_existing_mysql_host');
           break;
+        case 'Existing Postgresql Database':
+          hostname = this.get('categoryConfigsAll').findProperty('name', 'oozie_existing_postgresql_host');
+          break;
         case 'Existing Oracle Database':
           hostname = this.get('categoryConfigsAll').findProperty('name', 'oozie_existing_oracle_host');
           break;