Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ระบบ >> Windows Server

กำหนดค่า Storage Replica บน Windows Server 2016

ฟีเจอร์น่าสนใจ Storage Replica (SR) ปรากฏใน Windows Server 2016 อนุญาตให้ Replicate Local Disk Volume ไปยัง Remote Server สำหรับ Disaster Recovery ข้อมูล Volume จะ Sync อัตโนมัติผ่าน Network ไปยัง Secondary Server ที่จะมี Identical Copy ของ Volume พร้อมใช้งานตลอดเวลา ใน Storage Replica ข้อมูลถูก Replicate ระดับ Block ผ่าน Protocol SMB v3.1 โดยอิสระจาก File System Type ที่ใช้ (NTFS, CSVFS, ReFS)

โหมดการ Replication

Storage Replication ใน Windows Server 2016 ทำงานใน Active/Passive Mode หมายถึง Data พร้อมใช้งานได้เฉพาะ Source Server มี 2 โหมด Replication:

  1. Synchronous Replication — เขียนข้อมูลไปยัง Server ทั้งสองพร้อมกัน Primary Server รอ Confirmation เขียนจาก Remote Server ก่อน (Zero Data Loss ระดับ File System ระหว่าง Failure ใน Low-latency Network)
  2. Asynchronous Replication — เขียนข้อมูลไป Primary Server ก่อน แล้วค่อย Replicate ไป Secondary (ใช้ได้กับ High-latency Network แต่ไม่รับประกัน Identical Copies หากเกิด Failure)

Scenario ที่ Storage Replica รองรับ

  1. Replication ระหว่าง Local Volumes ของ Server เดียวกัน
  2. Server-to-Server Storage Replication
  3. Storage Replication ใน Stretch Cluster
  4. Cluster-to-Cluster Storage Replication

สารบัญ

Storage Replica Prerequisites

Infrastructure ต้องตรงตามข้อกำหนด:

  • Windows Server 2016/2019 Datacenter Edition
  • Server ทั้งสอง Join Active Directory Domain
  • แต่ละ Server ต้องมี Drive เพิ่ม 2 ตัว: หนึ่งสำหรับ Data, อีกหนึ่งสำหรับ Logs — Log Drive ต้องเร็วกว่า Data Drive ควรเป็น SSD ขนาด Data Drive ต้องเท่ากัน
  • GUID Partition Table (GPT) บน Physical Disks (MBR ไม่รองรับ)
  • รองรับ Local Drives (SAS/SCSI/SATA), iSCSI, SAN, Shared VHD Set, Storage Spaces (S2D) บน SAS JBOD
  • RAM ว่างอย่างน้อย 2 GB
  • Network Throughput ระหว่าง Server อย่างน้อย 1 Gbit/s Latency น้อยกว่า 5 ms ทั้งสองทาง (ปกติจำกัดระยะห่าง Replication Partners 20-50 km) แนะนำ Network Adapter รองรับ RDMA
  • เปิด TCP Ports 445, 5985 และ 5445 ระหว่าง Server

ติดตั้ง Storage Replica Feature บน Windows Server 2016

ติดตั้ง Storage Replica Feature จาก Server Manager Console หรือ PowerShell:

Install-WindowsFeature Storage-Replica –IncludeManagementTools -Restart

ติดตั้งบน Server ทั้งสอง แล้ว Restart Server ทั้งคู่

กำหนดค่า Volume Replication บน Windows Server 2016

Storage Replication ไม่มี Integrated Graphical Management Console ตั้งค่าผ่าน PowerShell, Windows Admin Center หรือ Failover Clustering Console (ถ้าใช้ Cluster)

ดู Cmdlets ใน Module StorageReplica: Get-Command -Module storagereplica

ใช้ Test-SRTopology ตรวจสอบว่า Server และ Network ตรงตามข้อกำหนด SR ได้ ประเมิน I/O Operations, Network Throughput, Log Sizes ปัจจุบัน Cmdlet จะสร้าง HTML Report พร้อม Loads และ Recommendations ปัจจุบัน

Enable Replication ของ Drive D: ระหว่าง Server แยกกัน Server1 และ Server2 (Disk L: ใช้สำหรับ Logs, Log Size 1GB):

New-SRPartnership -SourceComputerName Server1 -SourceRGName Server1ReplGr01 -SourceVolumeName E: -SourceLogVolumeName L: -DestinationComputerName Server2 -DestinationRGName Server2ReplGr01 -DestinationVolumeName D: -DestinationLogVolumeName E: -LogSizeInBytes 1GB

หลัง Enable Replication บน Secondary Server Data Disk จะไม่สามารถเข้าถึงโดยตรงได้ (RAW Format)

ดูข้อมูล Volume Replication เพิ่มเติมจาก Performance Counters ใน PerfMon หรือ PowerShell:

Get-Counter -Counter "\Storage Replica Statistics(*)"

Monitor Volume Replication Events จาก Event Viewer (Applications and Services Logs → Microsoft → Windows → StorageReplica) หรือ PowerShell:

Get-WinEvent -ProviderName Microsoft-Windows-StorageReplica -max 20

เปลี่ยน Replication Mode เป็น Asynchronous: Set-SRPartnership -ReplicationMode Asynchronous

กรณี Primary Server ล้มเหลว สามารถเปลี่ยนทิศทาง Replication Manual วาง Secondary Copy Online:

Set-SRPartnership -NewSourceComputerName Server2 -SourceRGName Server2ReplGr01 -DestinationComputerName Server1 -DestinationRGName Server1ReplGr01

ดู Replication Group State และทิศทาง Replication: Get-SRGroup และ Get-SRPartnerShip

ดู Copy Queue Length: (Get-SRGroup).Replicas | Select-Object numofbytesremaining

Disable Storage Replication:

Get-SRPartnership | Remove-SRPartnership (บน Primary Server เท่านั้น)
Get-SRGroup | Remove-SRGroup (บน Server ทั้งสอง)

ตั้งค่าจาก GUI ใช้ Windows Admin Center (WAC)

หลายองค์กรใช้ DFS Replication ระหว่าง Datacenters สำหรับ Replicate Data Storage SR มีข้อดีเหนือ DFS: Copy ระดับ Block (Replicate Open/In-use Files และ VSS Snapshots ได้); Database Independence; Fast และ Synchronous Replication (ไม่ต้องรอชั่วโมงหรือวันอย่าง DFS) แต่ SR มีข้อเสีย: รองรับแค่ 1-to-1 Replication; ต้องการ Network Throughput และ Latency สูง; โดยไม่มี Cluster ทิศทาง Replication ต้อง Switch Manual รวมถึง Reconfigure Apps/Users ไป Server ใหม่ (ลดความซับซ้อนได้ด้วย Common DFS Namespace)

ใน Windows Server 2019 Build 17650 Storage Replica พร้อมใน Standard Edition ด้วย (Replicate ได้ 1 Volume ถึง 2TB ไป 1 Replication Partner) เพิ่มโหมด Test Failover — Partner Replica Volume เขียนได้ Replication หยุดจนกว่าจะปิด Test Failover Mode (การเปลี่ยนแปลงในโหมดนี้ Roll Back ไป Snapshot)