從 Compute Engine 連線

本指南說明如何建立單一 Compute Engine 用戶端,並將其連線至 Parallelstore 執行個體。

如要從多個 Compute Engine 用戶端建立及連線,請按照「從 Compute Engine 連線:多個用戶端」一文中的說明操作。

為提升效能,請在與 Parallelstore 執行個體相同的區域中建立用戶端 Compute Engine VM。

所需權限

如要建立 Compute Engine VM,您必須具備下列 IAM 角色:

建立 Compute Engine VM

請按照操作說明,使用下列任一映像檔建立 Compute Engine VM:

您可以選擇任何機器類型和開機磁碟。建議至少使用 c2-standard-4 機器類型;如要提升用戶端效能,請增加 vCPU 數量,以提高網路總處理量。舉例來說,c3-standard-176 搭配 Tier 1 網路可提供 200 Gbps 的輸出頻寬。

Google Cloud 控制台

  1. 前往 Google Cloud 控制台的「VM instances」(VM 執行個體) 頁面

    前往 VM 執行個體

  2. 選取您的專案並點選 [繼續]

  3. 點選「建立執行個體」

  4. 在「Name」(名稱) 中輸入 VM 名稱。詳情請參閱資源命名慣例

  5. 從下拉式選單中,選取這個虛擬機的「Region」(地區) 和「Zone」(區域)。 VM 應與 Parallelstore 執行個體位於相同可用區。

  6. 從清單中選取 VM 的「Machine configuration」(機器設定)

  7. 在「Boot disk」(開機磁碟) 區段,按一下 [Change] (變更)

  8. 選取「Public images」(公開映像檔) 分頁標籤。

  9. 從「Operating system」(作業系統) 下拉式選單中,選取「HPC VM image」(HPC VM 映像檔)、「Ubuntu」或「Debian」

  10. 從「版本」下拉式選單中,選取下列其中一個選項:「HPC Rocky Linux 8」、「Ubuntu 22.04 LTS」或「Debian GNU/Linux 12 (bookworm)」。請選取 x86/64 或 Arm64 版本,與您的機器類型相符。

  11. 如要確認開機磁碟選項,請按一下「Select」(選取)

  12. 依序展開「Advanced Options」(進階選項) 和「Networking」(網路)

  13. 在「網路介面」下方,選取您在「設定虛擬私有雲網路」中建立的虛擬私有雲網路。

  14. 如要建立並啟動 VM,請按一下 [Create] (建立)

gcloud

使用 gcloud 指令列工具建立 VM:

HPC Rocky Linux 8

gcloud compute instances create VM_NAME \
  --project=PROJECT_ID \
  --zone=LOCATION \
  --machine-type=c2d-standard-112 \
  --network-interface=stack-type=IPV4_ONLY,subnet=NETWORK_NAME,nic-type=GVNIC \
  --network-performance-configs=total-egress-bandwidth-tier=TIER_1 \
  --create-disk=auto-delete=yes,boot=yes,device-name=VM_NAME,\
image=projects/cloud-hpc-image-public/global/images/hpc-rocky-linux-8-v20240126,\
mode=rw,size=100,type=pd-balanced

Rocky Linux 9 Optimized

gcloud compute instances create VM_NAME \
  --project=PROJECT_ID \
  --zone=LOCATION \
  --machine-type=c2d-standard-112 \
  --network-interface=stack-type=IPV4_ONLY,subnet=NETWORK_NAME,nic-type=GVNIC \
  --network-performance-configs=total-egress-bandwidth-tier=TIER_1 \
  --create-disk=auto-delete=yes,boot=yes,device-name=VM_NAME,\
image=projects/rocky-linux-cloud/global/images/rocky-linux-9-optimized-gcp-v20241112,\
mode=rw,size=100,type=pd-balanced

RHEL 9

gcloud compute instances create VM_NAME \
  --project=PROJECT_ID \
  --zone=LOCATION \
  --machine-type=c2d-standard-112 \
  --network-interface=stack-type=IPV4_ONLY,subnet=NETWORK_NAME,nic-type=GVNIC \
  --network-performance-configs=total-egress-bandwidth-tier=TIER_1 \
  --create-disk=auto-delete=yes,boot=yes,device-name=VM_NAME,\
