一、介绍
SeaweedFS是基于go语言开发的高可用文件存储系统,主要特性
1、成存储上亿的文件(最终受制于你的硬盘大小)
2、速度快,内存占用小
上手使用比fastDFS要简单很多,自带Rest API。
SaaWeeDFS作为对象存储库来有效地处理小文件。不是管理中央主机中的所有文件元数据,中央主机只管理文件卷,它允许这些卷服务器管理文件和它们的元数据。
这减轻了来自中央主机的并发压力,并将文件元数据扩展到卷服务器,允许更快的文件访问(仅一个磁盘读取操作)。
每个文件的元数据只有40字节的磁盘存储开销。
访问地址:https://github.com/chrislusf/seaweedfs
二、原理
数据卷:也就是是类似我们windowspan的D,E盘等物理磁盘,文件保存的物理介质。默认32GB,通过修改代码可以修改为64GB或者128GB,每个文件的最大不超过单个卷的大小。
官网描述:In the current implementation, each volume can hold 32 gibibytes (32GiB or 8x2^32 bytes). This is because we align content to 8 bytes. We can easily increase this to 64GiB, or 128GiB, or more, by changing 2 lines of code, at the cost of some wasted padding space due to alignment.
There can be 4 gibibytes (4GiB or 2^32 bytes) of volumes. So the total system size is 8 x 4GiB x 4GiB which is 128 exbibytes (128EiB or 2^67 bytes).
Each individual file size is limited to the volume size.
数据卷服务器:为了更方便的管理数据卷,通过该服务来对多个数据卷进行管理。其中,数据卷服务器保存了文件元数据,通过访问文件元数据就可以操作数据卷中的文件。从官网中我们了解到文件的元数据只有16字节大小。【文件句柄:表示文件对象的一个便于使用的引用】
官网描述:The actual data is stored in volumes on storage nodes. One volume server can have multiple volumes, and can both support read and write access with basic authentication. 一个卷服务对应多个卷
The actual file metadata is stored in each volume on volume servers. Since each volume server only manages metadata of files on its own disk, with only 16 bytes for each file, all file access can read file metadata just from memory and only needs one disk operation to actually read file data.每个文件的元数据16字节大小,Linux中中XFS结构中为536/8(67)字节。
For comparison, consider that an xfs inode structure in Linux is 536 bytes
主控服务器:为了便于对多个数据卷服务器进行统一的调度(增加,删除,查找,定位等等操作