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:02:39 UTC
svn commit: r1347164 - in /incubator/ambari/branches/ambari-186: CHANGES.txt
hmc/js/assignMasters.js hmc/php/frontend/assignMasters.php
hmc/php/frontend/selectServices.php hmc/php/util/selectNodes.php
Author: vikram
Date: Wed Jun 6 22:02:38 2012
New Revision: 1347164
URL: http://svn.apache.org/viewvc?rev=1347164&view=rev
Log:
AMBARI-390. Handle multiple ZooKeeper service masters in Assign Masters page (Contributed by Yusaku)
Modified:
incubator/ambari/branches/ambari-186/CHANGES.txt
incubator/ambari/branches/ambari-186/hmc/js/assignMasters.js
incubator/ambari/branches/ambari-186/hmc/php/frontend/assignMasters.php
incubator/ambari/branches/ambari-186/hmc/php/frontend/selectServices.php
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=1347164&r1=1347163&r2=1347164&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/CHANGES.txt (original)
+++ incubator/ambari/branches/ambari-186/CHANGES.txt Wed Jun 6 22:02:38 2012
@@ -6,6 +6,8 @@ characters wide.
Release 0.1.x - unreleased
+ AMBARI-390. Handle multiple ZooKeeper service masters in Assign Masters page (Yusaku via Vikram)
+
AMBARI-389. Do not allow invalid chars for database name and user name for hive (Hitesh via Vikram)
AMBARI-388. Prevent the user from assigning NameNode and Secondary NameNode services on the same host (Yusaku via Vikram)
Modified: incubator/ambari/branches/ambari-186/hmc/js/assignMasters.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/js/assignMasters.js?rev=1347164&r1=1347163&r2=1347164&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/js/assignMasters.js (original)
+++ incubator/ambari/branches/ambari-186/hmc/js/assignMasters.js Wed Jun 6 22:02:38 2012
@@ -39,7 +39,8 @@ function renderHostsToMasterServices(all
function addMasterServiceToHost(masterName, hostName, hostsToMasterServices, masterServices) {
// enforce constraints on what services can be co-hosted (unless those suggestions were made by the server initially)
// we currently disallow:
- // 1. namenode and secondary namenode to be on the same server
+ // 1. namenode and secondary namenode to be on the same host
+ // 2. more than one zookeeper server to be on the same host
if (hostsToMasterServices[hostName] != null) {
for (var service in hostsToMasterServices[hostName]) {
@@ -47,6 +48,10 @@ function addMasterServiceToHost(masterNa
alert('NameNode and Secondary NameNode cannot be hosted on the same host.');
return false;
}
+ if (masterName.indexOf('ZOOKEEPER') == 0 && service.indexOf('ZOOKEEPER') == 0) {
+ alert('You cannot put more than one ZooKeeper Server on the same host.');
+ return false;
+ }
}
}
if (hostsToMasterServices[hostName] == null) {
@@ -94,9 +99,20 @@ function renderAssignHosts(clusterInfo)
globalYui.one('#selectServiceMastersSubmitButtonId').on('click', function (e) {
e.target.set('disabled', true);
- var assignHostsRequestData = {};
+ var assignHostsRequestData = {};
for (var masterName in masterServices) {
- assignHostsRequestData[masterName] = $('select[name=' + masterName + ']').val();
+ var hostName = $('select[name=' + masterName + ']').val();
+ if (masterName.indexOf("ZOOKEEPER_SERVER") == 0) {
+ if (assignHostsRequestData['ZOOKEEPER_SERVER'] == null) {
+ assignHostsRequestData['ZOOKEEPER_SERVER'] = [];
+ }
+ assignHostsRequestData['ZOOKEEPER_SERVER'].push(hostName);
+ } else {
+ if (assignHostsRequestData[masterName] == null) {
+ assignHostsRequestData[masterName] = [];
+ }
+ assignHostsRequestData[masterName].push(hostName);
+ }
// globalYui.log("Assignment for " + masterName + " is " + assignHostsRequestData[masterName]);
};
@@ -158,15 +174,24 @@ function renderAssignHosts(clusterInfo)
globalYui.Array.each(servicesInfo, function(serviceInfo) {
if( serviceInfo.enabled == true ) {
+ var zkIndex = 1;
globalYui.Array.each(serviceInfo.masters, function(masterInfo) {
- var masterHostInfo = {
- 'name' : masterInfo.name,
- 'displayName' : masterInfo.displayName,
- 'host' : masterInfo.hostName
- };
-
- masterServices[masterInfo.name] = masterHostInfo;
+
+ for (var i in masterInfo.hostNames) {
+ var masterHostInfo = {
+ 'name' : masterInfo.name,
+ 'displayName' : masterInfo.displayName,
+ 'host' : masterInfo.hostNames[i]
+ };
+ // there could be multiple zookeepers
+ if (masterInfo.name == 'ZOOKEEPER_SERVER') {
+ masterHostInfo.name = 'ZOOKEEPER_SERVER_' + zkIndex;
+ masterHostInfo.displayName = masterHostInfo.displayName + ' ' + zkIndex;
+ zkIndex++;
+ }
+ masterServices[masterHostInfo.name] = masterHostInfo;
+ }
});
}
});
@@ -188,7 +213,12 @@ function renderAssignHosts(clusterInfo)
renderHostsToMasterServices(allHosts, hostsToMasterServices);
- $('select').change(function() {
+ // prevValue is used to undo user selection in case we prevent the user from assigning a service
+ var prevValue = '';
+
+ $('select').click(function() {
+ prevValue = $(this).val();
+ }).change(function(event) {
var masterName = $(this).attr('name');
// masterServices[masterName] = $(this).val();
var prevChosenHost = $('#' + masterName + 'ChosenHost').val();
@@ -196,7 +226,9 @@ function renderAssignHosts(clusterInfo)
if (addMasterServiceToHost(masterName, newChosenHost, hostsToMasterServices, masterServices)) {
removeMasterServiceFromHost(masterName, prevChosenHost, hostsToMasterServices);
renderHostsToMasterServices(allHosts, hostsToMasterServices);
- $('#' + masterName + 'ChosenHost').val(newChosenHost);
+ $('#' + masterName + 'ChosenHost').val(newChosenHost);
+ } else {
+ $(this).val(prevValue);
}
});
Modified: incubator/ambari/branches/ambari-186/hmc/php/frontend/assignMasters.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/frontend/assignMasters.php?rev=1347164&r1=1347163&r2=1347164&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/frontend/assignMasters.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/frontend/assignMasters.php Wed Jun 6 22:02:38 2012
@@ -40,7 +40,7 @@ if ($allServicesComponents["result"] !=
return;
}
-$suggestedNodes = $selectNodes->updateDBWithRoles($clusterName,
+$suggestedNodes = $selectNodes->updateDBWithRoles($clusterName,
$dbAccessor,
$componentsToHosts
);
@@ -85,7 +85,7 @@ $dbAccessor->addHostsToComponent($cluste
// choose the name node as the canary host.
$nameNodeHost = $componentsToHosts["NAMENODE"];
$AllMountPoints = array();
-$nameNodeInfoResult = $dbAccessor->getHostInfo($clusterName, $nameNodeHost);
+$nameNodeInfoResult = $dbAccessor->getHostInfo($clusterName, $nameNodeHost[0]);
if ($nameNodeInfoResult["result"] != 0 ) {
$logger->log_error("Got error while getting canary host info ".$nameNodeInfoResult["error"]);
print json_encode($nameNodeInfoResult);
Modified: incubator/ambari/branches/ambari-186/hmc/php/frontend/selectServices.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/frontend/selectServices.php?rev=1347164&r1=1347163&r2=1347164&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/frontend/selectServices.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/frontend/selectServices.php Wed Jun 6 22:02:38 2012
@@ -147,14 +147,12 @@ foreach($allServicesArray["services"] as
}
$thisMaster = array();
$hosts = $suggestedNodes["mastersToHosts"][$componentName]["hostNames"];
- foreach ($hosts as $host) {
- $thisMaster["name"] = $component["componentName"];
- $thisMaster["displayName"] = $component["displayName"];
- $thisMaster["description"] = $component["description"];
- $thisMaster["hostName"] =
- $host;
- array_push($thisService["masters"], $thisMaster);
- }
+ $thisMaster["name"] = $component["componentName"];
+ $thisMaster["displayName"] = $component["displayName"];
+ $thisMaster["description"] = $component["description"];
+ $thisMaster["hostNames"] =
+ $hosts;
+ array_push($thisService["masters"], $thisMaster);
}
array_push($jsonOutput["services"], $thisService);
}
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=1347164&r1=1347163&r2=1347164&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:02:38 2012
@@ -266,9 +266,9 @@ class SelectNodes {
$services_tmp = $servicesDBInfo["services"];
$services = $this->filterEnabledServices($services_tmp);
$allHosts = $this->convertHostInfoToList($allHosts_t);
- foreach($masterToHost as $componentName=>$hostName) {
+ foreach($masterToHost as $componentName=>$hostNames) {
$this->logger->log_debug("For cluster $clusterName setting $componentName to host $hostName");
- $db->addHostsToComponent($clusterName, $componentName, array($hostName), "ASSIGNED", "");
+ $db->addHostsToComponent($clusterName, $componentName, $hostNames, "ASSIGNED", "");
if ($componentName == "GANGLIA_MONITOR_SERVER") {
$gangliaMaster = $hostName;
}
@@ -420,7 +420,7 @@ class SelectNodes {
$result = $this->addZooKeeperServer($services, $result, $allHostsInfo[1]);
$result = $this->addZooKeeperServer($services, $result, $allHostsInfo[2]);
$result = $this->addGangliaServer($result, $allHostsInfoExHMC[$monitorIndex]);
- $result = $this->addNagiosServer($result, $allHostsInfo[$monitorIndex]);
+ $result = $this->addNagiosServer($result, $allHostsInfoExHMC[$monitorIndex]);
return $result;
}
if ( $numNodes > 30) {