I've been trying to write some scripts to get this all working in a 1, 2, 3 then 4 scenario.
I wrote and tested a bunch of scripts and they all worked.
Now, I'm getting an error when I try to create a 2 node HA volume... with scripts I have tested before without issue...
My configuration is:
VSAN001
- Windows Server 2016 Standard Core with all updates applied
- C:\VSAN is the directory for all volumes
- NIC 1 @ 10.1.1.10 - Managment/iSCSI
- NIC 2 @ 10.1.4.10 - Heartbeat
- NIC 3 @ 10.1.5.10 - Sync
VSAN002
- Windows Server 2016 Standard Core with all updates applied
- C:\VSAN is the directory for all volumes
- NIC 1 @ 10.1.1.20 - Managment/iSCSI
- NIC 2 @ 10.1.4.20 - Heartbeat
- NIC 3 @ 10.1.5.20 - Sync
The firewall is disabled on each machine.
Here is my script
--- START ---
# +------------------------------------------+
# | |
# | Starwind vSAN Free 2 Node Setup Script |
# | Original script by: Starwind Software |
# | Modifications by: Jeff Morlen |
# | |
# | This script will setup a 2 node HA |
# | cluster on Microsoft Windows Hyper-V |
# | server or Microsoft Windows Server |
# | versions 2012, 2012R2 and 2016 with |
# | PowerShell installed and configured. |
# | |
# | ---- DEFAULTS FOR THIS SCRIPT ARE ---- |
# | |
# | Host 1 configured as: |
# | NIC1: 10.1.1.10/24 - System Data |
# | NIC2: 10.1.4.10/24 - Heartbeat |
# | NIC3: 10.1.5.10/24 - SAN Data Sync |
# | |
# | Host 2 configured as: |
# | NIC1: 10.1.1.20/24 - System Data |
# | NIC2: 10.1.4.20/24 - Heartbeat |
# | NIC3: 10.1.5.20/24 - SAN Data Sync |
# | |
# | vSAN data location is (both systems): |
# | C:\VSAN\[data files] |
# | |
# | Primary Image on Host 1: |
# | HA_MASTER_IMG1 |
# | Backup Image on Host 2: |
# | HA_BACKUP_IMG1 |
# | |
# +------------------------------------------+
Import-Module StarWindX
try
{
# --------------------------------------------------------------------------------------------------------------------
# START OF CONFIGURATION OF 1ST HOST
# --------------------------------------------------------------------------------------------------------------------
# IP address (below) is the address of Host 1.
# The default for this script, as noted above, is 10.1.1.10.
#
$server = New-SWServer -host 10.1.1.10 -port 3261 -user root -password starwind
$server.Connect()
# Define the object $firstNode using "new-Object Node"
$firstNode = new-Object Node
# The ImagePath is written in a sudo-linux style.
# Whereas "C:\VSAN" = "My Computer\C\VSAN" or "D:\Data" = "My Computer\D\Data"
$firstNode.ImagePath = "My computer\C\VSAN"
$firstNode.ImageName = "HA_MASTER_IMG1"
# 102400 = 100GB; 51200 = 50GB; 20480 = 20GB; 1024 = 1GB (based on 1024=1GB)
$firstNode.Size = 20480
# Sets the active command to create the image upon running of script. (DUH)
$firstNode.CreateImage = $true
# Sets the "TargetAlias" to "targetha1"
$firstNode.TargetAlias = "targetha1"
# Sets the Sync to "AUTO" (DUH)
$firstNode.AutoSynch = $true
# HBInterface (below) is the target interface on the 2nd system, Host 2.
# The default for this script, as noted above, is 10.1.4.20.
$firstNode.HBInterface = "#p2=10.1.4.20:3260"
# SyncInterface (below) is the target interface on the 2nd system, Host 2.
# The default for this script, as noted above, is 10.1.5.20.
$firstNode.SyncInterface = "#p2=10.1.5.20:3260"
$firstNode.CacheSize = 128
# CacheMode: wb = write back; wt = write through
# If you are going to store virtual machines on this SAN, use WT.
$firstNode.CacheMode = "wt"
$firstNode.PoolName = ""
$firstNode.SyncSessionCount = 1
$firstNode.ALUAOptimized = $true
#
# Device sector size. Possible values: 512 or 4096(May be incompatible with some clients!) bytes.
# For Hyper-V use 4096 sector size. (suggested by Starwind)
#
$firstNode.SectorSize = 4096
# --------------------------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------------------------
# START OF CONFIGURATION OF 2ND HOST
# --------------------------------------------------------------------------------------------------------------------
# Define the object $secondNode using "new-Object Node"
$secondNode = new-Object Node
# IP address (below) is the address of Host 2.
$secondNode.HostName = "10.1.1.20"
$secondNode.HostPort = "3261"
$secondNode.Login = "root"
$secondNode.Password = "starwind"
# The ImagePath is written in a sudo-linux style.
# Whereas "C:\VSAN" = "My Computer\C\VSAN" or "D:\Data" = "My Computer\D\Data"
$secondNode.ImagePath = "My computer\C\VSAN"
$secondNode.ImageName = "HA_BACKUP_IMG1"
# 102400 = 100GB; 51200 = 50GB; 20480 = 20GB; 1024 = 1GB (based on 1024=1GB)
$secondNode.Size = 20480
# Sets the active command to create the image upon running of script. (DUH)
$secondNode.CreateImage = $true
# Sets the "TargetAlias" to "partnerha1"
$secondNode.TargetAlias = "partnerha1"
# Sets the Sync to "AUTO" (DUH)
$secondNode.AutoSynch = $true
# HBInterface (below) is the target interface on the 1st system, Host 1.
# The default for this script, as noted above, is 10.1.4.10.
$secondNode.HBInterface = "#p1=10.1.4.10:3260"
# SyncInterface (below) is the target interface on the 1st system, Host 1.
# The default for this script, as noted above, is 10.1.5.10.
$secondNode.SyncInterface = "#p1=10.1.5.10:3260"
$secondNode.ALUAOptimized = $true
# --------------------------------------------------------------------------------------------------------------------
# Starts the process off with the creation of "Clear" volumes on both the first and second nodes.
$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -initMethod "Clear"
# --------------------------------------------------------------------------------------------------------------------
# Captures the sync status to variable $syncState and it is displayed later.
$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")
# Adds a pause of 2 seconds (I think)
Start-Sleep -m 2000
# Writes the syncstate to the screen.
Write-Host "Synchronizing: $($syncPercent)%" -foreground yellow
}
}
catch
{
# Error handling and display of error in the event of an issue.
Write-Host "Exception $($_.Exception.Message)" -foreground red
}
# Terminate session and close "server"
$server.Disconnect()
--- END ---
What am I missing?
The Latest Gartner® Magic Quadrant™Hyperconverged Infrastructure Software