image=projects/rhel-cloud/global/images/rhel-9-v20241112,\
mode=rw,size=100,type=pd-balanced

Ubuntu 22.04

gcloud compute instances create VM_NAME \
  --project=PROJECT_ID \
  --zone=LOCATION \
  --machine-type=c2d-standard-112 \
  --network-interface=stack-type=IPV4_ONLY,subnet=NETWORK_NAME,nic-type=GVNIC \
  --network-performance-configs=total-egress-bandwidth-tier=TIER_1 \
  --create-disk=auto-delete=yes,boot=yes,device-name=VM_NAME,\
image=projects/ubuntu-os-cloud/global/images/ubuntu-2204-jammy-v20240927,\
mode=rw,size=100,type=pd-balanced

Debian 12

gcloud compute instances create VM_NAME \
  --project=PROJECT_ID \
  --zone=LOCATION \
  --machine-type=c2d-standard-112 \
  --network-interface=stack-type=IPV4_ONLY,subnet=NETWORK_NAME,nic-type=GVNIC \
  --network-performance-configs=total-egress-bandwidth-tier=TIER_1 \
  --create-disk=auto-delete=yes,boot=yes,device-name=VM_NAME,\
image=projects/debian-cloud/global/images/debian-12-bookworm-v20240415,\
mode=rw,size=100,type=pd-balanced

如要進一步瞭解可用選項,請參閱 Compute Engine 說明文件

透過 SSH 連線至用戶端 VM

Google Cloud 控制台

如要透過 SSH 連線至 Compute Engine VM,請先建立允許 SSH 的防火牆規則。

  1. 在 Google Cloud 控制台中,前往「Firewall policies」(防火牆政策) 頁面。

    前往「防火牆政策」頁面

  2. 點按「建立防火牆規則」

  3. 輸入規則的「Name」(名稱)

  4. 在「Network」(網路) 中,選取您先前建立的虛擬私有雲端網路。

  5. 選取「Ingress」(輸入) 做為「Direction of traffic」(流量方向),並選取「Allow」(允許) 做為「Action on match」(相符時執行的動作)

  6. 從「Targets」(目標) 下拉式選單中,選取「All instances in the network」(網路中的所有執行個體)

  7. 在「Source IPv4 ranges」(來源 IPv4 範圍) 欄位中輸入 0.0.0.0/0

  8. 在「Protocols and ports」(通訊協定和通訊埠) 中,選取「Specified protocols and ports」(指定的通訊協定和通訊埠)

  9. 選取「TCP」,然後在「Ports」欄位中輸入 22

  10. 點選「建立」

然後透過 SSH 連線至 VM:

  1. 前往 Google Cloud 控制台的「VM instances」(VM 執行個體) 頁面

    前往 VM 執行個體

  2. 在執行個體表格中找到執行個體的資料列,然後按一下「Connect」(連線) 欄中的「SSH」

  3. 如果系統提示您授權,請點選「授權」,允許連線。

gcloud

如要透過 SSH 連線至 Compute Engine VM,請先建立允許 SSH 的防火牆規則。

gcloud compute firewall-rules create FIREWALL_RULE_NAME \
  --allow=tcp:22 \
  --network=NETWORK_NAME \
  --source-ranges=0.0.0.0/0 \
  --project=PROJECT_ID

然後使用 gcloud compute ssh 連線:

gcloud compute ssh VM_NAME --zone=ZONE --project=PROJECT_ID

安裝 DAOS 用戶端程式庫

DAOS 用戶端程式庫提供類似 POSIX 的介面,可存取 Parallelstore 資料層。這項軟體會在用戶端電腦上以代理程式的形式執行,您必須先安裝並執行軟體,才能存取資料。

HPC Rocky Linux 8

您必須在每個 Compute Engine VM 上執行下列指令。

  1. 新增 Parallelstore 套件存放區:

    sudo tee /etc/yum.repos.d/parallelstore-v2-6-el8.repo << EOF
    [parallelstore-v2-6-el8]
    name=Parallelstore EL8 v2.6
    baseurl=https://us-central1-yum.pkg.dev/projects/parallelstore-packages/v2-6-el8
    enabled=1
    repo_gpgcheck=0
    gpgcheck=0
    EOF
    
  2. 更新本機中繼資料快取:

    sudo dnf makecache
    
  3. 安裝 daos-client

    sudo dnf install -y epel-release && \
    sudo dnf install -y daos-client
    
  4. 升級 libfabric

    sudo dnf upgrade -y libfabric
    

