vFilO Global Namespaceを試す

4.3のTechnology Preview Featuresであるマルチサイトの機能を試してみます。
それではまたいつものように手探りで設定してみます。

##リモートサイト追加
まずは`remote-site-add`でCLUSTER1からCLUSTER2に向けてリモートサイトを設定します。

```
> remote-site-add --address 10.10.107.202
This command is irreversible and may permanently erase existing files. Are you sure (y/[n])?

ID:                            5d6ceb83-b02a-4c1a-a132-1fab18b6e57e
Name:                          CLUSTER2
Internal ID:                   1
Management address:            10.10.107.202
Data address:                  10.10.107.202

admin@anvil1.datacore.jp>
```

CLUSTER2から見てみると

```
admin@anvil2.datacore.jp> remote-site-list
total 1
ID:                      91c564fb-3be6-4304-b8ea-a3c8876a6486
Name:                    CLUSTER1
Internal ID:             1
Management address:      10.10.107.201
Data address:            10.10.107.201
```

##オブジェクトストレージ追加
両方で同じオブジェクトストレージを追加する。その際に`--shared`を忘れないようにする。

```
admin@anvil1.datacore.jp> object-volume-add --node-name minio --logical-volume-name bucket1 --shared
ID:                      b2ab85d9-f0b2-4c28-8e56-c741f32d003e
Name:                    minio::bucket1
Internal ID:             268435477
Logical volume name:     bucket1
State:                   OK
Node:                    minio
Oper state:              Up
Admin state:             Up
Availability:            99.99%
Durability:              99.9999999%
Online delay:            300000000000
Created:                 2020-03-31 07:17:00 UTC
Modified:                2020-03-31 07:17:00 UTC
Locations:
                         [Type: OBJECT_STORAGE_VOLUME, ID: b2ab85d9-f0b2-4c28-8e56-c741f32d003e, Name: minio::bucket1]
                         [Type: NODE, ID: 34c79b82-a61a-4471-9c79-7c5e718f2839, Name: minio]
                         [Type: VOLUME_GROUP, ID: 387953f2-3fc4-401d-a4c2-ccb5db44fc83, Name: all]
```

```
admin@anvil2.datacore.jp> object-volume-add --node-name minio --logical-volume-name bucket1 --shared
ID:                      b2ab85d9-f0b2-4c28-8e56-c741f32d003e
Name:                    minio::bucket1
Internal ID:             268435475
Logical volume name:     bucket1
State:                   OK
Node:                    minio
Oper state:              Up
Admin state:             Up
Availability:            99.99%
Durability:              99.9999999%
Physical used:           0B
Online delay:            300000000000
Created:                 2020-03-31 07:18:41 UTC
Modified:                2020-03-31 07:18:41 UTC
Locations:
                         [Type: OBJECT_STORAGE_VOLUME, ID: b2ab85d9-f0b2-4c28-8e56-c741f32d003e, Name: minio::bucket1]
                         [Type: NODE, ID: 39e40662-0010-4939-8291-6b144dd676d8, Name: minio]
                         [Type: VOLUME_GROUP, ID: eb264529-69b8-4039-a23c-1bace1a2d7f7, Name: all]
```

##レプリケーション設定

```
admin@anvil1.datacore.jp> share-replication-create --share-name test1 --site-name CLUSTER2 --site-username admin
Enter site password:
success
admin@anvil1.datacore.jp> share-list --name test1
ID:                         5f299f75-d521-4760-9bfe-a2a131ebf5b5
Name:                       test1
Internal ID:                4
State:                      PUBLISHED
Path:                       /test1
All applied objectives:
                        (略)
Size limit state:           NORMAL
Export options:
                         [Subnet: *, Access permissions: RW, Root-squash: false]
Participant ID:             0
Replication participants:
                         ID:                                  383b0f6d-b4e1-45fa-9f13-ae5978eb3043
                         Participant share internal ID:       4
                         Participant site name:               CLUSTER1
                         Participant site management address: 10.10.107.201
                         Participant site data address:       10.10.107.201
                         Participant ID:                      0

                         ID:                                  cb699f17-3992-4dc5-97fa-bf37bd739240
                         State:                               CREATED
                         Participant share internal ID:       3
                         Participant site name:               CLUSTER2
                         Participant site management address: 10.10.107.202
                         Participant site data address:       10.10.107.202
                         Participant ID:                      1
                         Replication interval:                5 seconds
```

