ゾーンバケットを作成する

このページでは、次の操作を行う方法について説明します。

ゾーンにバケットを作成する

始める前に

まだ取得していない場合は、バケットの作成に必要なロールを取得します。

コンソール

  1. Google Cloud コンソールで Cloud Storage の [バケット] ページに移動します。

    [バケット] に移動

  2. [作成] をクリックします。
  3. [バケットの作成] ページでユーザーのバケット情報を入力します。以下のステップでは、操作を完了した後に [続行] をクリックして、次のステップに進みます。
    1. [始める] セクションで、次の操作を行います。

    2. [データの保存場所の選択] セクションで、次の操作を行います。

      1. [ロケーション タイプ] で [ゾーン] を選択します。

      2. ロケーション タイプのプルダウン メニューを使用して、バケット内のオブジェクト データが永続的に保存されるロケーションを選択します。

    3. [データの保存方法を選択する] セクションで、高速ストレージがデフォルトのストレージ クラスとして選択されています。

    4. [オブジェクトへのアクセスを制御する方法を選択する] セクションで、バケットに公開アクセスの防止を適用するかどうかを選択し、バケットのオブジェクトに使用するアクセス制御モデルを選択します。

    5. オブジェクト データの暗号化方法を選択するには、[データ暗号化] というラベルの付いた 展開矢印をクリックし、データの暗号化方法を選択します。

  4. [作成] をクリックします。

コマンドライン

  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. 開発環境で、gcloud storage buckets create コマンドを実行します。

    gcloud storage buckets create \
    gs://BUCKET_NAME --location=BUCKET_LOCATION --placement=BUCKET_ZONE \
    --default-storage-class=RAPID --enable-hierarchical-namespace --uniform-bucket-level-access

    次のように置き換えます。

    • BUCKET_NAME は、バケットに付ける名前で、命名要件の対象となります。例: rapid-storage-bucket

    • BUCKET_LOCATION は、バケット リージョンに置き換えます。例: us-east1

    • BUCKET_ZONE は、バケットを配置するゾーンに置き換えます。例: us-east1-b

    リクエストが成功すると、コマンドから次のメッセージが返されます。

    Creating gs://rapid-storage-bucket/...

Cloud Storage FUSE を使用してゾーンバケットをマウントする

始める前に

このセクションでは、Cloud Storage FUSE にすでにアクセスできることを前提としています。まだ行っていない場合は、次の前提条件の手順を行います。

  1. Cloud Storage FUSE をインストールする。Cloud Storage FUSE バージョン 3.4.0 以降をインストールしてください。
  2. Cloud Storage FUSE リクエストを認証する
  3. マウントするバケットを作成していない場合は、バケットをマウントするための必要なロールを取得します。

Cloud Storage FUSE を使用してゾーンバケットをマウントするには、次のコマンドを使用します。

mkdir MOUNT_POINT
gcsfuse BUCKET_NAME MOUNT_POINT

次のように置き換えます。

  • MOUNT_POINT は、バケットをマウントするローカル ディレクトリに置き換えます。例: $HOME/example-bucket

  • BUCKET_NAME は、マウントするバケットの名前に置き換えます。

たとえば、次のコマンドは、example-rapid-storage-bucket という名前のバケットを source-bucket マウント ポイントにマウントします。

mkdir $HOME/source-bucket
gcsfuse example-rapid-storage-bucket $HOME/source-bucket

既存のバケットから新しいゾーンバケットにオブジェクトを転送する場合は、両方のバケットをマウントしてから、cp コマンドを使用してオブジェクトを転送します。

FIO テストでパフォーマンスをベンチマークする

ゾーンバケットの速度をベンチマークするには、FIO テストを実行します。

Google Kubernetes Engine

次のコマンドは、Cloud Storage バケットに対して FIO テストを実行する構成を Google Kubernetes Engine クラスタに適用します。バケットは、GKE 用の FUSE CSI ドライバを使用してコンテナのファイル システムにマウントされます。

