You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vi...@apache.org on 2012/06/07 00:11:15 UTC

svn commit: r1347168 - in /incubator/ambari/branches/ambari-186: CHANGES.txt hmc/php/util/selectNodes.php

Author: vikram
Date: Wed Jun  6 22:11:14 2012
New Revision: 1347168

URL: http://svn.apache.org/viewvc?rev=1347168&view=rev
Log:
AMBARI-393. ZooKeeper myid files not existent on ZK install. (Contributed by Mahadev)

Modified:
    incubator/ambari/branches/ambari-186/CHANGES.txt
    incubator/ambari/branches/ambari-186/hmc/php/util/selectNodes.php

Modified: incubator/ambari/branches/ambari-186/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/CHANGES.txt?rev=1347168&r1=1347167&r2=1347168&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/CHANGES.txt (original)
+++ incubator/ambari/branches/ambari-186/CHANGES.txt Wed Jun  6 22:11:14 2012
@@ -6,6 +6,8 @@ characters wide.
 
 Release 0.1.x - unreleased
 
+  AMBARI-393. ZooKeeper myid files not existent on ZK install. (Mahadev via Vikram)
+
   AMBARI-392. Add ID attributes to HTML tags to help test automation (Yusaku via Vikram)
 
   AMBARI-358. Make index.php always accessible, rather than automatically forwarding to the action, even if there's only one action that the user can take (Yusaku via Vikram)

Modified: incubator/ambari/branches/ambari-186/hmc/php/util/selectNodes.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/util/selectNodes.php?rev=1347168&r1=1347167&r2=1347168&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/util/selectNodes.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/util/selectNodes.php Wed Jun  6 22:11:14 2012
@@ -125,7 +125,7 @@ class SelectNodes {
     if (array_key_exists("ZOOKEEPER", $serviceInfo)) { 
       if (array_key_exists("ZOOKEEPER_SERVER", $result["mastersToHosts"])) {
         array_push($result["mastersToHosts"]["ZOOKEEPER_SERVER"]["hostNames"],
-          $hostInfo["hostName"]);
+            $hostInfo["hostName"]);
       } else {
         $result["mastersToHosts"]["ZOOKEEPER_SERVER"] = $this->createHostMap($hostInfo);
       }
@@ -272,8 +272,20 @@ class SelectNodes {
       if ($componentName == "GANGLIA_MONITOR_SERVER") {
         $gangliaMaster = $hostName;
       }
+      if ($componentName == "ZOOKEEPER_SERVER") { 
+        $sizeHosts = sizeof($hostNames);
+        if ($sizeHosts == 1) {
+          $hostConfig = array ( "ZOOKEEPER_SERVER" => array( $hostNames[0] => array ( "myid" => 1 )));
+          $db->updateHostRoleConfigs($clusterName, $hostConfig);
+        } else {
+          $hostConfig = array( "ZOOKEEPER_SERVER" => array() );
+          for ($i=0; $i < 3; $i++) {
+            $hostConfig["ZOOKEEPER_SERVER"][$hostNames[$i]] = array ( "myid" => $i+1 );
+          }
+          $db->updateHostRoleConfigs($clusterName, $hostConfig);
+        }
+      }
     }
-
     /** make sure ganglia is added to all the masters **/
     $this->logger->log_debug("Host for Gangalia Master $gangliaMaster");
     foreach($masterToHost as $componentName=>$hostName) {