CLUSTER2から見てみると

```
admin@anvil2.datacore.jp> share-list --name test1
ID:                         8d8e7240-4227-4532-96aa-cebd986d189f
Name:                       test1
Internal ID:                3
State:                      PUBLISHED
Path:                       /test1
All applied objectives:
                        (略)
Size limit state:           NORMAL
Export options:
                         [Subnet: *, Access permissions: RW, Root-squash: false]
Participant ID:             1
Replication participants:
                         ID:                                  62a0aaea-a211-4d77-ad82-a4992a74fc68
                         State:                               CREATED
                         Participant share internal ID:       4
                         Participant site name:               CLUSTER1
                         Participant site management address: 10.10.107.201
                         Participant site data address:       10.10.107.201
                         Participant ID:                      0
                         Replication interval:                5 seconds

                         ID:                                  a5c31509-c056-4ff7-8567-66ada464b408
                         Participant share internal ID:       3
                         Participant site name:               CLUSTER2
                         Participant site management address: 10.10.107.202
                         Participant site data address:       10.10.107.202
                         Participant ID:                      1

```

##動作確認
CLUSTER1での更新がCLUSTER2でも反映されていることが確認できました。
![vfilo replicaion.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/115778/bcb56dec-4518-180f-de53-662d300917ac.jpeg)

ほんのちょっと遅れて（それでもF5を押せば一瞬待たされるがすぐ反映されてた）他方に反映されています。
どっちを更新してももう一方に反映されます。アクティブ－アクティブですね。

###コマンド（参考）

```
> share-replication-create --help
Usage: share-replication-create [options]
Configure another site to replicate a share by creating a share on the remote site and adding all configured sites as participants

  Options:
    --help                                  Display this help and exit
    --interval                              The interval at which to replicate. May be formatted as 10seconds, 1minute, "1 hour 30 minutes", etc. When no units are specified, seconds are assumed
    --remote-share-description              A textual description for the new remote share (defaults to the local share's description)
    --remote-share-export-option            Export options for the new remote share (defaults to the local share's export-option). Each value must contain <subnet,access-permission, {no-}root-squash>
    --remote-share-name                     A name for the new remote share (defaults to the local share's name)
    --remote-share-path                     A path for the new remote share (defaults to the local share's path)
    --remote-share-preferred-domain         The new remote share's preferred domain in which users have accounts (defaults to the local share's preferred-domain). This field is required for mapping
                                            users from another domain into the remote site's domain
    --remote-share-size                     A share size limit (quota) for the new remote share (defaults to the local share's size)
    --remote-share-size-warning-threshold   Threshold (1-99 percent) for the new remote share's capacity usage, an event will be sent if this threshold is reached.
    --remote-share-unmapped-group           Default group name for new remote share, if there is no mapping discovered into the preferred domain (defaults to the local share's unmapped-group)
    --remote-share-unmapped-user            Default user name for new remote share, if there is no mapping discovered into the preferred domain (defaults to the local share's unmapped-user)
  * --share-id                              The ID of the local share to be replicated. Required unless "--share-name" or "--share-internal-id" is specified
  * --share-internal-id                     The Internal ID of the local share to be replicated. Required unless "--share-id" or "--share-name" is specified
  * --share-name                            The Name of the local share to be replicated. Required unless "--share-id" or "--share-internal-id" is specified
    --site-address                          The IP or DNS address of an interface on the remote site which has the MGMT role
    --site-id                               The ID of the existing remote site
    --site-internal-id                      The internal ID of the existing remote site
    --site-name                             The name of the existing remote site
  * --site-password                         The password for the remote site user
  * --site-username                         A user which has sufficient rights to create shares on the remote site
    --skip-remote-validations               Skip checks for open replication ports and shared object storage volumes
```