Complete HA creation with StarwindX

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

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

Post Reply
User avatar
DavidMcKnight
Posts: 39
Joined: Mon Sep 06, 2010 2:59 pm

Wed Mar 14, 2018 1:56 pm

I created a NON HA target with StarwindX and now I want to know if i can turn that NON HA target into an two node HA target with StarwindX without losing its data? I've looked at the example of creating an HA target with StarwindX, but that assumes that I want to create both nodes at once and clear them. So if the first node already exists what changes do I need to make to create the second node and sync it to the first?

Code: Select all

Import-Module StarWindX

try
{
    $server = New-SWServer -host 192.168.1.138 -port 3261 -user root -password starwind

    $server.Connect()

    $firstNode = new-Object Node

    $firstNode.ImagePath = "My computer\C"
    $firstNode.ImageName = "masterImg1"
    $firstNode.Size = 256
    $firstNode.CreateImage = $true
    $firstNode.TargetAlias = "targetha1"
    $firstNode.AutoSynch = $true
    $firstNode.SyncInterface = "#p2=30.30.1.139:3260"
    $firstNode.HBInterface = "#p2=192.168.1.139:3260"
    $firstNode.CacheSize = 64
    $firstNode.CacheMode = "wb"
    $firstNode.PoolName = "pool1"
    $firstNode.SyncSessionCount = 1
    $firstNode.ALUAOptimized = $true
    
    $secondNode = new-Object Node

    $secondNode.HostName = "192.168.1.139"
    $secondNode.HostPort = "3261"
    $secondNode.Login = "root"
    $secondNode.Password = "starwind"
    $secondNode.ImagePath = "My computer\C"
    $secondNode.ImageName = "partnerImg1"
    $secondNode.Size = 256
    $secondNode.CreateImage = $true
    $secondNode.TargetAlias = "partnerha1"
    $secondNode.AutoSynch = $true
    $secondNode.SyncInterface = "#p1=30.30.1.138:3260"
    $secondNode.HBInterface = "#p1=192.168.1.138:3260"
    $secondNode.ALUAOptimized = $true
        
    $device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -initMethod "Clear"
}
catch
{
    Write-Host "Exception $($_.Exception.Message)" -foreground red 
}

$server.Disconnect()
Thanks,
Boris (staff)
Staff
Posts: 805
Joined: Fri Jul 28, 2017 8:18 am

Wed Mar 14, 2018 2:10 pm

Unfortunately, at the moment it is not possible to create a replica to a partner server from PowerShell. This feature along with a sample script will be available in the next builds.
gbmaster
Posts: 2
Joined: Mon Sep 03, 2018 12:58 am

Tue Sep 04, 2018 6:23 am

Boris (staff) wrote:Unfortunately, at the moment it is not possible to create a replica to a partner server from PowerShell. This feature along with a sample script will be available in the next builds.
it's been 6 months since the last update -- Is it possible to create a replica to a partner server from PowerShell now?
Oleg(staff)
Staff
Posts: 568
Joined: Fri Nov 24, 2017 7:52 am

Wed Sep 05, 2018 12:53 pm

Unfortunately, this option is not available at the current StarWind build.
ludostarwind
Posts: 1
Joined: Tue Nov 26, 2019 9:49 pm

Tue Nov 26, 2019 9:54 pm

Hi Staff,

Sorry to revive this old thread but my question would be the same as the OP.
I am looking to add a replica to an existing device. Can the cmdlet Add-HADevice from StarWindX module be used for this? Or is it still only an action that can be done from the Mangement Console?

thank you!
Boris (staff)
Staff
Posts: 805
Joined: Fri Jul 28, 2017 8:18 am

Thu Nov 28, 2019 10:46 am

In the latest build you have the AddHAPartner.ps1 sample script that allows adding a partner to the already existing disk. Feel free to adjust it as needed.
paladin245
Posts: 5
Joined: Fri Jan 24, 2020 10:33 pm

Fri Jan 24, 2020 10:42 pm

Boris (staff) wrote:In the latest build you have the AddHAPartner.ps1 sample script that allows adding a partner to the already existing disk. Feel free to adjust it as needed.
Hi Boris,

When attempting to run the script you reference I just receive an error:

Code: Select all

Method invocation failed because [System.__ComObject] does not contain a method named 'AddPartner'.
All nodes are on version 13279, I'm not in a position to be able to store the data elsewhere in order to create a new HAImage from scratch. I need to convert an existing image into an HAImage, this is easily done via the GUI but seems not to work via the StarWindX module.

