You can invoke a
planned failover on a target replication group and recover the devices on the
target site. After that, you can reverse the direction of the replication and
make the target site the source site.
Prerequisites
- Verify that you are
connected to the
vCenter
Server
systems of the source and target sites.
- Verify that you have
access to at least one virtual machine host on each site.
- Verify that you have
registered a Virtual Volume VASA provider and have access to a Virtual Volume
datastore on each site.
Procedure
-
Create a storage policy
with replication capability on the source site.
$replicationCapability = Get-SpbmCapability -Name *replication.RPO -Server $srcServer
$persistenceCapability = Get-SpbmCapability -Name *persistence1-readLatency -Server $srcServer
$replicationRule = New-SpbmRule -Capability $ replicationCapability -Value (New-TimeSpan -Hours 4)
$persistenceRule = New-SpbmRule $persistenceCapability -Value 25
$ruleSet = New-SpbmRuleSet -AllOfRules $replicationRule, $persistenceRule
$replicationPolicy = New-SpbmStoragePolicy -Name cokeRep -AnyOfRuleSets $ruleSet -Server $srcServer
-
Get a datastore
compatible with the created replication storage policy and store it in the
$ds
variable.
$ds = Get-SpbmCompatibleStorage -StoragePolicy $replicationPolicy
-
Create a virtual machine
named
MyVM
with a hard disk in the
$ds
datastore.
$vm = New-VM -Name 'MyVM' -VMHost 'Host-Source' -DiskMB 512 -Datastore $ds
$hd = Get-HardDisk -VM $vm
-
Get a replication group
for the
$ds
datastore and the
$replicationPolicy
storage policy, and store the replication group in the
$rg
variable.
$rg = Get-SpbmReplicationGroup –Datastore $ds –StoragePolicy $replicationPolicy
-
Associate the
$vm
virtual machine and its hard disk with the
$replicationPolicy
storage policy, and put them in the
$rg
replication group.
Set-SpbmEntityConfiguration -Configuration $vm, $hd -StoragePolicy $replicationPolicy -ReplicationGroup $rg
-
Check the compliance of
the
$vm
virtual machine and
$hd
hard disk with the
$replicationPolicy
storage policy.
Get-SpbmEntityConfiguration $vm, $hd
-
Get the replication pair
corresponding to the
$rg
source replication group, and store that pair in the
$rgPair variable.
$rgPair = Get-SpbmReplicationPair -Source $rg
-
Synchronize the target
replication group.
Sync-SpbmReplicationGroup $rgPair.Target
-
Power off the
$vm
virtual machine and unregister it.
Stop-VM $vm
Remove-VM $vm
-
Prepare the failover on
the source replication group.
Start-SpbmReplicationPrepareFailover $rgPair.Source
-
Synchronize the target
replication group again, to get the latest state of the source devices.
Sync-SpbmReplicationGroup $rgPair.Target
-
Invoke the planned
failover on the source replication group and store the virtual machine file
path on the target site in the
$vmFilePath variable.
$vmFilePath = Start-SpbmReplicationFailover $rgPair.Target
-
Register the virtual
machine on the
Host-Target host and
power on the virtual machine.
$vm = New-VM -VMFilePath $vmFilePath -VMHost 'Host-Target'
Start-VM $vm
-
Reverse the direction
of the replication.
Start-SpbmReplicationReverse $rgPair.Target