最近在搭建GPUStack集群用于推理,目前想法是基于共享目录存放模型文件,使得每个GPU服务器都能读取。
基于NFS进行文件共享
关于NFS服务器略过,只是给出NFS挂载配置:
/path/to/share *(rw,sync,no_subtree_check,no_root_squash)
挂载选项说明:
- ro: 只读访问
- rw: 读写访问
- sync: 同步写数据
- async: 异步写入数据
- secure: NFS通过1024以下的安全TCP/IP端口发送
- insecure: NFS通过1024以上的端口发送
- wdelay: 如果多个用户要写入NFS目录,则归组写入(默认)
- no_wdelay: 如果多个用户要写入NFS目录,则立即写入,当使用async时,无需此设置。
- hide: 在NFS共享目录中不共享其子目录
- no_hide: 共享NFS目录的子目录
- subtree_check: 如果共享/usr/bin之类的子目录时,强制NFS检查父目录的权限(默认)
- no_subtree_check: 和上面相对,不检查父目录权限
- all_squash: 共享文件的UID和GID映射匿名用户anonymous,适合公用目录。
- no_all_squash: 保留共享文件的UID和GID(默认)
- root_squash: root用户的所有请求映射成如anonymous用户一样的权限(默认)
- no_root_squas: root用户具有根目录的完全管理访问权限
- anonuid=xxx: 指定NFS服务器/etc/passwd文件中匿名用户的UID
- anongid=xxx: 指定NFS服务器/etc/passwd文件中匿名用户的GID
docker-compose.yml配置举例:
services:
<service_name>:
image: <container_image>
volumes:
- <nfs_volume_name>:/path/to/mount
volumes:
<nfs_volume_name>:
driver: local
driver_opts:
type: nfs
o: addr=<nfs_srv_addr>,nolock,soft,rw
device: :/nfs/srv/share/path
基于GlusterFS进行文件共享
docker-compose.yml配置举例:
services:
<service_name>:
image: <container_image>
volumes:
- <glusterfs_volume_name>:/path/to/mount
Volumes:
<glusterfs_volume_name>:
Driver: glusterfs
Driver_opts:
Endpoint: <gluster_server_addr>:/path/to/gluster/volume
基于iSCSI进行文件共享
services:
<service_name>:
image: <container_image>
volumes:
- <iscsi_volume_name>:/path/to/mount
Volumes:
<iscsi_volume_name>:
Driver: iscsi
Driver_opts:
Target: iqn.2025-01.org.iscsi_srv:volume-00000001
Portal: <srv_addr>:3260
Initiator: iqn.1994-05.com.redhat:c7a56f143216
说明:以上Target和Initiator都是举例说明,请根据实际情况配置对应的名字。
基于SSHFS进行文件共享
services:
<service_name>:
image: <container_image>
volumes:
- <sshfs_volume_name>:/path/to/mount
Volumes:
<sshfs_volume_name>:
Driver: sshfs
Driver_opts:
Sshcmd: <user>@<sshfs_server>:/path/to/sshfs/share
Password: <user_password>