$ cat << EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
  name: fio
  namespace: default
  annotations:
    gke-gcsfuse/volumes: "true"
spec:
  containers:
  - name: fio
    image: mayadata/fio
    command: ["/bin/ash", "-c", "--"]
    args:
    - |
      fio --name=read_latency_test --filename=/data/fio --filesize=1G --time_based=1 --ramp_time=10s --runtime=1m --ioengine=libaio --direct=1 --verify=0 --randrepeat=0 --bs=4K --iodepth=1 --rw=randread --disable_slat=1 --disable_clat=1 --lat_percentiles=1 --numjobs=1
    volumeMounts:
    - name: fio-bucket
      mountPath: /data
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: topology.kubernetes.io/zone
            operator: In
            values:
            - ZONE_NAME
  serviceAccountName: default
  volumes:
  - name: fio-bucket
    csi:
      driver: gcsfuse.csi.storage.gke.io
      volumeAttributes:
        bucketName: "BUCKET_NAME"
        gcsfuseLoggingSeverity: warning
  restartPolicy: Never
EOF

ここで

  • ZONE_NAME は、バケットが配置されているゾーンです。例: us-east4-a

  • BUCKET_NAME はバケットの名前です。例: my-bucket

テストが成功すると、次のようなレスポンスが出力されます。

$ kubectl logs fio
Defaulted container "fio" out of: fio, gke-gcsfuse-sidecar (init)
read_latency_test: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=1
fio-3.36
Starting 1 process

read_latency_test: (groupid=0, jobs=1): err= 0: pid=11: Mon Mar  3 20:38:14 2025
  read: IOPS=591, BW=2365KiB/s (2422kB/s)(139MiB/60001msec)
    lat (usec): min=867, max=181966, avg=1685.32, stdev=2695.84
    lat percentiles (usec):
    |  1.00th=[  1074],  5.00th=[  1188], 10.00th=[  1254], 20.00th=[  1336],
    | 30.00th=[  1401], 40.00th=[  1467], 50.00th=[  1549], 60.00th=[  1614],
    | 70.00th=[  1713], 80.00th=[  1844], 90.00th=[  2057], 95.00th=[  2278],
    | 99.00th=[  3064], 99.50th=[  3654], 99.90th=[  8717], 99.95th=[ 73925],
    | 99.99th=[131597]
  bw (  KiB/s): min= 1290, max= 2736, per=100.00%, avg=2365.51, stdev=244.10, samples=120
  iops        : min=  322, max=  684, avg=591.34, stdev=61.10, samples=120
  cpu          : usr=0.81%, sys=1.61%, ctx=36011, majf=0, minf=36
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
    submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
    complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
    issued rwts: total=35473,0,0,0 short=0,0,0,0 dropped=0,0,0,0
    latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
  READ: bw=2365KiB/s (2422kB/s), 2365KiB/s-2365KiB/s (2422kB/s-2422kB/s), io=139MiB (145MB), run=60001-60001msec

Compute Engine VM

次の手順では、Compute Engine VM で FIO テストを実行します。

  1. Cloud Storage FUSE を使用して高速ストレージをマウントします。
mkdir $HOME/rapid-mnt
gcsfuse --max-retry-attempts=5 <bucket-name> PATH

次のように置き換えます。

  • PATH は、バケットをマウントするローカル ファイル システムのパスに置き換えます。
  1. まだインストールしていない場合は、FIO をインストールします。
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install fio -y
  1. FIO 読み取りレイテンシ テストの例を実行します。
fio --name=read_latency_test \
  --filename=BUCKET_PATH/1G --filesize=1G \
  --time_based=1 --ramp_time=10s --runtime=1m \
  --ioengine=libaio --direct=1 --verify=0 --randrepeat=0 \
  --bs=4K --iodepth=1 --rw=randread --numjobs=1

次のように置き換えます。

  • BUCKET_PATH は、マウントしたバケットのパスに置き換えます。

