Software-based VM-centric and flash-friendly VM storage + free version
Moderators: anton (staff), art (staff), Max (staff), Anatoly (staff)
-
denkteich
- Posts: 32
- Joined: Fri Jun 07, 2019 7:52 am
Fri Jun 07, 2019 7:58 am
Hi all,
I'm new to VSAN Free. I've setup a 2 node cluster using CreateHA(two nodes).ps1.
Got it working and connected to my vmware.
How can I check the sync state with powershell?
Tried to use parts of the script without any luck.
The $device object is created via Add-HDADevice, which is not working on an already created HADevice.
Get-Device with the IP of the first node fails with:
The property 'Connected' cannot be found on this object. Verify that the property exists.
The property 'Devices' cannot be found on this object. Verify that the property exists.
Any suggestion?
TIA
.d
-
Serhi
- Posts: 21
- Joined: Mon Mar 25, 2019 4:01 pm
Fri Jun 07, 2019 11:07 am
Hi denkteich
Did you try to run C:\Program Files\StarWind Software\StarWind\StarWindX\Samples\powershell\SyncHaDeviceAdvanced.ps1 ?
My result:
PS C:\Windows\system32> C:\Program Files\StarWind Software\StarWind\StarWindX\Samples\powershell\SyncHaDeviceAdvanced.ps1
HAImage1
Device synchronized
-
denkteich
- Posts: 32
- Joined: Fri Jun 07, 2019 7:52 am
Fri Jun 07, 2019 1:58 pm
Hi Serhi,
maybe this is not what i wanted.
the script is alway displaying synchronized.
i did the following thing:
- shutdown node 1
- copied lots of data to node 2
- ran script: synchronized, even if node 1 is not available
- started node 1
- ran script: synchronized, even while node 1 is synching the changes
how can i get this like the replication status, if it is resyncing or how much percentage is done?
cheers
.d
-
Boris (staff)
- Staff
- Posts: 805
- Joined: Fri Jul 28, 2017 8:18 am
Fri Jun 07, 2019 2:24 pm
It looks like you are running the script against the current node's VSAN service.
To check whether a particular device is synchronized on all partner servers, you would need to adjust the script to check all of them.
how can i get this like the replication status, if it is resyncing or how much percentage is done?
This can be achieved by checking the HA device properties. Check the enumDeviceTarget.ps1 script for more details.
-
Boris (staff)
- Staff
- Posts: 805
- Joined: Fri Jul 28, 2017 8:18 am
Fri Jun 07, 2019 6:08 pm
Try using enumDevicesTargets.ps1: syncStatus 1 would mean "synchronized', 2- synchronizing, 3 - not synchronized.
You can access that by checking the following property of the device:
-
denkteich
- Posts: 32
- Joined: Fri Jun 07, 2019 7:52 am
Fri Jun 07, 2019 9:19 pm
Perfect, that was it I was looking for.
One more question:
how can I shorten it for only one device, not for all?
-
Boris (staff)
- Staff
- Posts: 805
- Joined: Fri Jul 28, 2017 8:18 am
Sat Jun 08, 2019 3:51 pm
something like:
Code: Select all
if ($device.Name -eq "HAImageX") { # where "X" is the number for that particular device (like HAImage1)
$device.SyncState
}
should work for you.
-
denkteich
- Posts: 32
- Joined: Fri Jun 07, 2019 7:52 am
Mon Jun 10, 2019 5:52 am
My SyncState.ps1 is ready.
Here it is:
Code: Select all
Import-Module StarWindX
try
{
Enable-SWXLog
$servers = @()
$devicename = "HAImage1"
$servers += New-SWServer 10.0.0.181 3261 root starwind
$servers += New-SWServer 10.0.0.182 3261 root starwind
foreach($server in $servers)
{
$server.Connect()
write-host "Server:" $server.IP "-" $devicename -foreground yellow
foreach($device in $server.Devices)
{
if ($device.Name -eq $devicename) {
switch ($device.SyncStatus){
1 {$status = "synchronized"}
2 {$status = "synchronizing"}
3 {$status = "not synchronized"}
default {$status = "UNDEFINED"}
}
write-host "SyncStatus:" $status
write-host "SyncPercent:" $device.SyncPercent "%"
}
}
$server.Disconnect()
write-host "-----------"
}
}
catch
{
Write-Host $_ -foreground red
}
finally
{
}