public function FormatNamenode($pHost, $pProtocol) { $client = new EasyHadoopClient($pProtocol); $command = "Y|sudo -u hadoop hadoop namenode -format"; $str = $client->RunCommand($command); return $str; }
public function CheckHadoopProcess($pRole, $pProtocol) { $client = new EasyHadoopClient($pProtocol); switch ($pRole) { case "namenode": $jps = "namenode"; break; case "jobtracker": $jps = "jobtracker"; break; case "secondarynamenode": $jps = "secondarynamenode"; break; case "datanode": $jps = "datanode"; break; case "tasktracker": $jps = "tasktracker"; break; default: return "Unknown Role name"; break; } $command = "ps aux | grep -w " . $jps . " | grep -v grep | awk '{print \$2}'"; #$this->mCommand = $this->cAgentRunShell.":".$command; $str = $client->RunCommand($command); return $str; }
public function InstallHadoopgpl($pProtocol) { $client = new EasyHadoopClient($pProtocol); $filename = "/home/hadoop/hadoop-gpl-packaging-0.5.4-1.x86_64.rpm"; if ($client->FileExists($filename)) { $command = "cd /home/hadoop/ \n\t\t\t\t\t\trpm -Uvh hadoop-gpl-packaging-0.5.4-1.x86_64.rpm \n\t\t\t\t\t\tcp -rf /opt/hadoopgpl/lib/* /usr/lib/ \n\t\t\t\t\t\tcp -rf /opt/hadoopgpl/lib/* /usr/lib64/\n\t\t\t\t\t\tcp -rf /opt/hadoopgpl/lib/* /usr/share/hadoop/lib/ \n\t\t\t\t\t\tcp -rf /opt/hadoopgpl/native /usr/share/hadoop/lib/\n\t\t\t\t\t\tcp -f /opt/hadoopgpl/native/Linux-amd64-64/* /usr/lib\n\t\t\t\t\t\tcp -f /opt/hadoopgpl/native/Linux-amd64-64/* /usr/lib64"; } else { $command = "mkdir -p /home/hadoop \n\t\t\t\t\t\tcd /home/hadoop/ \n\t\t\t\t\t\twget http://113.11.199.230/resources/x64/hadoop-gpl-packaging-0.5.4-1.x86_64.rpm \n\t\t\t\t\t\trpm -Uvh hadoop-gpl-packaging-0.5.4-1.x86_64.rpm \n\t\t\t\t\t\tcp -rf /opt/hadoopgpl/lib/* /usr/lib/ \n\t\t\t\t\t\tcp -rf /opt/hadoopgpl/lib/* /usr/lib64/\n\t\t\t\t\t\tcp -rf /opt/hadoopgpl/lib/* /usr/share/hadoop/lib/ \n\t\t\t\t\t\tcp -rf /opt/hadoopgpl/native /usr/share/hadoop/lib/\n\t\t\t\t\t\tcp -f /opt/hadoopgpl/native/Linux-amd64-64/* /usr/lib\n\t\t\t\t\t\tcp -f /opt/hadoopgpl/native/Linux-amd64-64/* /usr/lib64"; } $ret = $client->RunCommand($command); return $ret; }