public void HadoopRequirements(PowershellCommand ps, string host, int threadId) { //Console.WriteLine(host + " " + (threadId - Configuration.Hostnames.Count()).ToString()); Console.WriteLine("Starting installation on host " + host); Global.AppInstallCursorPosition.Add(host, Console.CursorTop - 1); System.Threading.Thread.Sleep(Global.Hostnames.Count() + 2000); Console.SetCursorPosition(0, Global.AppInstallCursorPosition[host]); Console.WriteLine(host + " - Installing Python and setting Environmental variables "); ps.ExecuteRemote(host, PowershellCommandString.PythonInstall); Console.SetCursorPosition(0, Global.AppInstallCursorPosition[host]); Console.WriteLine(host + " - Installing Visual C++ Redistributable "); ps.ExecuteRemote(host, PowershellCommandString.VisualCInstall); Console.SetCursorPosition(0, Global.AppInstallCursorPosition[host]); Console.WriteLine(host + " - Installing Java and setting Environmental variables "); ps.ExecuteRemote(host, PowershellCommandString.JavaInstall); Console.SetCursorPosition(0, Global.AppInstallCursorPosition[host]); Console.WriteLine(host + " - Installing HDP. This may take a minute or two "); ps.ExecuteRemote(host, PowershellCommandString.HDPInstall); Console.SetCursorPosition(0, Global.AppInstallCursorPosition[host]); ConsoleText.Green(host + " - Installation completed! "); }
public static void HDPInstall() { PowershellCommand ps = new PowershellCommand(Global.UserName, Global.Password); try { Global.Log.Info("HDP Install starting..."); HostPreparation.SetTrustedHosts(ps, true); HostPreparation.EnablePSRemoting(); HostPreparation.SetTrustedHosts(ps); HostPreparation.TestHosts(); HostPreparation.ConfigurePorts(ps, true); CopyFiles(); HostPreparation.DisableIPv6(ps); Console.WriteLine(""); Console.WriteLine("This pause is added if any manual configurations need to be performed on the cluster nodes " + "prior to installation of HDP. Once finished hit any key to continue with the installation.."); Console.ReadKey(); Console.WriteLine(""); ApplicationInstallation(ps); HostPreparation.EnableFirewall(ps); HostPreparation.StartServices(ps); HostPreparation.RunSmokeTests(ps); } catch (Exception ex) { Global.Log.Error("Installation Failed! " + ex.ToString()); Console.ReadKey(); return; } }
private static void ApplicationInstallation(PowershellCommand ps) { Console.CursorVisible = false; Console.WriteLine(); ConsoleText.Yellow("Required application installation..."); ManualResetEvent[] doneEvents = new ManualResetEvent[Global.Hostnames.Count()]; for (int i = 0; i < Global.Hostnames.Count(); i++) { doneEvents[i] = new ManualResetEvent(false); AppThreadPool app = new AppThreadPool(doneEvents[i], ps, Global.Hostnames[i]); ThreadPool.QueueUserWorkItem(app.Install, i); } WaitHandle.WaitAll(doneEvents); Console.WriteLine(); Console.CursorVisible = true; }
public static void ConfigurePorts(PowershellCommand ps, bool enable) { ConsoleText.Yellow("Configuring HDP ports..."); try { foreach (string host in Global.Hostnames) { Console.WriteLine(host); string hosts = String.Join(",", Global.Hostnames.ToArray()); StringBuilder s = ps.ExecuteRemote(host, PowershellCommandString.HDPPorts(true)); } } catch (Exception ex) { Global.Log.Error(ex.ToString()); throw; } ConsoleText.Green("Done"); }
public static void Hadoop(PowershellCommand ps, string host) { try { ps.ExecuteRemote(host, PowershellCommandString.HDPPorts(false)); ps.ExecuteRemote(host, PowershellCommandString.HDPUninstall); ps.ExecuteRemote(host, PowershellCommandString.RemoveJavaEnVar); ps.ExecuteRemote(host, PowershellCommandString.RemovePythonEnVar); ps.ExecuteRemote(host, PowershellCommandString.DeleteDirectory(Configuration.HDPDir)); ps.ExecuteRemote(host, PowershellCommandString.DeleteDirectory(Global.ClusterProperties["HDP_LOG_DIR"])); ps.ExecuteRemote(host, PowershellCommandString.DeleteDirectory(Global.ClusterProperties["HDP_DATA_DIR"])); ps.ExecuteRemote(host, PowershellCommandString.RequiredApplicationUninstall); } catch (Exception ex) { Global.Log.Error(ex.ToString()); throw; } }
public static void EnableFirewall(PowershellCommand ps) { if (Configuration.EnableFirewall) { ConsoleText.Yellow("Enabling all Firewall Profiles..."); try { foreach (string host in _hostnames) { Console.WriteLine(host); StringBuilder sb = ps.ExecuteRemote(host, "netsh advfirewall set allprofiles state on"); } } catch (Exception ex) { throw; } ConsoleText.Green("Done"); } }
public static void DisableIPv6(PowershellCommand ps) { try { ConsoleText.Yellow("Disabling IPv6..."); foreach (string host in _hostnames) { Console.WriteLine(host); StringBuilder s = ps.ExecuteRemote(host, @"New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\services\TCPIP6\Parameters -Name DisabledComponents -PropertyType DWord -Value 0xffffffff"); } if (Configuration.RestartForIPV6) { Console.WriteLine("Restarting all Hosts for IPv4 resolution to take effect..."); ps.ExecuteRemoteAsync("Restart-Computer -ComputerName " + String.Join(",", Global.Hostnames.ToArray()) + " -Force -Wait -For WinRM -Timeout 180"); } ConsoleText.Green("Done"); } catch (Exception ex) { Global.Log.Error(ex.ToString()); throw; } }
public static void StartServices(PowershellCommand ps) { if (Configuration.StartServices) { try { foreach (string host in _hostnames) { ConsoleText.Yellow("Starting services on " + host); ps.ExecuteRemoteAsync("invoke-command -computername " + host + @" -scriptblock {C:\HDP\hadoop\start_local_hdp_services}"); } } catch (Exception ex) { Global.Log.Error(ex.ToString()); throw; } } }
public static void SetTrustedHosts(PowershellCommand ps, bool isLocal) { try { string hosts = String.Join(",", Global.Hostnames.ToArray()); StringBuilder s = ps.ExecuteRemote(Environment.MachineName, @"Set-item wsman:localhost\client\trustedhosts -value """ + hosts + @""" -force;" + @"Get-item wsman:localhost\client\trustedhosts"); } catch (Exception ex) { Global.Log.Error(ex.ToString()); throw; } }
public static void SetTrustedHosts(PowershellCommand ps) { ConsoleText.Yellow("Setting Trusted Hosts on all nodes..."); try { foreach (string host in _hostnames) { Console.WriteLine(host); string hosts = String.Join(",", Global.Hostnames.ToArray()); StringBuilder s = ps.ExecuteRemote(host, @"Set-item wsman:localhost\client\trustedhosts -value """ + hosts + @""" -force;" + @"Get-item wsman:localhost\client\trustedhosts"); } ConsoleText.Green("Done"); } catch (Exception ex) { Global.Log.Error(ex.ToString()); throw; } }
public static void RunSmokeTests(PowershellCommand ps) { if (Configuration.RunSmokeTests) { try { ConsoleText.Yellow("Running Smoke Tests..."); ps.ExecuteRemoteAsync("invoke-command -computername " + Global.ClusterProperties["NAMENODE_HOST"] + @" -scriptblock {" + Configuration.HDPDir + @"\hadoop\Run-SmokeTests.cmd}"); ConsoleText.Green("HDP Installation Complete. Press any key to exit..."); Console.ReadKey(); } catch (Exception ex) { Global.Log.Error(ex.ToString()); throw; } } }
private static void UninstallHadoop(PowershellCommand ps) { ManualResetEvent[] doneEvents = new ManualResetEvent[Global.Hostnames.Count()]; ConsoleText.Yellow("Uninstall started..."); for (int i = 0; i < Global.Hostnames.Count(); i++) { doneEvents[i] = new ManualResetEvent(false); AppThreadPool app = new AppThreadPool(doneEvents[i], ps, Global.Hostnames[i]); ThreadPool.QueueUserWorkItem(app.Uninstall, i); } WaitHandle.WaitAll(doneEvents); Console.CursorVisible = true; }