Docker Swarm 进阶:NFS 共享数据卷

 2023-09-16 阅读 17 评论 0

摘要:启动 NFS 服务(CentOS 7) 首先,安装 rpcbind 和 nfs-utils yum install -y rpcbind nfs-utils 然后,编辑/etc/exports配置 NFS 共享目录,示例: [root@VM_0_5_centos ~]# cat /etc/exports /root/share *(rw,sync,all_squash,an

启动 NFS 服务(CentOS 7)

首先,安装 rpcbind 和 nfs-utils

yum install -y rpcbind nfs-utils

然后,编辑 /etc/exports 配置 NFS 共享目录,示例:

[root@VM_0_5_centos ~]# cat /etc/exports
/root/share *(rw,sync,all_squash,anonuid=0,anongid=0)

更多详细配置参考 https://www.centos.bz/2017/07/centos7-1-install-nfs/

启动 rpcbind 和 nfs

sudo service rpcbind startsudo service nfs start

查看共享的目录

exportfs

修改配置文件后,重新加载配置文件

exportfs -vr

视频演示:https://www.youtube.com/watch?v=_4XudYZ6M_k

创建 NFS 数据卷

docker volume create --driver local \--opt type=nfs \--opt o=addr=<NFS-Server>,rw \--opt device=:<Shared-Path> \share

创建多副本服务

docker service create \--mount type=volume,source=<Volume-Name>,destination=<Container-Path> \--replicas 2 \<Image>

补充说明

注意读写分离,避免多写导致未知的错误

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/5/66939.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息