CreateHA_2.ps1 Sync and Heartbeat format

Software-based VM-centric and flash-friendly VM storage + free version

Moderators: anton (staff), art (staff), Max (staff), Anatoly (staff)

Post Reply
bkdilse
Posts: 58
Joined: Mon Sep 10, 2018 6:14 am

Fri Apr 05, 2024 3:06 pm

Hi,

I am using StarWind VSAN Free v8.0.15260.0, with the Free License.

Trying to create a 2 Node Storage system, with ESXi separate
Created the 4 x imagefiles separately using CreateImageFile.ps1.
Using CreateHA_2.ps1, with the option CreateImage = $false, so it doesn't overwrite my image files.

Node1
10.0.0.1 - Management
10.0.1.1 - Sync1
10.0.2.1 - Sync2
10.0.3.1 - iSCSI1
10.0.4.1 - iSCSI2

Node1
10.0.0.2 - Management
10.0.1.2 - Sync1
10.0.2.2 - Sync2
10.0.3.2 - iSCSI1
10.0.4.2 - iSCSI2

I managed to create the 1st HA device. When creating the 2nd one, it does not sync, and I get messages in the Console saying that all 4 interfaces are down.

Here is the interface sections of the script:
$FirstNode.SyncInterface = "#p2=10.0.1.2:3260,10.0.2.2:3260"
$FirstNode.HBInterface = "#p2=10.0.3.2:3260,10.0.4.2:3260"

$SecondNode.SyncInterface = "#p1=10.0.1.1:3260,10.0.2.1:3260"
$SecondNode.HBInterface = "#p1=10.0.3.1:3260,10.0.4.1:3260"

What is the correct way to do this in the script?
yaroslav (staff)
Staff
Posts: 2364
Joined: Mon Nov 18, 2019 11:11 am

Fri Apr 05, 2024 3:20 pm

Can I have the screenshot of the error and the entire script, please?
bkdilse
Posts: 58
Joined: Mon Sep 10, 2018 6:14 am

Fri Apr 05, 2024 3:40 pm

yaroslav (staff) wrote:
Fri Apr 05, 2024 3:20 pm
Can I have the screenshot of the error and the entire script, please?
Just removed everything, and I'll run it again from start. I can't attach screenshots here, can I email to you?
bkdilse
Posts: 58
Joined: Mon Sep 10, 2018 6:14 am

Fri Apr 05, 2024 3:56 pm

Moved all this into 2 Windows VMs, for testing, I'll leave my Physical Servers alone, until I get this working.

Script:

Code: Select all

param($addr="10.1.21.1", $port=3261, $user="root", $password="starwind",
	$addr2="10.1.21.2", $port2=$port, $user2=$user, $password2=$password,
#common
	$initMethod="SyncFromFirst",
	$size=1024,
	$sectorSize=512,
	$failover=0,
	$bmpType=1,
	$bmpStrategy=0,
#primary node
	$imagePath="My Computer\F\Data",
	$imageName="SSD2",
	$createImage=$false,
	$storageName="imagefile2",
	$targetAlias="SSD2",
	$autoSynch=$true,
	$poolName="",
	$syncSessionCount=1,
	$aluaOptimized=$true,
	$cacheMode="none",
	$cacheSize="",
	$syncInterface="#p2=10.21.1.2:3260,10.21.2.2:3260",
	$hbInterface="#p2=10.21.3.2:3260,10.21.4.2:3260",
	$createTarget=$false,
	$bmpFolderPath="",
#secondary node
	$imagePath2=$imagePath,
	$imageName2=$imageName,
	$createImage2=$createImage,
	$storageName2="$storageName",
	$targetAlias2=$targetAlias,
	$autoSynch2=$true,
	$poolName2="",
	$syncSessionCount2=1,
	$aluaOptimized2=$true,
	$cacheMode2=$cacheMode,
	$cacheSize2=$cacheSize,
	$syncInterface2="#p1=10.21.1.1:3260,10.21.2.1:3260",
	$hbInterface2="#p1=10.21.3.1:3260,10.21.4.1:3260",
	$createTarget2=$createTarget,
	$bmpFolderPath2=""
	)
	
Import-Module StarWindX

try
{
	Enable-SWXLog -level SW_LOG_LEVEL_DEBUG

	$server = New-SWServer -host $addr -port $port -user $user -password $password

	$server.Connect()

	$firstNode = new-Object Node

	$firstNode.HostName = $addr
	$firstNode.HostPort = $port
	$firstNode.Login = $user
	$firstNode.Password = $password
	$firstNode.ImagePath = $imagePath
	$firstNode.ImageName = $imageName
	$firstNode.Size = $size
	$firstNode.CreateImage = $createImage
	$firstNode.StorageName = $storageName
	$firstNode.TargetAlias = $targetAlias
	$firstNode.AutoSynch = $autoSynch
	$firstNode.SyncInterface = $syncInterface
	$firstNode.HBInterface = $hbInterface
	$firstNode.PoolName = $poolName
	$firstNode.SyncSessionCount = $syncSessionCount
	$firstNode.ALUAOptimized = $aluaOptimized
	$firstNode.CacheMode = $cacheMode
	$firstNode.CacheSize = $cacheSize
	$firstNode.FailoverStrategy = $failover
	$firstNode.CreateTarget = $createTarget
	$firstNode.BitmapStoreType = $bmpType
	$firstNode.BitmapStrategy = $bmpStrategy
	$firstNode.BitmapFolderPath = $bmpFolderPath
    
	#
	# device sector size. Possible values: 512 or 4096(May be incompatible with some clients!) bytes. 
	#
	$firstNode.SectorSize = $sectorSize
    
	$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.AutoSynch = $autoSynch2
	$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
        
	$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -initMethod $initMethod
    
	while ($device.SyncStatus -ne [SwHaSyncStatus]::SW_HA_SYNC_STATUS_SYNC)
	{
		$syncPercent = $device.GetPropertyValue("ha_synch_percent")
	        Write-Host "Synchronizing: $($syncPercent)%" -foreground yellow

		Start-Sleep -m 2000

		$device.Refresh()
	}
}
catch
{
	Write-Host $_ -foreground red 
}
finally
{
	$server.Disconnect()
}
yaroslav (staff)
Staff
Posts: 2364
Joined: Mon Nov 18, 2019 11:11 am

Fri Apr 05, 2024 6:10 pm

Greetings,

Try commenting out the bmp-related entries. Also, is there any specific reason for not creating the device with $createTarget=$false?
Try sticking with $createTarget=$true.
bkdilse
Posts: 58
Joined: Mon Sep 10, 2018 6:14 am

Fri Apr 05, 2024 8:11 pm

yaroslav (staff) wrote:
Fri Apr 05, 2024 6:10 pm
Greetings,

Try commenting out the bmp-related entries. Also, is there any specific reason for not creating the device with $createTarget=$false?
Try sticking with $createTarget=$true.
Didn't work with commenting out bmp bits, errored.
Tried with creating target and images at the same time, and this works. I'll go with this, and not my old method.

Thanks
yaroslav (staff)
Staff
Posts: 2364
Joined: Mon Nov 18, 2019 11:11 am

Fri Apr 05, 2024 10:51 pm

Glad to read it worked ultimately.
Have a nice weekend!
Post Reply