从计算引擎连接

本指南介绍了如何创建单个 Compute Engine 客户端并将其连接到 Parallelstore 实例。

如需从多个 Compute Engine 客户端创建和连接,您可以按照从 Compute Engine 连接:多个客户端中的说明操作。

为了获得更好的性能,客户端 Compute Engine 虚拟机应在 Parallelstore 实例所在的可用区中创建。

所需权限

您必须拥有以下 IAM 角色,才能创建 Compute Engine 虚拟机:

  • Compute Instance Admin (v1) (roles/compute.instanceAdmin.v1)。如需了解详情,请参阅 Compute Engine 文档

创建 Compute Engine 虚拟机

按照说明使用以下某个映像创建 Compute Engine 虚拟机:

您可以选择任何机器类型和启动磁盘。我们建议至少使用 c2-standard-4 机器类型;如需提高客户端性能,请增加 vCPU 数量以提高网络吞吐量。例如,具有 Tier 1 网络的 c3-standard-176 可提供 200 Gbps 的出站流量带宽。

Google Cloud 控制台

  1. 在 Google Cloud 控制台中,前往虚拟机实例页面。

    转到虚拟机实例

  2. 选择您的项目并点击继续

  3. 点击创建实例

  4. 名称中输入虚拟机的名称。如需了解详情,请参阅资源命名惯例

  5. 从下拉菜单中为此虚拟机选择区域可用区。 您的虚拟机应与 Parallelstore 实例位于同一可用区。

  6. 从列表中为您的虚拟机选择机器配置

  7. 启动磁盘部分,点击更改

  8. 选择公共映像标签页。

  9. 操作系统下拉列表中,选择以下选项之一:HPC 虚拟机映像UbuntuDebian

  10. 版本下拉菜单中,选择以下任一选项:HPC Rocky Linux 8Ubuntu 22.04 LTSDebian GNU/Linux 12 (bookworm)。选择 x86/64 版本或 Arm64 版本,以匹配您的机器类型。

  11. 如需确认您的启动磁盘选项,请点击选择

  12. 展开高级选项部分,然后展开网络

  13. 网络接口下,选择您在配置 VPC 网络中创建的 VPC 网络。

  14. 要创建并启动该虚拟机,请点击创建

gcloud

使用 gcloud 命令行工具创建虚拟机:

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 优化版

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 连接到客户端虚拟机

Google Cloud 控制台

如需通过 SSH 连接到 Compute Engine 虚拟机,您必须先创建允许使用 SSH 的防火墙规则。

  1. 在 Google Cloud 控制台中,转到防火墙政策页面。

    转到“防火墙政策”

  2. 点击创建防火墙规则

  3. 为规则输入一个名称

  4. 对于网络,选择您之前创建的 VPC 网络。

  5. 选择入站作为流量方向,并选择允许作为对匹配项执行的操作

  6. 目标下拉菜单中,选择网络中的所有实例

  7. 来源 IPv4 范围字段中,输入 0.0.0.0/0

  8. 协议和端口中,选择指定的协议和端口

  9. 选择 TCP,然后在端口字段中输入 22

  10. 点击创建

然后,通过 SSH 连接到您的虚拟机:

  1. 在 Google Cloud 控制台中,前往虚拟机实例页面。

    转到虚拟机实例

  2. 在实例表格中,找到实例对应的行,然后点击标题为连接的列中的 SSH

  3. 如果系统提示您执行此操作,请点击授权以允许连接。

gcloud

如需通过 SSH 连接到 Compute Engine 虚拟机,您必须先创建允许使用 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 客户端库为 Parallelstore 数据层提供了类似 POSIX 的接口。该软件会在客户端计算机上作为代理运行,您必须先安装并运行该软件,然后才能访问您的数据。

HPC Rocky Linux 8

必须在每个 Compute Engine 虚拟机上执行以下命令。

  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 优化版

必须在每个 Compute Engine 虚拟机上执行以下命令。

  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 虚拟机上执行以下命令。

  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 虚拟机上执行以下命令。

  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 虚拟机上执行以下命令。

  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)

对于运行 Ubuntu 22.04 的虚拟机,您必须将打开文件数限制提高到 131072,才能支持 dfuse 和拦截库。

如果您选择不使用拦截库,则可以改为在启动 dfuse 之前立即运行 ulimit -n 131072

如需将打开文件数限制从 1024 提高,请在每个虚拟机上运行以下命令。

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

然后,重新启动:

sudo reboot

客户端虚拟机重新启动完成后,再次通过 SSH 连接到该虚拟机。

更新 DAOS 代理配置

更新 /etc/daos/daos_agent.yml,具体代码如下所示:

  1. 取消注释 access_points,并使用 Parallelstore 实例属性中的 accessPoints IP 地址更新 access_points。例如: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 命令显示虚拟机的默认网关;要指定的接口通常是与网关共享子网的接口。

    首先,列出所有可用的网络接口:

    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 优化版

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 实例现在会挂载到 -m 标志指定的路径下的 Compute Engine 虚拟机,并且可以使用标准 POSIX 语法进行读取/写入(存在一些例外情况)。

如果您在实例上运行 df,则 SIZE 值为使用 --capacity-gib 指定的值的 1.5 倍。由于 Parallelstore 使用的擦除编码的性质,可用空间量仍为 --capacity-gib。从 df 的角度来看,写入的每个 2 个字节都会使用 3 个字节。

卸载实例

您可以使用以下命令卸载 Parallelstore 实例:

sudo umount /tmp/parallelstore/

后续步骤