当前位置: 首页 > 工具软件 > SeaweedFS > 使用案例 >

seaweedfs使用总结

高鸿振
2023-12-01

优势:

存储小文件,占用空间小,性能比 fastDfs 好

在逻辑上Seaweedfs的几个概念:

  • Node 系统抽象的节点,抽象为DataCenter、Rack、DataNode
  • DataCenter 数据中心,对应现实中的不同机房
  • Rack 机架,对应现实中的机柜
  • Datanode 存储节点,用于管理、存储逻辑卷
  • Volume 逻辑卷,存储的逻辑结构,逻辑卷下存储Needle
  • Needle 逻辑卷中的Object,对应存储的文件
  • Collection 文件集,可以分布在多个逻辑卷上

安装:

yum info golang
wget https://github.com/chrislusf/seaweedfs/releases/download/0.96/linux_amd64.tar.gz
tar -zxf linux_amd64.tar.gz

启动

./weed -h  查看帮助
启动 master
nohup /home/dev/go/gopath/weed master -mdir=/home/dev/go/sea/data -port=9333 -defaultReplication="001" -ip="10.66.220.*" &>> /home/dev/go/sea/logs/master.log &

启动三个 volume
nohup /home/dev/go/gopath/weed volume -dir=/home/dev/go/sea/vol/vol1 -mserver="10.66.220.*:9333" -port=8081 -ip="10.66.220.*" &>>/home/dev/go/sea/logs/vol1.log &
nohup /home/dev/go/gopath/weed volume -dir=/home/dev/go/sea/vol/vol2 -mserver="10.66.220.*:9333" -port=8082 -ip="10.66.220.*" &>>/home/dev/go/sea/logs/vol2.log &
nohup /home/dev/go/gopath/weed volume -dir=/home/dev/go/sea/vol/vol3 -mserver="10.66.220.*:9333" -port=8083 -ip="10.66.220.*" &>>/home/dev/go/sea/logs/vol3.log &

上传文件:

 curl http://10.66.220.38:9333/dir/assign
 curl -F "file=/home/dev/mail.py" 10.66.220.38:8082/2,01f9865716

其他api

# specify a specific replication

curl "http://localhost:9333/vol/grow?replication=000&count=4"

{"count":4}

# specify a collection

curl "http://localhost:9333/vol/grow?collection=turbo&count=4"

# specify data center

curl "http://localhost:9333/vol/grow?dataCenter=dc1&count=4"

# specify ttl

curl "http://localhost:9333/vol/grow?ttl=5d&count=4"

* Check Volume Server Status

    curl "[http://localhost:8080/status?pretty=y](http://localhost:8080/status?pretty=y)”
  • Look up volume
curl "http://localhost:9333/dir/lookup?volumeId=3&pretty=y"

# Other usages:

# You can actually use the file id to lookup, if you are lazy to parse the file id.

curl "http://localhost:9333/dir/lookup?volumeId=3,01637037d6"

# If you know the collection, specify it since it will be a little faster

curl "http://localhost:9333/dir/lookup?volumeId=3&collection=turbo"

With "weed mount", the files can be operated as a local file.
Weed Mount Architecture

  • FUSE:用户空间文件系统(Filesystem in Userspace),是Linux 中用于挂载某些网络空间,如SSH,到本地文件系统的模块

SeaweedFS命令集:

benchmark
backup  
compact
filer
fix
server
master
filer
s3
upload
download
shell
version
volume
export
mount
 类似资料: