Weed-FS/杂草文件系统 小文件存储集群 安装 使用 测试

Weed-FS/杂草文件系统 小文件存储集群 安装 使用 测试

使用Go语言编写
Weed fs 是一个简单/高可用 密集型小文件存储的集群文件系统
Weed-FS is a simple and highly scalable distributed file system. There are two objectives:
官方说
to store billions of files! 可以存储亿级的小文件
to serve the files fast! 存取文件快速
Instead of supporting full POSIX file system semantics, Weed-FS choose to implement only a key~file mapping. Similar to the word “NoSQL”, you can call it as “NoFS”.
完整的符合POSIX文件系统规范 和nosql一样 使用key-file的结构

安装
安装是非常简单的事
已提供各种不同的可执行文件
可以在 https://code.google.com/p/weed-fs/downloads/list 查看和下载

我测试用到的2个版本
https://weed-fs.googlecode.com/files/weed_0.45_linux_amd64.tar.gz
https://weed-fs.googlecode.com/files/weed_0.45_linux_386.tar.gz

DS1 1.1.1.1 主Meta信息服务器 Master
DS2 2.2.2.2 存储集群1 Volume1

Master Setup
————————————————————————
cd /opt
wget
tar xfz
cd
执行查看帮助
./weed master -h
Default Usage:
-conf=”/etc/weedfs/weedfs.conf”: xml configuration file
-debug=false: enable debug mode
-defaultReplicationType=”000″: Default replication type if not specified.
-garbageThreshold=”0.3″: threshold to vacuum and reclaim spaces
-maxCpu=0: maximum number of CPUs. 0 means all available CPUs
-mdir=”/tmp”: data directory to store mappings
-port=9333: http listen port
-pulseSeconds=5: number of seconds between heartbeats
-readTimeout=3: connection read timeout in seconds
-volumeSizeLimitMB=32768: Default Volume Size in MegaBytes
-whiteList=””: comma separated Ip addresses having write permission. No limit if empty.
Description:
start a master server to provide volume=>location mapping service
and sequence number of file ids

启动
./weed master -debug=true -defaultReplicationType=000 -volumeSizeLimitMB=32768 -mdir=/opt/test -port=9333
开启了Debug测试模式 正式使用的话 移除

#存储 Setup
cd /opt
wget https://weed-fs.googlecode.com/files/weed_0.45_linux_386.tar.gz
tar xfz weed_0.45_linux_386.tar.gz
cd weed_0.45_linux_386
执行获得帮助
./weed volume -h
root@ds2 [/opt/weed_0.45_linux_386]# ./weed volume -h
Example: weed volume -port=8080 -dir=/tmp -max=5 -ip=server_name -mserver=localh ost:9333
Default Usage:
-dataCenter=””: current volume server’s data center name
-debug=false: enable debug mode
-dir=”/tmp”: directories to store data files. dir[,dir]…
-ip=”localhost”: ip or server name
-max=”7″: maximum numbers of volumes, count[,count]…
-maxCpu=0: maximum number of CPUs. 0 means all available CPUs
-mserver=”localhost:9333″: master server location
-port=8080: http listen port
-publicUrl=””: Publicly accessible : -pulseSeconds=5: number of seconds between heartbeats, must be smaller than th e master’s setting
-rack=””: current volume server’s rack name
-readTimeout=3: connection read timeout in seconds. Increase this if uploading large files.
-whiteList=””: comma separated Ip addresses having write permission. No limit if empty.
Description:
start a volume server to provide storage spaces

./weed volume -max=100 -ip=2.2.2.2 -port=8080 -mserver=1.1.1.1:9333 -publicUrl=a1.eee.com:8080 -dir=/opt/test -dataCenter=DC1

-ip = 2.2.2.2 = 绑定IP 注意:不绑定默认使用127.0.0.1 无法外部上传的
-port = 绑定端口
-mserver = 主服务器 需要指定IP和端口 格式为 1.1.1.1:9333
-publicUrl = 公开访问的URL 不指定直接使用IP
-dir= 存储目录
-datacenter = 数据中心标识
-rack=”IPX9″ = 机柜标识

2个都启动后
开始测试上传
在Master机器上 上传/opt/1.png文件到 存储集群中
curl -F “file=@/opt/1.png;type=image/png” http://1.1.1.1:8080/submit
默认我指定了文件类型为PNG图片
如果不指定 默认不是Content-Type:image/png 会直接提示下载 无法浏览器直接查看
返回的json数据
{“fid”:”5,2713af3843b3″,”fileName”:”1.png”,”fileUrl”:”a1.eee.com:8080/5,2713af3843b3″,”size”:6522}
这样就上传成功了

如果需要删除
curl -X DELETE http://a1.eee.com:8080/5,2713af3843b3

负载压力情况测试
比较悲剧
ab -k -c 250 -n 20000 完成1000后 错误
ab -k -c 100 -n 10000 完成1000后 错误
ab -k -c 100 -n 1000 测试完成
截图见
test

本来打算拿来做个东西
结果发现负载是比较悲剧的 暂时不考虑了

最近通过搜索访问本文章的关键词:

2 thoughts on “Weed-FS/杂草文件系统 小文件存储集群 安装 使用 测试

  1. forrestsun

    请教:
    ab -k -c 250 -n 20000 完成1000后 错误 ,请问你在20000后跟的测试参数是什么?能否告知?谢谢

  2. 图片链接

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注