Rocky Linux 9 Optimized

您必須在每個 Compute Engine VM 上執行下列指令。

  1. 新增 Parallelstore 套件存放區:

    sudo tee /etc/yum.repos.d/parallelstore-v2-6-el9.repo << EOF
    [parallelstore-v2-6-el9]
    name=Parallelstore EL9 v2.6
    baseurl=https://us-central1-yum.pkg.dev/projects/parallelstore-packages/v2-6-el9
    enabled=1
    repo_gpgcheck=0
    gpgcheck=0
    EOF
    
  2. 更新本機中繼資料快取:

    sudo dnf makecache
    
  3. 安裝 daos-client

    sudo dnf install -y epel-release && \
    sudo dnf install -y daos-client
    
  4. 升級 libfabric

    sudo dnf upgrade -y libfabric
    

RHEL 9

您必須在每個 Compute Engine VM 上執行下列指令。

  1. 新增 Parallelstore 套件存放區:

    sudo tee /etc/yum.repos.d/parallelstore-v2-6-el9.repo << EOF
    [parallelstore-v2-6-el9]
    name=Parallelstore EL9 v2.6
    baseurl=https://us-central1-yum.pkg.dev/projects/parallelstore-packages/v2-6-el9
    enabled=1
    repo_gpgcheck=0
    gpgcheck=0
    EOF
    
  2. 更新本機中繼資料快取:

    sudo dnf makecache
    
  3. 安裝 daos-client

    sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
    
    sudo dnf install -y epel-release && \
    sudo dnf install -y daos-client
    
  4. 升級 libfabric

    sudo dnf upgrade -y libfabric
    

Ubuntu 22.04

您必須在每個 Compute Engine VM 上執行下列指令。

  1. 新增 Parallelstore 套件存放區:

    curl https://us-central1-apt.pkg.dev/doc/repo-signing-key.gpg | sudo apt-key add -
    echo "deb https://us-central1-apt.pkg.dev/projects/parallelstore-packages v2-6-deb main" | sudo tee -a /etc/apt/sources.list.d/artifact-registry.list
    
  2. 更新套件索引:

    sudo apt update
    
  3. 安裝 daos-client

    sudo apt install -y daos-client
    

Debian 12

您必須在每個 Compute Engine VM 上執行下列指令。

  1. 新增 Parallelstore 套件存放區:

    curl https://us-central1-apt.pkg.dev/doc/repo-signing-key.gpg | sudo apt-key add -
    echo "deb https://us-central1-apt.pkg.dev/projects/parallelstore-packages v2-6-deb main" | sudo tee -a /etc/apt/sources.list.d/artifact-registry.list
    
  2. 更新套件索引:

    sudo apt update
    
  3. 安裝 daos-client

    sudo apt install -y daos-client
    

提高開啟檔案的數量上限 (僅限 Ubuntu)

如果 VM 執行的是 Ubuntu 22.04,您必須將開啟檔案的上限提高至 131072,才能支援 dfuse 和攔截程式庫。

如果您選擇不使用攔截程式庫,也可以在啟動 dfuse 之前立即執行 ulimit -n 131072

如要將開啟檔案數量上限從 1024 提高,請在每個 VM 上執行下列指令。

sudo tee -a /etc/security/limits.conf <<EOF
* soft nofile 131072
* hard nofile 131072
EOF

接著重新啟動:

sudo reboot

用戶端 VM 重新啟動後,再次透過 SSH 連線。

更新 DAOS 代理程式設定