テストが成功すると、次のようなレスポンスが出力されます。

read_latency_test: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=1
fio-3.33
Starting 1 process
Jobs: 1 (f=1): [f(1)][100.0%][eta 00m:00s]
read_latency_test: (groupid=0, jobs=1): err= 0: pid=78399: Tue Feb 11 21:14:35 2025
  read: IOPS=622, BW=2490KiB/s (2550kB/s)(146MiB/60001msec)
    slat (usec): min=108, max=13857, avg=1596.92, stdev=243.32
    clat (nsec): min=1539, max=141717, avg=5872.92, stdev=3230.74
    lat (usec): min=112, max=13866, avg=1602.80, stdev=244.13
    clat percentiles (nsec):
    |  1.00th=[ 2960],  5.00th=[ 3856], 10.00th=[ 4320], 20.00th=[ 4704],
    | 30.00th=[ 4896], 40.00th=[ 5088], 50.00th=[ 5280], 60.00th=[ 5536],
    | 70.00th=[ 5856], 80.00th=[ 6240], 90.00th=[ 7072], 95.00th=[ 8512],
    | 99.00th=[21120], 99.50th=[26240], 99.90th=[40704], 99.95th=[51968],
    | 99.99th=[75264]
  bw (  KiB/s): min= 2024, max= 2672, per=100.00%, avg=2491.15, stdev=105.69, samples=120
  iops        : min=  506, max=  668, avg=622.77, stdev=26.41, samples=120
  lat (usec)   : 2=0.06%, 4=6.21%, 10=89.91%, 20=2.61%, 50=1.15%
  lat (usec)   : 100=0.05%, 250=0.01%
  cpu          : usr=0.67%, sys=1.79%, ctx=37361, majf=0, minf=37
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
    submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
    complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
    issued rwts: total=37355,0,0,0 short=0,0,0,0 dropped=0,0,0,0
    latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
  READ: bw=2490KiB/s (2550kB/s), 2490KiB/s-2490KiB/s (2550kB/s-2550kB/s), io=146MiB (153MB), run=60001-60001msec

Storage Transfer Service を使用してデータを転送する

Storage Transfer Service を使用して、ゾーンバケットと他の Cloud Storage バケット間でデータを転送できます。

必要な権限

Cloud Storage バケット間の転送には、エージェントレス転送の権限に記載されている IAM ロールが必要です。

また、ゾーンバケットは階層型名前空間を使用するため、Storage Transfer Service サービス エージェントに次の IAM 権限を付与する必要があります。

  • ソースがゾーンバケットの場合:

    • エージェントレス転送の権限に記載されている事前定義ロールを使用する場合、追加の操作は必要ありません。必要な権限(storage.folders.list)は、Storage オブジェクト閲覧者(roles/storage.objectViewer)ロールにすでに含まれています。
  • 宛先がゾーンバケットの場合:

    • サービス エージェントに Storage オブジェクト ユーザー(roles/storage.objectUser)ロールを付与する必要があります。これにより、必要な storage.folders.create 権限が付与されます。

サービス エージェントにロールを追加する手順については、以下をご覧ください。

制限事項

  • サポートされている移行:

    • 転送は、ゾーンバケットと他のゾーンバケットを含む他の Cloud Storage ロケーションのバケット間でサポートされています。
  • サポートされていない機能:

    • イベント ドリブン転送
    • クロスバケット レプリケーション
    • エージェント ベースの転送
  • ファイナライズされていないオブジェクト:

    • 未確定のオブジェクトをゾーンバケットから転送する場合、転送の進行中にオブジェクトに加えられた変更が転送先バケットのデータに反映されないことがあります。
    • ファイナライズされていないソース オブジェクトは、転送先バケットでファイナライズ済みとしてマークされます。

転送を作成する

開始するには、Storage Transfer Service を使用して転送を作成するをご覧ください。

次のステップ