My lab setup is:
3 servers, 2 for data and 1 for witness role:
STOR1 (192.168.123.41, 10.10.123.41, 10.11.123.41)
STOR2 (192.168.123.42, 10.10.123.42, 10.11.123.42)
STOR2 (192.168.123.43, 10.10.123.43, 10.11.123.43)
3 networks:
LAN (192.168.123.0/24)
iSCSI/SYNC (10.10.123.0/24)
iSCSI/HB (10.11.123.0/24)
Firewall is disabled
I'm using CreateHAPartnerWitness.ps1 sample and just using the correct IP addresses and paths
It looks like this:
Code: Select all
param($addr="192.168.123.41", $port=3261, $user="root", $password="starwind",
$addr2="192.168.123.42", $port2=$port, $user2=$user, $password2=$password,
$addrW="192.168.123.43", $portW=$port, $userW=$user, $passwordW=$password,
#common
$initMethod="Clear",
$size=128,
$sectorSize=512,
$failover=1,
$bmpType=1,
$bmpStrategy=0,
#primary node
$imagePath="My computer\C\sw",
$imageName="masterImg31",
$createImage=$true,
$storageName="",
$targetAlias="targetha31",
$poolName="pool1",
$syncSessionCount=1,
$aluaOptimized=$true,
$cacheMode="none",
$cacheSize=0,
$syncInterface="#p2=10.10.123.42:3260;#p3=10.10.123.43:3260",
$hbInterface="",
$createTarget=$true,
$bmpFolderPath="",
#secondary node
$imagePath2="My computer\C\sw",
$imageName2="partnerImg32",
$createImage2=$true,
$storageName2="",
$targetAlias2="partnerha32",
$poolName2="pool1",
$syncSessionCount2=1,
$aluaOptimized2=$false,
$cacheMode2=$cacheMode,
$cacheSize2=$cacheSize,
$syncInterface2="#p1=10.10.123.41:3260;#p3=10.10.123.43:3260",
$hbInterface2="",
$createTarget2=$true,
$bmpFolderPath2="",
#third node
$imagePathW="My computer\C\sw",
$imageNameW="witness33",
$targetAliasW="witness33",
$syncInterfaceW="#p1=10.10.123.41:3260;#p2=10.10.123.42:3260",
$hbInterfaceW="",
$nodeTypeW=8
)
Import-Module StarWindX
try
{
Enable-SWXLog
$server = New-SWServer -host $addr -port $port -user $user -password $password
$server.Connect()
$firstNode = new-Object Node
$firstNode.HostName = $addr
$firstNode.HostPort = $port
$firstNode.ImagePath = $imagePath
$firstNode.ImageName = $imageName
$firstNode.Size = $size
$firstNode.CreateImage = $createImage
$firstNode.StorageName = $storageName
$firstNode.TargetAlias = $targetAlias
$firstNode.SyncInterface = $syncInterface
$firstNode.HBInterface = $hbInterface
$firstNode.PoolName = $poolName
$firstNode.SyncSessionCount = $syncSessionCount
$firstNode.ALUAOptimized = $aluaOptimized
$firstNode.SectorSize = $sectorSize
$firstNode.CacheMode = $cacheMode
$firstNode.CacheSize = $cacheSize
$firstNode.FailoverStrategy = $failover
$firstNode.CreateTarget = $createTarget
$firstNode.BitmapStoreType = $bmpType
$firstNode.BitmapStrategy = $bmpStrategy
$firstNode.BitmapFolderPath = $bmpFolderPath
$secondNode = new-Object Node
$secondNode.HostName = $addr2
$secondNode.HostPort = $port2
$secondNode.Login = $user2
$secondNode.Password = $password2
$secondNode.ImagePath = $imagePath2
$secondNode.ImageName = $imageName2
$secondNode.CreateImage = $createImage2
$secondNode.StorageName = $storageName2
$secondNode.TargetAlias = $targetAlias2
$secondNode.SyncInterface = $syncInterface2
$secondNode.HBInterface = $hbInterface2
$secondNode.SyncSessionCount = $syncSessionCount2
$secondNode.ALUAOptimized = $aluaOptimized2
$secondNode.CacheMode = $cacheMode2
$secondNode.CacheSize = $cacheSize2
$secondNode.FailoverStrategy = $failover
$secondNode.CreateTarget = $createTarget2
$secondNode.BitmapFolderPath = $bmpFolderPath2
$thirdNode = new-Object Node
$thirdNode.HostName = $addrW
$thirdNode.HostPort = $portW
$thirdNode.Login = $userW
$thirdNode.Password = $passwordW
$thirdNode.ImagePath = $imagePathW
$thirdNode.ImageName = $imageNameW
$thirdNode.TargetAlias = $targetAliasW
$thirdNode.SyncInterface = $syncInterfaceW
$thirdNode.HBInterface = $hbInterfaceW
$thirdNode.FailoverStrategy = $failover
$thirdNode.Type = $nodeTypeW
$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -thirdNode $thirdNode -initMethod $initMethod
$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 $_ -foreground red
}
finally
{
$server.Disconnect()
}
Script works only partly.
Storage files, HA devices and targets are created but synchronization never goes past 1%. It's just stuck.
The only error in Management Console is that partners are not synchronized.
I can create 2 node HA device without witness or with SMB witness without any problem with the same setup.
So. This setup seems pretty clean and pristine. Is it possible at all to create 2 node HA device with partner witness using powershell only?