Seaweedfs基本操作

本文介绍了Seaweedfs的基本操作,包括文件上传、下载、删除、卷管理以及设置超时时间等。提供了针对master和volume的各种API调用示例,如自动分配文件ID、查找卷地址、创建和删除volume、挂载与卸载volume等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

客户端服务:

(只能针对master,不能针对volume)

1)获取一个自动分配的id,唯一的文件标示(如果开始没有volumeid,则第一次执行会创建)

    curl http://localhost:9333/dir/assign


2)查看卷id为4所在的地址(针对存在多个volume)

    curl http://localhost:9333/dir/lookup?volumeId=3


3)将myphoto.jpg上传到服务器

    curl -F file=@/home/chris/myphoto.jpg http://127.0.0.1:8080/3,01637037d6


4)将myphoto.jpg进行存储

curl -F file=@/home/chris/myphoto.jpg http://localhost:9333/submit


5)创建volume数据块

curl -F file=@hello.txt "http://localhost:9333/submit?collection=picture."

curl http://master:9333/dir/assign?collection=pictures





(可以针对volume)

1)删除fid为“3,01637037d6”的数据

curl -X DELETE http://127.0.0.1:8080/3,01637037d6


2)集合删除

curl "http://localhost:8080/admin/delete_collection?collection=some_collection_name."


3)删除某个volumeid

curl "http://localhost:8080/admin/volume/delete?volume=volumeId"


4)挂载volumeId

curl "http://localhost:8080/admin/volume/unmount?volume=volumeId"


5)卸载volumeId

curl "http://localhost:8080/admin/volume/mount?volume=volumeId"


6)查看8080对应volume服务的状态

curl "http://localhost:8080/status?pretty=y"


7)指定数据中心

http://localhost:9333/dir/assign?dataCenter=dc1


8)设置超时时间

curl http://localhost:9333/dir/assign?ttl=3m

curl -F "file=@x.go" http://127.0.0.1:8080/5,01637037d6?ttl=3m

时间单位:

'm', 'h', 'd', 'w', 'M', 'y'.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值