incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swa...@apache.org
Subject svn commit: r1491305 - in /incubator/ambari/trunk: ./ ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/ ambari-agent/src/main/puppet/modules/hdp/manifests/ ambari-server/src/main/java/org/apache/ambari/server/configuration/ ambari-server/src/m...
Date Sun, 09 Jun 2013 22:07:11 GMT
Author: swagle
Date: Sun Jun  9 22:07:10 2013
New Revision: 1491305

URL: http://svn.apache.org/r1491305
Log:
AMBARI-2336. Datanode start failed (with Oracle DB) due to RCA setup. (swagle)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/init.pp
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1491305&r1=1491304&r2=1491305&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Sun Jun  9 22:07:10 2013
@@ -910,6 +910,9 @@ Trunk (unreleased changes):
 
  BUG FIXES
  
+ AMBARI-2336. Datanode start failed (with Oracle DB) due to RCA setup. 
+ (swagle)
+
  AMBARI-2266. Clients are not reconfigured on starting a service after each 
  of the service components are stopped individually. (swagle)
 

Modified: incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/init.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/init.pp?rev=1491305&r1=1491304&r2=1491305&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/init.pp
(original)
+++ incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/init.pp
Sun Jun  9 22:07:10 2013
@@ -38,10 +38,8 @@ class hdp-hadoop::initialize()
   hdp-hadoop::common { 'common':}
   anchor{'hdp-hadoop::initialize::begin':} -> Hdp-hadoop::Common['common'] -> anchor{'hdp-hadoop::initialize::end':}
 
