Storage replication (storage replica) is a feature that comes with Windows Server 2016 that lets you replicate a volume to another server. To work the feature requires two volumes per server. The first for storing data and the second for logs.
Storage replica works on the principle Active / Passive. The data is accessible only from the source node, on the destination it is not possible to access the same disk connect locally on the server.
It is possible to reverse the direction of replication in case of failover.
There are two modes of replication:
- Synchronous: when writing a data it is done simultaneously on both servers, the acknowledgment of the writing of the data must be made on both servers.
Source Microsoft
- Asynchronous: the data is initially written to the source server and then to the replication server.
Source Microsoft
The Storage Replication feature does not have an administrative console, the configuration is done using PowerShell or Admin Center. If you are using the SR as part of a cluste, you can do the configuration using the Failover Clustering Console.
Prerequisites
To put in the functionality it is necessary:
- Two Windows 2016/2019 servers with:
- Fixed ip address
- Member of the same domain
- A partition for the data
- A partition for logs in production predict 10GB
- Make sure the hosts contact each other by their NETBIOS name
- Open Port Communication 445/5445
In order to ease server administration for role installation, I added both servers in the domain controller’s server manager.
Installing the Feature: Storage Replication
1. From the server manager, click Manage 1 / Add Roles and Features 2 .
2. When launching the wizard, click Next 1 .
3. Choose Role Based Installation or 1 Feature and click Next 2 .
4. Select the server where the installation is to be done 1 and click Next 2 .
5. Skip the list of roles by clicking Next 1 .
6. Check the Replica box of storage system 1 .
7. Confirm adding additional tools by clicking Add Features 1 .
8. The feature checked, click Next 1 .
9. Confirm the installation by clicking the Install 1 button.
10. Wait during the installation …
11. Once installed, exit the wizard by clicking Close 1 .
12. The feature requires a server restart. Restart the server.
13. Install on the second server.
Configure replication in PowerShell
1. On the source server, open a PowerShell command prompt in Administrator and enter the following command:
New-SRPartnership -SourceComputerName LAB-FIC1 -SourceRGName rg01 -SourceVolumeName D: -SourceLogVolumeName L: -DestinationComputerName LAB-FIC1-SR -DestinationRGName rg02 -DestinationVolumeName D: -DestinationLogVolumeName L: -LogSizeInBytes 2GB
Explanation:
-SourceComputerName | Netbios name of the source server |
-SourceRGName | Name of the source replication group |
-SourceVolumeName | Volume (s) to replicate |
-SourceLogVolumeName | Volume of the source logs |
-DestinationComputerName | Netbios name of the destination server |
-DestinationRGName | Destination replication group name |
-DestinationVolumeName | Replica Volume (s) |
-DestinationLogVolumeName | Destination logs volume |
-LogSizeInBytes | Log size (default: 8GB) |
Result of the command:
DestinationComputerName : LAB-FIC1-SR
DestinationRGName : rg02
Id : 2856278e-643f-49c7-9842-b25aabb5a70e
SourceComputerName : LAB-FIC1
SourceRGName : rg01
PSComputerName :
2. Go to the destination server, the replicated drive should no longer be available in the interface.
Managing replication on a group server
Show Bytes to replicate
(Get-SRGroup).Replicas | Select-Object NumOfBytesRemaining 0
Result:
NumOfBytesRemaining
-------------------
0
View the last 20 entries of Windows events
Get-WinEvent -ProviderName Microsoft-Windows-StorageReplica -max 20
Result :
ProviderName : Microsoft-Windows-StorageReplica
TimeCreated Id LevelDisplayName Message
----------- -- ---------------- -------
DD/MM/YYYY 09:51:47 5015 Information Connexion établie avec un réplica partenaire....
DD/MM/YYYY 09:51:43 10442 Information Une modification d'état de partition a entraîné une mise à jour ...
DD/MM/YYYY 09:51:43 5002 Information La source est entrée dans l'état prêt....
DD/MM/YYYY 09:51:43 5004 Information La source est entrée dans l'état d'attente de quorum....
DD/MM/YYYY 09:51:43 1237 Information La copie de bloc est en cours....
DD/MM/YYYY 09:51:43 1201 Information Préparation pour réplication de la source terminée....
DD/MM/YYYY 09:51:43 5001 Information Entrée dans l'état de préparation....
DD/MM/YYYY 09:51:43 2231 Information Le groupe de réplication est en ligne....
DD/MM/YYYY 09:51:43 2200 Information Démarrage de la réplication pour le réplica....
DD/MM/YYYY 09:51:32 10330 Information Une partition GPT a été détecté et préparée pour des opérations ...
DD/MM/YYYY 09:51:32 10330 Information Une partition GPT a été détecté et préparée pour des opérations ...
DD/MM/YYYY 09:51:32 10002 Information Pilote de filtre démarré.
DD/MM/YYYY 09:51:24 2202 Information Arrêt de la réplication pour le réplica....
DD/MM/YYYY 09:51:24 10440 Information Une modification d'état de partition a entraîné une mise à jour ...
DD/MM/YYYY 09:50:08 10003 Information La mémoire est désormais disponible....
DD/MM/YYYY 09:50:07 10004 Avertissement La mémoire disponible est insuffisante....
DD/MM/YYYY 09:50:07 10003 Information La mémoire est désormais disponible....
DD/MM/YYYY 09:50:07 10004 Avertissement La mémoire disponible est insuffisante....
DD/MM/YYYY 09:50:03 10003 Information La mémoire est désormais disponible....
DD/MM/YYYY 09:50:02 10004 Avertissement La mémoire disponible est insuffisante....
Event Viewer
The logs are available in the following location: Applications and Services Logs / Microsoft / Windows / StorageReplica.
Reverse the direction of replication (failovers)
To reverse the direction of replication, enter the following command in PowerShell:
Set-SRPartnership -NewSourceComputerName LAB-FIC1-SR -SourceRGName rg02 -DestinationComputerName LAB-FIC1 -DestinationRGName rg01
The order requires confirmation
Delete replication
To remove the replication, enter the following command in PowerShell:
Get-SRPartnership Get-SRPartnership | Remove-SRPartnership Get-SRGroup | Remove-SRGroup
Deletion can be performed on the remaining node to failover if the source server is down.
Replication Management with the Admin Center
1. From the Admin Center, go to a server in the replication group and click on Replica Storage 1 .
2. Select a partnership to have the information.
It is possible to reverse the direction of replication from the Admin Center, select the partnership, and click Change Direction.
3. Management of replicated volumes
4. Event observer
Conclusion
The Storage Replica feature is a good alternative to DFS-R replication for file servers that provides real-time data replication but requires manual intervention to failover and requires a namespace user not to have the shares to reconfigure.
This article gives you an overview of the functionality, it is possible to set it up between two hyper-v clusters for the implementation of a PRA.