seaweedfs
最新版本:https://github.com/chrislusf/seaweedfs/releases
wiki:https://github.com/chrislusf/seaweedfs/wiki
优秀讲解:https://tonybai.com/2015/08/22/intro-of-using-weedfs/
./weed master
> weed volume -dir="/tmp/data1" -max=5 -mserver="localhost:9333" -port=8080 &
> weed volume -dir="/tmp/data2" -max=10 -mserver="localhost:9333" -port=8081 &
> curl http://localhost:9333/dir/assign
{"count":1,"fid":"3,01637037d6","url":"127.0.0.1:8080","publicUrl":"localhost:8080"}
> curl -F file=@/home/chris/myphoto.jpg http://127.0.0.1:8080/3,01637037d6
{"size": 43234}
> curl http://localhost:9333/dir/lookup?volumeId=3
{"locations":[{"publicUrl":"localhost:8080","url":"localhost:8080"}]}
http://localhost:8080/3,01637037d6.jpg
weed -v=3 master -port=9333 -mdir=./m1 -defaultReplication=001
weed -v=3 volume -port=8081 -dir=./v1 -mserver=localhost:9333 -dataCenter=dc1
weed -v=3 volume -port=8082 -dir=./v2 -mserver=localhost:9333 -dataCenter=dc1
curl -F filename=@hello1.txt "http://localhost:9333/submit"
.net 调用虽然wiki中有相关插件,但是缺少大文件上传的实现。
https://github.com/chrislusf/seaweedfs/wiki/Large-File-Handling
seaweedfs上传大文件需要自己将大文件分片上传,然后构建manifest json文件记录分片的文件信息
type ChunkInfo struct {
Fid string `json:"fid"`
Offset int64 `json:"offset"`
Size int64 `json:"size"`
}
type ChunkList []*ChunkInfo
type ChunkManifest struct {
Name string `json:"name,omitempty"`
Mime string `json:"mime,omitempty"`
Size int64 `json:"size,omitempty"`
Chunks ChunkList `json:"chunks,omitempty"`
}
本文采用 知识共享署名 4.0 国际许可协议 进行许可