Wednesday, 15 June 2016

HdInsight Cluster Backup Strategy - PART 2 eod.ps1

$servername = "xxxxxxxxxxxxxx-ssh.azurehdinsight.net"
$username = "admin123"
$password = "Test@45678"
$port = 22


$command1 = "hadoop fs -rm -R wasb://container-name@storageacc-name.blob.core.windows.net/backup/*"
$command2 = "hadoop fs -copyFromLocal /home/admin123/* wasb://container-namebackup@storageacc-name.blob.core.windows.net/backup/ "
$commandname = @($command1,$command2)

Import-Module SSH-Sessions
New-SshSession -ComputerName $servername -Username $username -Password $password -Port $port

foreach ($c in $commandname) {
$SshResults = Invoke-SshCommand -InvokeOnAll -Command $c
}
Write-Host "Done!!!"

Remove-SshSession -RemoveAll

No comments:

Post a Comment