软件版本:
软件 | 版本 | 压缩包包名 |
---|---|---|
seaweedfs | seaweedfs-1.11 | linux_amd64.tar.gz |
GitHub:
https://github.com/chrislusf/seaweedfs
相关定义说明:
定义名称 | 说明 |
---|---|
master | 提供volume=>location 位置映射服务和文件id的序列号 |
Node | 系统抽象的节点,抽象为DataCenter、Rack |
Datanode | 存储节点,用于管理、存储逻辑卷 |
DataCenter | 数据中心,对应现实中的不同机架 |
Rack | 机架,对应现实中的机柜,一个机架属于特定的数据中心,一个数据中心可以包含多个机架。 |
Volume | 逻辑卷,存储的逻辑结构,逻辑卷下存储Needle,A VolumeServer contains one Store |
Needle | 逻辑卷中的Object,对应存储的文件, Needle file size is limited to 4GB for now. |
Collection | 文件集,可以分布在多个逻辑卷上,如果在存储文件的时候没有指定collection,那么使用默认的"" |
Filer | 文件管理器,Filer将数据上传到Weed Volume Servers,并将大文件分成块,将元数据和块信息写入Filer存储区。 |
Mount | 用户空间,当filer与mount一起使用时,filer仅提供文件元数据检索,实际文件内容直接在mount和volume服务器之间读写,所以不需要多个filer |
使用 $ ./weed -h 查看命令及说明
使用 $ ./weed [command] -h 查看命令参数及说明
部署规划:
节点 | master | volume | filer |
---|---|---|---|
cdh1 | √ | √ | √ |
cdh2 | √ | √ | √ |
cdh3 | √ | √ | √ |
解压:
$ tar -zxvf ./linux_amd64.tar.gz
得到 weed 文件
启动命令:
创建文件夹:
$ mkdir seaweedfd_master
$ mkdir seaweedfd_data
启动master命令:
$ ./weed master -ip cdh1 -maxCpu 1 -mdir ./seaweedfd_master -peers cdh1:9333,cdh2:9333,cdh3:9333 -port 9333 -pulseSeconds 5 -defaultReplication 001
$ ./weed master -ip cdh2 -maxCpu 1 -mdir ./seaweedfd_master -peers cdh1:9333,cdh2:9333,cdh3:9333 -port 9333 -pulseSeconds 5 -defaultReplication 001
$ ./weed master -ip cdh3 -maxCpu 1 -mdir ./seaweedfd_master -peers cdh1:9333,cdh2:9333,cdh3:9333 -port 9333 -pulseSeconds 5 -defaultReplication 001
避免脑裂:Only odd number of masters are supported!
后台运行:$ nohup ./weed master -ip cdh3 -maxCpu 1 -mdir ./seaweedfd_master -peers cdh1:9333,cdh2:9333,cdh3:9333 -port 9333 -pulseSeconds 5 -defaultReplication 001 > weed_master.out &
想对外提供服务必须存活两台master
启动volume:
$ ./weed volume -dataCenter dc1 -dir ./seaweedfd_data -ip cdh1 -ip.bind cdh1 -maxCpu 1 -mserver cdh1:9333,cdh2:9333,cdh3:9333 -port 9222 -port.public 9222 -publicUrl cdh1 -rack rack1
$ ./weed volume -dataCenter dc1 -dir ./seaweedfd_data -ip cdh2 -ip.bind cdh2 -maxCpu 1 -mserver cdh1:9333,cdh2:9333,cdh3:9333 -port 9222 -port.public 9222 -publicUrl cdh2 -rack rack1
$ ./weed volume -dataCenter dc1 -dir ./seaweedfd_data -ip cdh3 -ip.bind cdh3 -maxCpu 1 -mserver cdh1:9333,cdh2:9333,cdh3:9333 -port 9222 -port.public 9222 -publicUrl cdh3 -rack rack1
dataCenter: 数据中心名称
rack: 机架名称
后台启动:$ nohup ./weed volume -dataCenter dc