搭建一个服务器
cd /home1/seaweeddir
mkdir {mtmp,vtmp1,vtmp2,ftmp,mountdir}
weed scaffold -config=filer -output=.
vim filer.toml (修改leveldb的dir为"./ftmp")
weed master -ip=localhost -port=9333 -mdir=./mtmp
weed volume -dataCenter=imgdatacenter1 -rack=imgrack1 -ip=localhost -port=9991 -dir=./vtmp1 -max=10 -mserver=localhost:9333
weed filer -ip=localhost -port=8888 -master=localhost:9333 -collection=test
sudo weed mount -filer=localhost:8888 -dir=/home1/seaweeddir/mountdir -filer.path=/ -collection=test
//关闭服务后执行 sudo umount -l /home1/seaweeddir/mountdir 取消挂载
//此时就可以使用filer通过web操作文件了,而且也可以通过/home1/seaweeddir/mountdir本地操作文件了。
//或者这么理解,sudo weed mount只能用sudo umount -l 取消挂载,而不是直接kill进程。
其中mount只是为了本地操作方便,不想本地操作,可以不使用mount
初始化
假设我这10个volume,我预分配1个给人员库 staff,6个预分配给摄像机camera,其他的保留通用数据。
curl "http://localhost:9333/vol/grow?collection=staff&count=1"
curl "http://localhost:9333/vol/grow?collection=camera&count=6"
上传文件
这里测试往staff文件集里面添加图片:
curl -F file=@1.jpeg "http://localhost:8888/staff/newimg_1.jpeg?collection=staff" //单个文件上传
weed filer.copy -collection=staff /home1/image/staff http://localhost:8888/staff //并发批量上传
删除filer中的文件和文件夹
curl -X DELETE http://localhost:8888/path/to/file
curl -X DELETE http://localhost:8888/path/to/dir?recursive=true
删除collection
curl "http://localhost:9333/col/delete?collection=xxx&pretty=y"
清理空间,使删除立马生效
curl "http://localhost:9333/vol/vacuum"
查看状态
curl "http://localhost:9333/cluster/status?pretty=y"
curl "http://localhost:9333/dir/status?pretty=y"
curl "http://localhost:9991/status?pretty=y"
curl -H "Accept: application/json" "http://localhost:8888/?pretty=y"
网友评论