Windows 2025
Sponsored Link

ファイルサーバー : DFS レプリケーションを設定2025/01/10

 

DFS レプリケーション グループを作成します。

DFS レプリケーションを設定することにより、あるサーバー上のフォルダーを、別サーバー上のフォルダーにレプリケーションすることができます。

当例では、以下のような Active Directory ドメイン環境で、シンプルな 2 台構成の双方向レプリケーションを設定します。

                                   |
+----------------------+           |           +----------------------+
|  [ fd3s.srv.world ]  |10.0.0.100 | 10.0.0.101|  [ rx-7.srv.world ]  |
|   Active Directory   +-----------+-----------+     File Server #1   |
|                      |           |           |    DFS Replication   |
+----------------------+           |           +----------------------+
                                   |
                                   |           +----------------------+
                                   | 10.0.0.102|  [ rx-8.srv.world ]  |
                                   +-----------+     File Server #2   |
                                               |    DFS Replication   |
                                               +----------------------+

[1] データ ブランチ (ソース) サーバーとするホスト上で、PowerShell を管理者権限で起動して設定します。
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

# DFS レプリケーショングループ 作成 (名称は任意)
PS C:\Users\serverworld> New-DfsReplicationGroup -GroupName "RepGroup01" 

GroupName   : RepGroup01
DomainName  : srv.world
Identifier  : 6eb84337-fe83-464e-9a42-7a20a510dcbe
Description :
State       : Normal

# レプリケーショングループのメンバーサーバーを設定
PS C:\Users\serverworld> Add-DfsrMember -GroupName "RepGroup01" -ComputerName "rx-7","rx-8" 

GroupName                    : RepGroup01
ComputerName                 : RX-7
DomainName                   : srv.world
Identifier                   : 26bfe587-ac0c-4190-a26b-eb079efc0483
Description                  :
DnsName                      : rx-7.srv.world
Site                         : Default-First-Site-Name
NumberOfConnections          : 0
NumberOfInboundConnections   : 0
NumberOfOutboundConnections  : 0
NumberOfInterSiteConnections : 0
NumberOfIntraSiteConnections : 0
IsClusterNode                : False
State                        : Normal

GroupName                    : RepGroup01
ComputerName                 : RX-8
DomainName                   : srv.world
Identifier                   : c78a68e9-34f2-4ee5-8d92-653bf103ac3c
Description                  :
DnsName                      : rx-8.srv.world
Site                         : Default-First-Site-Name
NumberOfConnections          : 0
NumberOfInboundConnections   : 0
NumberOfOutboundConnections  : 0
NumberOfInterSiteConnections : 0
NumberOfIntraSiteConnections : 0
IsClusterNode                : False
State                        : Normal

# メンバーサーバー間のデータ転送方法を設定
# -SourceComputerName [ブランチ (ソース) サーバー]
# -DestinationComputerName [ハブ (宛先) サーバー]
PS C:\Users\serverworld> Add-DfsrConnection -GroupName "RepGroup01" `
-SourceComputerName "rx-7" `
-DestinationComputerName "rx-8" 

GroupName               : RepGroup01
SourceComputerName      : RX-7
DestinationComputerName : RX-8
DomainName              : srv.world
Identifier              : 7a24425e-1dfe-417d-a0a4-fc61efec0dbe
Enabled                 : True
RdcEnabled              : True
CrossFileRdcEnabled     : True
Description             :
MinimumRDCFileSizeInKB  : 64
State                   : Normal

GroupName               : RepGroup01
SourceComputerName      : RX-8
DestinationComputerName : RX-7
DomainName              : srv.world
Identifier              : 7cf2b658-8db2-45db-811b-21fb898c8f60
Enabled                 : True
RdcEnabled              : True
CrossFileRdcEnabled     : True
Description             :
MinimumRDCFileSizeInKB  : 64
State                   : Normal

# レプリケーション対象のフォルダー作成 (任意の場所で OK)
PS C:\Users\serverworld> New-Item E:\Replica01 -ItemType Directory

# レプリケーション対象のフォルダー名を設定 (名称は任意)
PS C:\Users\serverworld> New-DfsReplicatedFolder -GroupName "RepGroup01" -FolderName "Replica01" 

GroupName              : RepGroup01
FolderName             : Replica01
DomainName             : srv.world
Identifier             : ad6a7471-ba47-43e8-a777-d0d9571b11a8
Description            :
FileNameToExclude      : {~*, *.bak, *.tmp}
DirectoryNameToExclude : {}
DfsnPath               :
IsDfsnPathPublished    : False
State                  : Normal

# ブランチサーバーのレプリケーション対象のフォルダーパスを設定
PS C:\Users\serverworld> Set-DfsrMembership -GroupName "RepGroup01" `
-FolderName "Replica01" `
-ContentPath "E:\Replica01" `
-ComputerName "rx-7" `
-PrimaryMember $True 

This operation will modify the DFSR membership with domain: srv.world; replication group: "RepGroup01"; replicated folder:
"Replica01"; computer: RX-7; GUID: {34788889-0295-474a-8f9f-3ae9a86cbe39}.
Are you sure you want to modify this membership?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y


GroupName                   : RepGroup01
ComputerName                : RX-7
FolderName                  : Replica01
GroupDomainName             : srv.world
ComputerDomainName          : srv.world
Identifier                  : 34788889-0295-474a-8f9f-3ae9a86cbe39
DistinguishedName           : CN=ad6a7471-ba47-43e8-a777-d0d9571b11a8,CN=c362261f-c382-4f48-aec3-2ca70b35ea25,CN=DFSR-LocalSett
                              ings,CN=RX-7,CN=Computers,DC=srv,DC=world
