//The client which needs to be decommissioned is put in the exclude path.
String command = "echo " + ttClientHostName + " > " + excludeHostPath;
LOG.info("command is : " + command);
RemoteExecution rExec = new SSHRemoteExecution();
rExec.executeCommand(jtClientHostName, userName, command);
//The refreshNode command is created and execute in Job Tracker Client.
String refreshNodeCommand = "export HADOOP_CONF_DIR=" + hadoopConfDir +
"; export HADOOP_HOME=" + hadoopHomeDir + ";cd " + hadoopHomeDir +
";kinit -k -t " + keytabForHadoopqaUser +
";bin/hadoop mradmin -refreshNodes;";
LOG.info("refreshNodeCommand is : " + refreshNodeCommand);
try {
rExec.executeCommand(testRunningHostName, userName,
refreshNodeCommand);
} catch (Exception e) { e.printStackTrace();}
//Checked whether the node is really decommissioned.
boolean nodeDecommissionedOrNot = false;
nodeDecommissionedOrNot = remoteJTClientProxy.
isNodeDecommissioned(ttClientHostName);
//The TTClient host is removed from the exclude path
command = "rm " + excludeHostPath;
LOG.info("command is : " + command);
rExec.executeCommand(jtClientHostName, userName, command);
Assert.assertTrue("Node should be decommissioned", nodeDecommissionedOrNot);
//The refreshNode command is created and execute in Job Tracker Client.
rExec.executeCommand(jtClientHostName, userName,
refreshNodeCommand);
//Checked whether the node is out of decommission.
nodeDecommissionedOrNot = false;
nodeDecommissionedOrNot = remoteJTClientProxy.
isNodeDecommissioned(ttClientHostName);
Assert.assertFalse("present of not is", nodeDecommissionedOrNot);
//Starting that node
String ttClientStart = "export HADOOP_CONF_DIR=" + hadoopConfDir +
"; export HADOOP_HOME=" + hadoopHomeDir + ";cd " + hadoopHomeDir +
";kinit -k -t " + keytabForHadoopqaUser +
";bin/hadoop-daemons.sh start tasktracker;";
LOG.info("ttClientStart is : " + ttClientStart);
rExec.executeCommand(jtClientHostName, userName,
ttClientStart);
}