【问题标题】:Why storage replica failover failed either use New-PSSession or Enter-PSSession为什么使用 New-PSSession 或 Enter-PSSession 存储副本故障转移失败
【发布时间】:2021-08-25 15:11:05
【问题描述】:

以下脚本将成功完成,但故障转移后,新的 DestinationComputer 数据卷仍处于挂载状态,复制状态为“WaitingForDestination”

$cred = Get-Credential domain\adminaccount
$s = New-PSSession -computerName DestinationSrv01 -credential $cred
Invoke-Command -Session $s -Scriptblock {Set-SRPartnership -NewSourceComputerName DestinationSrv01 -SourceRGName rg02 -DestinationComputerName SourceSrv01 -DestinationRGName rg01 -confirm:$false}
Remove-PSSession $s

SourceSrv01:

DataVolume IsMounted ReplicationMode   ReplicationStatus
---------- --------- ---------------   -----------------
D:\                     Synchronous WaitingForDestination

我用Enter-PSSession测试了同样的命令,结果和上面一样。

如果我 RDP 到 DestinationSrv01 并打开 PowerShell 控制台运行以下命令,则一切正常。

Set-SRPartnership -NewSourceComputerName DestinationSrv01 -SourceRGName rg02 -DestinationComputerName SourceSrv01 -DestinationRGName rg01 -confirm:$false

SourceSrv01:

DataVolume IsMounted ReplicationMode     ReplicationStatus
---------- --------- ---------------     -----------------
D:\           False   Synchronous ContinuouslyReplicating

【问题讨论】:

  • 这是一个猜测,但这可能是一个时间问题,并且可能与通过远程处理完成的对象序列化有关。尝试在脚本块中的Set-... 命令之后添加| Get-SRPartnership。由于看起来Set-SRPartnership 命令正在输出对象,因此在通过会话返回之前应该会导致刷新。
  • 我更改了脚本添加 Invoke-Command -Session $s -Scriptblock { Set-SRPartnership -NewSourceComputerName DestinationSrv01 -SourceRGName rg02 -DestinationComputerName SourceSrv01 -DestinationRGName rg01 -confirm:$false | Get-SRPartnership} Start-Sleep -s 30 Remove-PSSession $s 我还是有同样的问题,这使得 SourceSrv01 & DestinationSrv01 rw DataVolume IsMounted ReplicationMode ReplicationStatus ---------- ------- -- --------------- ----------------- D:\ Synchronous WaitingForDestination

标签: windows powershell cluster-computing powershell-remoting failovercluster


【解决方案1】:

我在这里盲目导航,但目前的 cmets 和时间问题的怀疑尝试调整 Start-Sleep 的位置:

$cred = Get-Credential domain\adminaccount
$s = New-PSSession -computerName DestinationSrv01 -credential $cred

$ScriptBlock = {
    $SRPartnerShip = Set-SRPartnership -NewSourceComputerName DestinationSrv01 -SourceRGName rg02 -DestinationComputerName SourceSrv01 -DestinationRGName rg01 -confirm:$false
    Start-Sleep -Seconds 30
    $SRPartnerShip = $SRPartnerShip | Get-SRPartnership
}

Invoke-Command -Session $s -Scriptblock $ScriptBlock
Remove-PSSession $s

这会等待 30 秒,然后刷新然后返回。按照您的方式,您在返回后等待了 30 秒。如果通过简单的重新获取刷新没有修复它,它不会改变任何东西,除了等待更长时间返回错误信息。

【讨论】:

  • 非常感谢史蒂文。我按照您的建议修改了脚本并再次运行它。和之前一样 DataVolume IsMounted ReplicationMode ReplicationStatus ---------- --------- --------------- --------- -------- D:\ Synchronous WaitingForDestination 如果从 RDP 会话控制台进行故障转移,新目标应类似于 DataVolume IsMounted ReplicationMode ReplicationStatus ---------- --------- --------------- ----------------- D:\ False Synchronous ContinuouslyReplicating
  • 对不起,这是我的最佳猜测。我没有设置来对此进行代码风暴。
猜你喜欢
  • 1970-01-01
  • 2022-01-23
  • 1970-01-01
  • 2014-04-18
  • 2019-01-09
  • 1970-01-01
  • 2020-04-03
  • 1970-01-01
  • 2020-11-25
相关资源
最近更新 更多