請按照下列方式更新 /etc/daos/daos_agent.yml

  1. 取消註解並更新 access_points,使用 Parallelstore 執行個體屬性的 accessPoints IP 位址。例如:access_points: ['172.21.95.2', '172.21.95.4', '172.21.95.5']

    如要以正確格式列印存取點,以便複製及貼上,請執行下列指令:

    echo access_points\: $(gcloud beta parallelstore instances describe \
      INSTANCE_ID --location LOCATION --project PROJECT_ID \
      --format "value[delimiter=', '](format("{0}", accessPoints))")
    
  2. 取消註解下列兩行。縮排很重要,請務必保留 allow_insecure 前方的空格:

    # transport_config:
    #   allow_insecure: false
    
  3. allow_insecure 的值變更為 true,因為系統不支援憑證。

     transport_config:
       allow_insecure: true
    
  4. 指定提供 Parallelstore 執行個體連線的網路介面。介面通常是 eth0ens4enp0s3,但視網路設定而定,也可能有所不同。您可以使用 route 指令顯示 VM 的預設閘道;要指定的介面通常是與閘道共用子網路的介面。

    首先,列出所有可用的網路介面:

    ip a
    

    輸出結果會與下列內容相似:

    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
    2: eth0@if7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc noqueue state UP group default
        link/ether e4:9x:3f:x7:dx:f7 brd ff:ff:ff:ff:ff:ff link-netnsid 0
        inet 10.88.0.3/16 brd 10.88.255.255 scope global eth0
           valid_lft forever preferred_lft forever
    3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1460 qdisc noqueue state DOWN group default
        link/ether 02:4x:6y:1z:84:45 brd ff:ff:ff:ff:ff:ff
        inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
           valid_lft forever preferred_lft forever
    

    執行 route 顯示路由表:

    route
    

    輸出結果會與下列內容相似:

    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    default         10.88.0.1       0.0.0.0         UG    0      0        0 eth0
    10.88.0.0       0.0.0.0         255.255.0.0     U     0      0        0 eth0
    172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
    

    在這個範例中,預設閘道為 10.88.0.1,且由 eth0 共用,因此請將 eth0 指定為要使用的介面。

    編輯「/etc/daos/daos_agent.yml」。取消註解 include_fabric_ifaces 並更新值:

    include_fabric_ifaces: ["eth0"]
    

    儲存並關閉檔案。

啟動 DAOS 代理程式

HPC Rocky Linux 8

sudo systemctl start daos_agent.service

您可以檢查狀態,確認代理程式是否正在執行:

systemctl status daos_agent.service

Rocky Linux 9 Optimized

sudo systemctl start daos_agent.service

您可以檢查狀態,確認代理程式是否正在執行:

systemctl status daos_agent.service

RHEL 9

sudo systemctl start daos_agent.service

您可以檢查狀態,確認代理程式是否正在執行:

systemctl status daos_agent.service

Ubuntu 22.04

sudo mkdir /var/run/daos_agent && \
sudo daos_agent -o /etc/daos/daos_agent.yml &

Debian 12

sudo mkdir /var/run/daos_agent && \
sudo daos_agent -o /etc/daos/daos_agent.yml &

設定記錄功能

視需要設定本機記錄功能,協助進行用戶端偵錯:

export D_LOG_MASK=INFO
export D_LOG_FILE_APPEND_PID=1
rm -f /tmp/client.log.*
export D_LOG_FILE=/tmp/client.log

使用 dfuse 掛接執行個體

使用 dfuse (DAOS FUSE) 掛接 Parallelstore 執行個體。

  1. 編輯 /etc/fuse.conf 以新增 user_allow_other

  2. 使用 dfuse 指定 --multi-user 選項:

    mkdir -p /tmp/parallelstore
    dfuse -m /tmp/parallelstore \
      --pool default-pool \
      --container default-container \
      --disable-wb-cache \
      --thread-count=20 \
      --eq-count=10 \
      --multi-user
    

如要瞭解如何最佳化 --thread-count--eq-count 的值,請參閱「效能考量」頁面的「執行緒計數和事件佇列計數」一節。

存取 Parallelstore 執行個體

Parallelstore 執行個體現在已掛接至 Compute Engine VM,路徑由 -m 標記指定,且可使用標準 POSIX 語法讀取/寫入,但有部分例外狀況

如果您在執行個體上執行 df,則 SIZE 值為以 --capacity-gib 指定值的 1.5 倍。由於 Parallelstore 使用的抹除編碼性質,可用空間量仍為 --capacity-gib。從 df 的角度來看,每寫入 2 個位元組就會使用 3 個位元組。

卸載執行個體

您可以使用下列指令卸載 Parallelstore 執行個體:

sudo umount /tmp/parallelstore/

後續步驟