Storage Replica is new Windows Server feature that provides volume-bases replication for high availability and disaster recovery needs.
We can use Storage replica to enable replication between 2 servers, clusters, stretched-cluster (Single Cluster, auto failover) and server to self (You will need to have 4 separate volumes on one computer).
Server Replica is not meant to be a replacement for backup because files that are deleted at the source will also get deleted at the destination.
Storage Replica supports 2 replication modes:
• Synchronous replication – is primarily used for high-end transactional applications that need instant failover if the primary node fails. It is often used for disaster recovery and it is preferred for applications with low recovery time objects that can’t tolerate data loss.
• Asynchronous replication – writes data to the primary storage first and then copy the data to the replica.
- Active Directory Domain (does not need to run Windows Server 2016)
- Windows Server 2016 Datacenter is needed at source and at the target
- Each server requires a minimum of one 1GbE network connection
- We need to have 2 volumes on each location (DATA and LOG) and they need to be configured as GPT and they need to be the same size at the source and destination.
- The replicated storage cannot be located on the drive containing the Windows operating system folder
- The data disks must be formatted as GPT, not MBR
Let’s get started.
Server-to-Server Storage Replication
We will start by installing Storage Replica feature on both servers (Member01 and Member02). It is added as a feature using Server Manager. Reboot is required.
2 volumes has been configured on both servers. R (Replica) – This volume will be replicated to Member02 and L (Logs) volume for replica log files. Both servers are configured with identical drives using the same capacity.
Next we need to create a replication partnership. Launch Windows PowerShell on Member01 (Primary Server) as Administrator and run following command:
New-SRPartnership -SourceComputerName Member01 -SourceRGName Replication01 -SourceVolumeName R: -SourceLogVolumeName L: -DestinationComputerName Member02 -DestinationRGName Replication02 -DestinationVolumeName R: -DestinationLogVolumeName L:
If we switch to Member02 we will notice that volume (R:) is no longer accessible.
Let’s see configuration’s properties. On Member01 run this command in Powershell
By Default, log size is 8GB and it is set up to run with synchronous replication. You can always change it by running Set-SRPartnership -ReplicationMode Asynchronous if you would like to.
- Monitor Storage Replication
It is always good to monitor activity and you can do it with Performance Monitor, since Storage Replica includes a set of built-in metrics.
Run Powershell as admin and type in PerfMon.msc
Performance Monitor will pop-up. Expand Monitoring Tools, and click Performance Monitor.
Click the ADD button
In Availalbe Counters area, click on Storage Replica Statistics
Click Add and OK
Right now there is no activity. Wi will change it right away.
Copy some files in R: and go back to Performance Monitor. There will be a lot of activity this time.
If you change the graph type to Report you will notice that the statistics indicate the current performance and totals of volume replication.
- Reverse replication from Destination to Source Server
If you would like to change replication so that your destination server become source you would need to run this command (on Member02)
Set-SRPartnership –NewSourceComputerName Member02 –SourceRGName Replication02 –DestinationComputerName Member01 –DestinationRGName Replication01 –confirm:$false
Now if we switch to Member01 we will notice that volume (R:) is no longer available. You can click on it but you cannot open it.
- Remove Replication
If you would like to remove replication you would need to run this command
Run PowerShell as Admin on Member02 and first type in
Get-SRPartnership | Remove-SRPartnership –confirm:$false
(You can type in -Verbose at the end of the command to see information about command processing)
Second command is
Remove-SRGroup –Name Replication02
Switch to Member01, run Powershell as admin and type in
Remove-SRGroup –Name Replication01
You will be able to access all volumes on both servers and you will be able to see files, which you copied, on both servers.
This happen if replica volume is placed on the same disk as OS partition. So, replica and log volumes must be placed on separate disk.