-# Configs generation  
-
-debug('##Configs generation for hdp-hadoop')
-
+  # Configs generation
+  debug('##Configs generation for hdp-hadoop')
 
   if has_key($configuration, 'mapred-queue-acls') {
     configgenerator::configfile{'mapred-queue-acls': 
@@ -276,6 +274,29 @@ class hdp-hadoop(
       owner => $hdfs_user,
     }
 
+    # Copy database drivers for rca enablement
+    $server_db_name = $hdp::params::server_db_name
+    $hadoop_lib_home = $hdp::params::hadoop_lib_home
+    $db_driver_filename = $hdp::params::db_driver_file
+    $oracle_driver_url = $hdp::params::oracle_jdbc_url
+    $mysql_driver_url = $hdp::params::mysql_jdbc_url
+
+    if ($server_db_name == 'oracle' and $oracle_driver_url != "") {
+      $db_driver_dload_cmd = "curl -f --retry 5 $oracle_driver_url -o ${hadoop_lib_home}/${db_driver_filename}"
+    } elsif ($server_db_name == 'mysql' and $mysql_driver_url != "") {
+      $db_driver_dload_cmd = "curl -f --retry 5 $mysql_driver_url -o ${hadoop_lib_home}/${db_driver_filename}"
+    }
+    if ($db_driver_dload_cmd != undef) {
+      exec { '${db_driver_dload_cmd}':
+        command => $db_driver_dload_cmd,
+        unless  => "test -e ${hadoop_lib_home}/${db_driver_filename}",
+        creates => "${hadoop_lib_home}/${db_driver_filename}",
+        path    => ["/bin","/usr/bin/"],
+        require => Hdp-hadoop::Package['hadoop'],
+        before  => Anchor['hdp-hadoop::end']
+      }
+    }
+
     Anchor['hdp-hadoop::begin'] -> Hdp-hadoop::Package<||> ->  Hdp::User<|title
== $hdfs_user or title == $mapred_user|>  ->
       Hdp::Directory_recursive_create[$hadoop_config_dir] -> Hdp-hadoop::Configfile<|tag
== 'common'|> ->
       Hdp::Directory_recursive_create[$logdirprefix] -> Hdp::Directory_recursive_create[$piddirprefix]
-> Anchor['hdp-hadoop::end']

Modified: incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp?rev=1491305&r1=1491304&r2=1491305&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp Sun
Jun  9 22:07:10 2013
@@ -238,6 +238,10 @@ class hdp::params()
 
   $jce_policy_zip = "jce_policy-6.zip"
   $jce_location = hdp_default("jce_location","http://download.oracle.com/otn-pub/java/jce_policy/6")
+  $server_db_name = hdp_default("db_name", "postgres")
+  $oracle_jdbc_url = hdp_default("oracle_jdbc_url", "")
+  $mysql_jdbc_url = hdp_default("mysql_jdbc_url", "")
+  $db_driver_file = hdp_default("db_driver_filename", "")
 
   #####
   $hadoop_home = hdp_default("hadoop_home","/usr")

Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java?rev=1491305&r1=1491304&r2=1491305&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
Sun Jun  9 22:07:10 2013
@@ -76,6 +76,15 @@ public class Configuration {
 
   public static final String CLIENT_SECURITY_KEY = "client.security";
   public static final String CLIENT_API_PORT_KEY = "client.api.port";
+  public static final String SERVER_DB_NAME_KEY = "server.jdbc.database";
+  public static final String SERVER_DB_NAME_DEFAULT = "postgres";
+  public static final String ORACLE_DB_NAME = "oracle";
+  public static final String MYSQL_DB_NAME = "mysql";
+
+  public static final String OJDBC_JAR_NAME_KEY = "db.oracle.jdbc.name";
+  public static final String OJDBC_JAR_NAME_DEFAULT = "ojdbc6.jar";
+  public static final String MYSQL_JAR_NAME_KEY = "db.mysql.jdbc.name";
+  public static final String MYSQL_JAR_NAME_DEFAULT = "mysql-connector-java.jar";
   public static final String LDAP_USE_SSL_KEY = "authentication.ldap.useSSL";
   public static final String LDAP_PRIMARY_URL_KEY =
       "authentication.ldap.primaryUrl";
@@ -539,6 +548,18 @@ public class Configuration {
     return Integer.parseInt(properties.getProperty(CLIENT_API_PORT_KEY, String.valueOf(CLIENT_API_PORT_DEFAULT)));
   }
 
+  public String getOjdbcJarName() {
+	  return properties.getProperty(OJDBC_JAR_NAME_KEY, OJDBC_JAR_NAME_DEFAULT);
+  }
+  
+  public String getServerDBName() {
+	  return properties.getProperty(SERVER_DB_NAME_KEY, SERVER_DB_NAME_DEFAULT);
+  }
+  
+  public String getMySQLJarName() {
+	  return properties.getProperty(MYSQL_JAR_NAME_KEY, MYSQL_JAR_NAME_DEFAULT);
+  }
+  
   public JPATableGenerationStrategy getJPATableGenerationStrategy() {
     return JPATableGenerationStrategy.fromString(System.getProperty(SERVER_JDBC_GENERATE_TABLES_KEY));
   }

Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java?rev=1491305&r1=1491304&r2=1491305&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
Sun Jun  9 22:07:10 2013
@@ -156,7 +156,10 @@ public class AmbariManagementControllerI
       "/resources/";
 
   final private String jdkResourceUrl;
-
+  final private String ojdbcUrl;
+  final private String serverDB;
+  final private String mysqljdbcUrl;
+  
   @Inject
   public AmbariManagementControllerImpl(ActionManager actionManager,
       Clusters clusters, Injector injector) throws Exception {
@@ -175,6 +178,13 @@ public class AmbariManagementControllerI
     } else {
     		this.jdkResourceUrl = null;
     }
+    
+    this.ojdbcUrl = "http://" + masterHostname + ":" + 
+    	 + configs.getClientApiPort() + JDK_RESOURCE_LOCATION + "/" + configs.getOjdbcJarName();
+    
+    this.mysqljdbcUrl = "http://" + masterHostname + ":" + 
+       	 + configs.getClientApiPort() + JDK_RESOURCE_LOCATION + "/" + configs.getMySQLJarName();
+    this.serverDB = configs.getServerDBName();
   }
 
   @Override
@@ -970,6 +980,16 @@ public class AmbariManagementControllerI
     params.put("repo_info", repoInfo);
     params.put("jdk_location", this.jdkResourceUrl);
     params.put("stack_version", stackId.getStackVersion());
+    params.put("db_name", this.serverDB);
+    params.put("mysql_jdbc_url" , this.mysqljdbcUrl);
+    params.put("oracle_jdbc_url", this.ojdbcUrl);
+    if (configs.getServerDBName().equalsIgnoreCase(Configuration
+      .ORACLE_DB_NAME)) {
+      params.put("db_driver_filename", configs.getOjdbcJarName());
+    } else if (configs.getServerDBName().equalsIgnoreCase(Configuration
+      .MYSQL_DB_NAME)) {
+      params.put("db_driver_filename", configs.getMySQLJarName());
+    }
     execCmd.setHostLevelParams(params);
 
     Map<String, String> roleParams = new TreeMap<String, String>();



Mime
View raw message