挂载端安装s3fs-fuse
apt install s3fs-fuse
https://github.com/s3fs-fuse/s3fs-fuse
挂载minio
https://github.com/lukewaite/cookbook/blob/master/docs/zh_CN/s3fs-fuse-with-minio.md
存放minio的access_key和secret_key
echo "access_key:secret_key" > /etc/s3cred
chmod 600 /etc/s3cred
创建一个挂载目录
mkdir /s3
挂载存储桶
##容器内挂载需要以特权模式启动否则会报错
直接挂载存储桶可能会导致挂载后目录中数据不可见,但是可以进入操作
s3fs <bucket> /s3 -o passwd_file=/etc/s3cred,use_path_request_style,url=http://minio-server:9000 -o allow_other -o umask=000 -o dbglevel=info -f -o curldbg
-
<bucket>为minio中的bucket
-
/etc/s3cred 为存放密钥路径
-
s3fs与Minio一起使用时需要
use_path_request_style。如果您不使用它,则无法在挂载的目录中查看或复制文件。 -
如果只想挂载bucket中的某个目录(容器内部好像没能实现,只能挂载桶)
s3fs <bucket>:/dir /s3 -o passwd_file=/etc/s3cred,use_path_request_style,url=http://minio-server:9000 -o allow_other -o umask=000 -o dbglevel=info -f -o curldbg
检查挂载
mount | grep s3fs
s3fs on /s3 type fuse.s3fs (rw,nosuid,nodev,relatime,user_id=0,group_id=F0)
客户端copy minio文件
#新增minio配置
mc config host add minio http://192.168.2.108:9000 admin abcdefg
#拷贝文件/文件夹
mc cp -r minio/dyg-fzzn/sample /data/