ContentPath                 : E:\Replica01
PrimaryMember               : True
StagingPath                 : E:\Replica01\DfsrPrivate\Staging
StagingPathQuotaInMB        : 4096
MinimumFileStagingSize      : Size256KB
ConflictAndDeletedPath      : E:\Replica01\DfsrPrivate\ConflictAndDeleted
ConflictAndDeletedQuotaInMB : 4096
ReadOnly                    : False
RemoveDeletedFiles          : False
Enabled                     : True
DfsnPath                    :
State                       : Normal

# ハブサーバー (宛先) のレプリケーション対象のフォルダーパスを設定
PS C:\Users\serverworld> Set-DfsrMembership -GroupName "RepGroup01" `
-FolderName "Replica01" `
-ContentPath "C:\Replica01" `
-ComputerName "rx-8" 

This operation will modify the DFSR membership with domain: srv.world; replication group: "RepGroup01"; replicated folder:
"Replica01"; computer: RX-8; GUID: {0679979a-48cd-4f45-b5d1-e174d7b92a73}.
Are you sure you want to modify this membership?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y


GroupName                   : RepGroup01
ComputerName                : RX-8
FolderName                  : Replica01
GroupDomainName             : srv.world
ComputerDomainName          : srv.world
Identifier                  : 0679979a-48cd-4f45-b5d1-e174d7b92a73
DistinguishedName           : CN=ad6a7471-ba47-43e8-a777-d0d9571b11a8,CN=41b9db3e-fae0-4202-8a90-88c8c9b0b800,CN=DFSR-LocalSett
                              ings,CN=RX-8,CN=Computers,DC=srv,DC=world
ContentPath                 : C:\Replica01
PrimaryMember               : False
StagingPath                 : C:\Replica01\DfsrPrivate\Staging
StagingPathQuotaInMB        : 4096
MinimumFileStagingSize      : Size256KB
ConflictAndDeletedPath      : C:\Replica01\DfsrPrivate\ConflictAndDeleted
ConflictAndDeletedQuotaInMB : 4096
ReadOnly                    : False
RemoveDeletedFiles          : False
Enabled                     : True
DfsnPath                    :
State                       : Normal

# レプリケーションの状態確認
PS C:\Users\serverworld> Get-DfsrCloneState 
Ready

# レプリケーションフォルダーにファイルを保管して動作確認
PS C:\Users\serverworld> New-Item E:\Replica01\testfolder -ItemType Directory 
PS C:\Users\serverworld> Add-Content -Path E:\Replica01\testfile.txt "Test File" 
PS C:\Users\serverworld> Get-ChildItem E:\Replica01 

    Directory: E:\Replica01


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----          1/9/2025   8:12 PM             11 testfile.txt
-a----          1/9/2025   8:12 PM              0 testfolder

PS C:\Users\serverworld> ssh rx-8 powershell -c "Get-ChildItem C:\Replica01" 
fd3s01\serverworld@rx-8's password:


    Directory: C:\Replica01


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----          1/9/2025   8:12 PM             11 testfile.txt
-a----          1/9/2025   8:12 PM              0 testfolder


PS C:\Users\serverworld> ssh rx-8 powershell -c "Add-Content -Path C:\Replica01\testfolder\testfile2.txt 'Replication Test'" 
fd3s01\serverworld@rx-8's password:

PS C:\Users\serverworld> Get-ChildItem E:\Replica01\testfolder 

    Directory: E:\Replica01\testfolder


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----          1/9/2025   8:23 PM             18 testfile2.txt

PS C:\Users\serverworld> Get-Content E:\Replica01\testfolder\testfile2.txt 
Replication Test
ファイルサーバー : DFS レプリケーションを設定 (GUI)
 

GUI で構成する場合は以下のように設定します。

[2] [スタート] - [サーバーマネージャー] から [ツール] - [DFS の管理] を起動します。
[3] 左ペインで [レプリケーション] を右クリックして、メニューから [新しいレプリケーション グループ] を開きます。
[4] 2 台構成のシンプルなレプリケーショングループを設定する場合は、[データ収集用のレプリケーション グループ] を選択します。3 台以上の構成 または 2 台構成でも詳細な設定オプションを利用したい場合は [汎用レプリケーション グループ] を選択します。
[5] 任意のレプリケーション グループ名や説明を入力して [次へ] をクリックします。
[6] レプリケーションのブランチ (ソース) サーバーとするホストの名前を入力して [次へ] をクリックします。
[7] ブランチサーバー上のレプリケーション対象としたいフォルダーを設定します。[追加] ボタンをクリックします。
[8] レプリケーション対象としたいフォルダーのパスを指定して [OK] します。
[9] レプリケーションのハブ (宛先) サーバーとするホストの名前を入力して [次へ] をクリックします。
[10] ハブサーバー上のレプリケーション ターゲット フォルダーのパスを指定して [次へ] をクリックします。
[11] レプリケーションのスケジュールや帯域幅を指定します。 既定では以下のように、帯域幅最大で、対象フォルダーに変更があった場合は即時レプリケーション実行される常時レプリケーションとなっています。 帯域幅を制限したい場合や、レプリケーション実行のタイミングの日時を手動設定したい場合は [指定した日時の間レプリケートする] を選択して、スケジュールを細かく設定可能です。
[12] 設定内容を確認し、よければ [作成] をクリックします。
[13] 全て [成功] であれば OK です。[閉じる] をクリックして終了します。
[14] DFS 管理画面には設定したレプリケーション グループが表示されます。
[15] いずれかのサーバー上で、レプリケーション対象フォルダー内に任意のファイル等を保管して、正常にレプリケーションされるか動作確認しておくとよいでしょう。
関連コンテンツ