You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2013/03/29 19:59:13 UTC

svn commit: r1462607 - in /incubator/ambari/trunk: ./ ambari-agent/src/main/puppet/modules/hdp-hive/manifests/ ambari-agent/src/main/puppet/modules/hdp-oozie/manifests/

Author: swagle
Date: Fri Mar 29 18:59:12 2013
New Revision: 1462607

URL: http://svn.apache.org/r1462607
Log:
AMBARI-1752. Backend support for MySQL and Oracle for Oozie and Hive. (swagle)

Added:
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/jdbc-connector.pp
Removed:
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/mysql-connector.pp
Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/init.pp
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/params.pp
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-oozie/manifests/service.pp

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1462607&r1=1462606&r2=1462607&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Fri Mar 29 18:59:12 2013
@@ -12,6 +12,8 @@ Trunk (unreleased changes):
 
  NEW FEATURES
 
+ AMBARI-1752. Backend support for MySQL and Oracle for Oozie and Hive. (swagle)
+
  AMBARI-1751. Ambari oracle-linux as a supported OS type. (swagle)
 
  AMBARI-1728. Cleanup INFO Logging at the ambari agent to make it more useful 

Modified: incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/init.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/init.pp?rev=1462607&r1=1462606&r2=1462607&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/init.pp (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/init.pp Fri Mar 29 18:59:12 2013
@@ -66,7 +66,7 @@ class hdp-hive(
   } else {
     hdp::package { 'hive' : }
     if ($server == true ) {
-      class { 'hdp-hive::mysql-connector': }
+      class { 'hdp-hive::jdbc-connector': }
     }
   
     hdp::user{ $hive_user:}
@@ -87,7 +87,7 @@ class hdp-hive(
      Hdp::Directory[$hive_config_dir] -> Hdp-hive::Configfile<||> -> Hdp-hive::Ownership['ownership'] -> Anchor['hdp-hive::end']
 
      if ($server == true ) {
-       Hdp::Package['hive'] -> Hdp::User[$hive_user] -> Class['hdp-hive::mysql-connector'] -> Anchor['hdp-hive::end']
+       Hdp::Package['hive'] -> Hdp::User[$hive_user] -> Class['hdp-hive::jdbc-connector'] -> Anchor['hdp-hive::end']
     }
   }
 }

Added: incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/jdbc-connector.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/jdbc-connector.pp?rev=1462607&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/jdbc-connector.pp (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/jdbc-connector.pp Fri Mar 29 18:59:12 2013
@@ -0,0 +1,58 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+class hdp-hive::jdbc-connector()
+{
+  include hdp-hive::params
+
+  $jdbc_jar_name = $hdp-hive::params::jdbc_jar_name
+  
+  $hive_lib = $hdp-hive::params::hive_lib
+  $target = "${hive_lib}/${jdbc_jar_name}"
+  
+  anchor { 'hdp-hive::jdbc-connector::begin':}
+
+   hdp::package { 'mysql-connector-java' :
+     require   => Anchor['hdp-hive::jdbc-connector::begin']
+   }
+
+
+  if ($hive_ambari_database == "MySQL"){
+   hdp::exec { 'hive mkdir -p ${artifact_dir} ;  cp /usr/share/java/${jdbc_jar_name}  ${target}':
+       command => "mkdir -p ${artifact_dir} ;  cp /usr/share/java/${jdbc_jar_name}  ${target}",
+       unless  => "test -f ${target}",
+       creates => $target,
+       path    => ["/bin","/usr/bin/"],
+       require => Hdp::Package['mysql-connector-java'],
+       notify  =>  Anchor['hdp-hive::jdbc-connector::end'],
+   }
+  } elsif ($hive_ambari_database == "Oracle") {
+   hdp::exec { 'hive mkdir -p ${artifact_dir} ;  cp /usr/share/java/${jdbc_jar_name}  ${target}':
+       command => "mkdir -p ${artifact_dir} ;  cp /usr/share/java/${jdbc_jar_name}  ${target}",
+       unless  => "test -f ${target}",
+       path    => ["/bin","/usr/bin/"],
+       notify  =>  Anchor['hdp-hive::jdbc-connector::end'],
+     }  
+  }
+
+
+   anchor { 'hdp-hive::jdbc-connector::end':}
+
+}

Modified: incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/params.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/params.pp?rev=1462607&r1=1462606&r2=1462607&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/params.pp (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/params.pp Fri Mar 29 18:59:12 2013
@@ -26,8 +26,15 @@ class hdp-hive::params() inherits hdp::p
   $hive_metastore_user_passwd = hdp_default("hadoop/hive-site/hive_metastore_user_passwd","dbpassword")
 
   ### users
-  $hive_user = $hdp::params::hive_user 
-
+  $hive_user = $hdp::params::hive_user
+  
+  ### JDBC driver jar name
+  if ($hive_ambari_database == "MySQL"){
+    $jdbc_jar_name = "mysql-connector-java.jar"
+  } elsif ($hive_ambari_database == "Oracle") {
+    $jdbc_jar_name = "ojdbc6.jar"  
+  }
+  
   ### common
   $hive_metastore_port = hdp_default("hive_metastore_port",9083)
   $hive_lib = hdp_default("hive_lib","/usr/lib/hive/lib/") #TODO: should I remove and just use hive_dbroot

Modified: incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-oozie/manifests/service.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-oozie/manifests/service.pp?rev=1462607&r1=1462606&r2=1462607&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-oozie/manifests/service.pp (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-oozie/manifests/service.pp Fri Mar 29 18:59:12 2013
@@ -38,6 +38,15 @@ class hdp-oozie::service(
   $security = $hdp::params::security_enabled
   $oozie_keytab = $hdp-oozie::params::oozie_service_keytab
   $oozie_principal = $hdp-oozie::oozie_principal
+  
+  $jdbc_driver_name = $configuration['oozie-site']['oozie.service.JPAService.jdbc.driver']
+  if ($jdbc_driver_name == "com.mysql.jdbc.Driver"){
+    $jdbc_driver_jar = "/usr/share/java/mysql-connector-java.jar"
+  } elsif($jdbc_driver_name == "oracle.jdbc.driver.OracleDriver") {
+      $jdbc_driver_jar = "/usr/share/java/ojdbc6.jar"
+  }
+  
+  
 
   if ($security == true) {
     $kinit_if_needed = "${hdp::params::kinit_path_local} -kt ${oozie_keytab} ${oozie_principal}"
@@ -51,10 +60,16 @@ class hdp-oozie::service(
     $lzo_jar_suffix = ""
   }
 
+     
+        
   $cmd1 = "cd /usr/lib/oozie && tar -xvf oozie-sharelib.tar.gz"
   $cmd2 =  "cd /usr/lib/oozie && mkdir -p ${oozie_tmp}"
-  $cmd3 =  "cd /usr/lib/oozie && chown ${user}:${hdp::params::user_group} ${oozie_tmp}"    
-  $cmd4 =  "cd ${oozie_tmp} && /usr/lib/oozie/bin/oozie-setup.sh -hadoop 0.20.200 $jar_location -extjs $ext_js_path $lzo_jar_suffix"
+  $cmd3 =  "cd /usr/lib/oozie && chown ${user}:${hdp::params::user_group} ${oozie_tmp}" 
+     
+  $cmd4 = $jdbc_driver_name ? {
+        /(com.mysql.jdbc.Driver|oracle.jdbc.driver.OracleDriver)/ => "cd ${oozie_tmp} && /usr/lib/oozie/bin/oozie-setup.sh -hadoop 0.20.200 $jar_location -jars $jdbc_driver_jar -extjs $ext_js_path $lzo_jar_suffix",
+        default            => "cd ${oozie_tmp} && /usr/lib/oozie/bin/oozie-setup.sh -hadoop 0.20.200 $jar_location -extjs $ext_js_path $lzo_jar_suffix",
+  }
   $cmd5 =  "cd ${oozie_tmp} && /usr/lib/oozie/bin/ooziedb.sh create -sqlfile oozie.sql -run ; echo 0"
   $cmd6 =  "su - ${user} -c '${kinit_if_needed}; hadoop dfs -put /usr/lib/oozie/share ${oozie_hdfs_user_dir} ; hadoop dfs -chmod -R 755 ${oozie_hdfs_user_dir}/share'"
   #$cmd7 = "/usr/lib/oozie/bin/oozie-start.sh"