I really wish you (Starwind) had the equivalent to VMUG or Microsoft Action Pack for those of us in industry that use your software to run our test environments, I'm happy to pay for a license for the GUI management for "non-production" use but we can't afford to pay the production use cost just for a test environment.
Boris (staff)
Staff
Posts: 805
Joined: Fri Jul 28, 2017 8:18 am

Sat Jan 25, 2020 8:30 pm

Can you share your sample script that produces that unexpected output?

By the way, if you qualify for our NFR license (free with GUI console operational), you can request that from our team here.
paladin245
Posts: 5
Joined: Fri Jan 24, 2020 10:33 pm

Sat Jan 25, 2020 8:42 pm

Boris (staff) wrote:Can you share your sample script that produces that unexpected output?

By the way, if you qualify for our NFR license (free with GUI console operational), you can request that from our team here.

Code: Select all

param($addr="192.168.0.22", $port=3261, $user="root", $password="starwind", $deviceName="imagefile1",
	$addr2="192.168.0.12", $port2=$port, $user2=$user, $password2=$password,
#secondary node
	$imagePath2="My computer\D\starwind",
	$imageName2="img1",
	$createImage2=$true,
	$targetAlias2="SW-NVMe1",
	$autoSynch2=$true,
	$poolName2="pool1",
	$syncSessionCount2=1,
	$aluaOptimized2=$true,
	$cacheMode2="node",
	$cacheSize2=0,
	$syncInterface2="#p1=10.0.1.10:3260" -f $addr,
    $hbInterface2="#p1=192.168.0.22:3260" -f $addr,
    $selfSyncInterface="#p1=10.0.1.20:3260" -f $addr2,
    $selfHbInterface="#p1=192.168.0.12:3260" -f $addr2
	)
	
Import-Module StarWindX

try
{
    #Enable-SWXLog -level SW_LOG_LEVEL_INFO
    
    $server = New-SWServer $addr $port $user $password
    $server.Connect()

	$device = Get-Device $server -name $deviceName
	if( !$device )
	{
		Write-Host "Device not found" -foreground red
		return
	}

    $node = new-Object Node
    $node.HostName = $addr2
    $node.HostPort = $port2
    $node.Login = $user2
    $node.Password = $password2
    $node.ImagePath = $imagePath2
    $node.ImageName = $imageName2
    $node.CreateImage = $createImage2
    $node.TargetAlias = $targetAlias2
    $node.SyncInterface = $syncInterface2
    $node.HBInterface = $hbInterface2
	$node.AutoSynch = $autoSynch2
	$node.SyncSessionCount = $syncSessionCount2
	$node.ALUAOptimized = $aluaOptimized2
	$node.PoolName = $poolName2
    $node.CacheMode = $cacheMode2
    $node.CacheSize = $cacheSize2

    Add-HAPartner $device $node $selfSyncInterface $selfHbInterface
}
catch
{
	Write-Host $_ -foreground red 
}
finally
{
	$server.Disconnect()
}
Hi Boris,

See the script above, It feels like I've missed a step as there doesn't seem to be a way to "convert" the flat image file to an HAImage prior to adding the partner node (again all this is easily done through the GUI).

Unfortunately I have already used the NFR license for 12 months previously, I posted about this in r/Homelab a while ago and at your suggestion decided to keep using Starwind via the StarwindX management scripts on the core trial. I emailed back and forth with Inna Dmytryshyna and was advised that the NFR license can only be issued as a "one off" and not re-issued. I think your product is excellent and i will be putting it forward as an excellent option to replace our HPE LeftHand array when we renew our production storage in the next year or two.
Boris (staff)
Staff
Posts: 805
Joined: Fri Jul 28, 2017 8:18 am

Mon Jan 27, 2020 4:48 pm

You need to use CreateHA_2.ps1 and set the parameter called $storageName to the imagefile you need to convert to HA:

Code: Select all

#primary node
$storageName="imagefile4",
paladin245
Posts: 5
Joined: Fri Jan 24, 2020 10:33 pm

Sun May 17, 2020 10:43 pm

Thanks Boris, my apologies for such a late reply! Before you posted, I ended up pulling apart the starwindx.cfg and the disk config / descriptor files and by a combination of the powershell scripts I was already working with and manual edits to the various config files I was able to get everything in sync without the loss of any data in the test environment. I think I have a better understanding of how the StarWind platform works now and I've been able to troubleshoot disc sync issues that I ran into after installing all new 10GbE switching by myself.

Thanks again for your help with this one, next time I'll go the easy route and adjust the powershell script as you suggested in your reply.
yaroslav (staff)
Staff
Posts: 2277
Joined: Mon Nov 18, 2019 11:11 am

Mon May 18, 2020 3:22 am

We are happy to know that it finally works!
Post Reply