SeaweedFS部署及使用指南

2019-06-10  本文已影响0人  热心肠的徐同学

相关概念:

定义名称 说明
master 提供volume=>location 位置映射服务和文件id的序列号
Node 系统抽象的节点,抽象为DataCenter、Rack
DataCenter 数据中心,对应现实中的不同机架
Rack 机架,对应现实中的机柜,一个机架属于特定的数据中心,一个数据中心可以包含多个机架。
Volume 逻辑卷,存储的逻辑结构,逻辑卷下存储Needle,A VolumeServer contains one Store
Needle 逻辑卷中的Object,对应存储的文件, Needle file size is limited to 4GB for now.
Filer 文件管理器,Filer将数据上传到Weed Volume Servers,并将大文件分成块,将元数据和块信息写入Filer存储区
Collection 文件集,可以分布在多个逻辑卷上,如果在存储文件的时候没有指定collection,那么使用默认的""
Mount 用户空间,当filer与mount一起使用时,filer仅提供文件元数据检索,实际文件内容直接在mount和volume服务器之间读写,所以不需要多个filer

部署规划:

节点 master volume filer
192.168.88.129
192.168.88.130
192.168.88.131

解压:

启动前准备:

mkdir -p ./seaweedfs/data ./seaweedfs/volume

配置运行master

nohup ./weed master -ip=192.168.88.129 -port=9333 -mdir=./seaweedfs/data -peers=192.168.88.129:9333,192.168.88.130:9333,192.168.88.131:9333 > ./seaweedfs/data/master.log &
nohup ./weed master -ip=192.168.88.130 -port=9333 -mdir=./seaweedfs/data -peers=192.168.88.129:9333,192.168.88.130:9333,192.168.88.131:9333 > ./seaweedfs/data/master.log &
nohup ./weed master -ip=192.168.88.131 -port=9333 -mdir=./seaweedfs/data -peers=192.168.88.129:9333,192.168.88.130:9333,192.168.88.131:9333 > ./seaweedfs/data/master.log &

配置运行volume

nohup ./weed volume -dataCenter dc1 -rack rack1 -dir ./seaweedfs/volume -ip 192.168.88.129 -port 9222 -ip.bind 192.168.88.129 -max 20 -mserver 192.168.88.129:9333,192.168.88.130:9333,192.168.88.131:9333 -publicUrl 192.168.88.129:9222 > ./seaweedfs/volume/volume.log &
nohup ./weed volume -dataCenter dc1 -rack rack1 -dir ./seaweedfs/volume -ip 192.168.88.130 -port 9222 -ip.bind 192.168.88.130 -max 20 -mserver 192.168.88.129:9333,192.168.88.130:9333,192.168.88.131:9333 -publicUrl 192.168.88.130:9222 > ./seaweedfs/volume/volume.log &
nohup ./weed volume -dataCenter dc1 -rack rack1 -dir ./seaweedfs/volume -ip 192.168.88.131 -port 9222 -ip.bind 192.168.88.131 -max 20 -mserver 192.168.88.129:9333,192.168.88.130:9333,192.168.88.131:9333 -publicUrl 192.168.88.130:9222 > ./seaweedfs/volume/volume.log &

测试上传下载

curl http://192.168.88.129:9333/dir/assign

{"fid":"14,0c3657515f","url":"192.168.88.129:9222","publicUrl":"192.168.88.129:9222","count":1}

curl -F file=@./seaweedfs/volume/volume.log 192.168.88.129:9222/14,0c3657515f


配置运行Filer并挂载到本地目录

Filer允许以另一种方式上传文件

mkdir -p /etc/seaweedfs
cd /etc/seaweedfs
touch filer.toml
mkdir -p /opt/module/filer_path/level

/opt/module/weed scaffold filer -output="" 打印出的内容写入到 filer.toml中, 并且修改其中的配置

dir = "/opt/module/filer_path/level"

可以使用文件, MySQL, redis等保存 filer的元数据信息, 只需要启用或者停用对应的配置,具体请参考https://github.com/chrislusf/seaweedfs/wiki/Filer-Server-API

./weed filer -master=192.168.88.129:9333,192.168.88.130:9333,192.168.88.131:9333 -ip=192.168.88.129 -port=8888&
./weed filer -master=192.168.88.129:9333,192.168.88.130:9333,192.168.88.131:9333 -ip=192.168.88.130 -port=8888&
./weed filer -master=192.168.88.129:9333,192.168.88.130:9333,192.168.88.131:9333 -ip=192.168.88.131 -port=8888&

mount挂载

mkdir -p ./seaweedfs/data/mount
./weed mount -filer=192.168.88.129:8888 -dir=./seaweedfs/data/mount &

执行命令后,便可看到通过filer上传的文件已经挂载到了本地/seaweedfs/data/mount目录下.
具体信息以官方wiki为主.

上一篇下一篇

猜你喜欢

热点阅读