2 Node Hyper-Converged Setup using Windows Server 2016
I have managed to get one CSV up and running via the attached script. It is a modified version of the CreateHA (2Node) powershell script. What is the proper method to add a second and third CSV to the Nodes? I have attempted to use the CreateImage script but that only creates the image on one node and doesn't sync to the others. I have also tried to just run the Same CreateHA (2Node) script and just change the names of the volume but this doesn't seem to fully work either.
Please advise of my error or proper way to create multiple CSV via powershell/ StarWindX.
Thanks, Jonathan.
CreateHAWitness
Code: Select all
Import-Module StarWindX
try
{
$server = New-SWServer -host 100.10.10.1 -port 3261 -user root -password starwind
$server.Connect()
$firstNode = new-Object Node
$firstNode.ImagePath = "My computer\K"
$firstNode.ImageName = "Witness"
$firstNode.Size = 1024
$firstNode.CreateImage = $true
$firstNode.TargetAlias = "vmwitness01"
$firstNode.AutoSynch = $true
$firstNode.SyncInterface = "#p2=100.10.10.2:3260"
$firstNode.HBInterface = "#p2=100.10.20.2:3260"
$firstNode.CacheSize = 64
$firstNode.CacheMode = "wb"
$firstNode.PoolName = "pool1"
$firstNode.SyncSessionCount = 1
$firstNode.ALUAOptimized = $true
#
# device sector size. Possible values: 512 or 4096(May be incompatible with some clients!) bytes.
#
$firstNode.SectorSize = 4096
#
# 'SerialID' should be between 16 and 31 symbols. If it not specified StarWind Service will generate it.
# Note: Second node always has the same serial ID. You do not need to specify it for second node
#
$firstNode.SerialID = "050176c0b535403ba3ce02102e33eac"
#$secondNode.SerialID = "050176c0b535403ba3ce02102e33eac"
$secondNode = new-Object Node
$secondNode.HostName = "100.10.10.2"
$secondNode.HostPort = "3261"
$secondNode.Login = "root"
$secondNode.Password = "starwind"
$secondNode.ImagePath = "My computer\K"
$secondNode.ImageName = "Witness"
$secondNode.Size = 1024
$secondNode.CreateImage = $true
$secondNode.TargetAlias = "vmwitness02"
$secondNode.AutoSynch = $true
$secondNode.SyncInterface = "#p1=100.10.10.1:3260"
$secondNode.HBInterface = "#p1=100.10.20.1:3260"
$secondNode.ALUAOptimized = $true
$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -initMethod "Clear"
$syncState = $device.GetPropertyValue("ha_synch_status")
while ($syncState -ne "1")
{
#
# Refresh device info
#
$device.Refresh()
$syncState = $device.GetPropertyValue("ha_synch_status")
$syncPercent = $device.GetPropertyValue("ha_synch_percent")
Start-Sleep -m 2000
Write-Host "Synchronizing: $($syncPercent)%" -foreground yellow
}
}
catch
{
Write-Host "Exception $($_.Exception.Message)" -foreground red
}
$server.Disconnect()
CreateHACSV01
Code: Select all
Import-Module StarWindX
try
{
$server = New-SWServer -host 100.10.10.1 -port 3261 -user root -password starwind
$server.Connect()
$firstNode = new-Object Node
$firstNode.ImagePath = "My computer\K"
$firstNode.ImageName = "CSV01"
$firstNode.Size = 450000
$firstNode.CreateImage = $true
$firstNode.TargetAlias = "vmsan01"
$firstNode.AutoSynch = $true
$firstNode.SyncInterface = "#p2=100.10.10.2:3260"
$firstNode.HBInterface = "#p2=100.10.20.2:3260"
$firstNode.CacheSize = 64
$firstNode.CacheMode = "wb"
$firstNode.PoolName = "pool1"
$firstNode.SyncSessionCount = 1
$firstNode.ALUAOptimized = $true
#
# device sector size. Possible values: 512 or 4096(May be incompatible with some clients!) bytes.
#
$firstNode.SectorSize = 4096
#
# 'SerialID' should be between 16 and 31 symbols. If it not specified StarWind Service will generate it.
# Note: Second node always has the same serial ID. You do not need to specify it for second node
#
$firstNode.SerialID = "050176c0b535403ba3ce02102e33eac"
#$secondNode.SerialID = "050176c0b535403ba3ce02102e33eac"
#$firstNode.SerialID = "050176c0b535403ba3ce02102e33eab"
$secondNode = new-Object Node
$secondNode.HostName = "100.10.10.2"
$secondNode.HostPort = "3261"
$secondNode.Login = "root"
$secondNode.Password = "starwind"
$secondNode.ImagePath = "My computer\K"
$secondNode.ImageName = "CSV01"
$secondNode.Size = 450000
$secondNode.CreateImage = $true
$secondNode.TargetAlias = "vmsan02"
$secondNode.AutoSynch = $true
$secondNode.SyncInterface = "#p1=100.10.10.1:3260"
$secondNode.HBInterface = "#p1=100.10.20.1:3260"
$secondNode.ALUAOptimized = $true
$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -initMethod "Clear"
$syncState = $device.GetPropertyValue("ha_synch_status")
while ($syncState -ne "1")
{
#
# Refresh device info
#
$device.Refresh()
$syncState = $device.GetPropertyValue("ha_synch_status")
$syncPercent = $device.GetPropertyValue("ha_synch_percent")
Start-Sleep -m 2000
Write-Host "Synchronizing: $($syncPercent)%" -foreground yellow
}
}
catch
{
Write-Host "Exception $($_.Exception.Message)" -foreground red
}
$server.Disconnect()