CentOS 安装 SeaweedFS

1. SeaweedFS 介绍

SeaweedFS 是一个简单且高度可扩展的分布式文件系统。有两个目标:

  1. to store billions of files! (存储数十亿个文件!)
  2. to serve the files fast! (快速提供文件!)

Seaweedfs的中心节点(center master)并不会管理所有文件的元数据而仅仅管理文件卷(file volmume),文件及其元数据的管理是由volume server实现的。这可以缓解center master的并发压力,并且将文件元数据分配到volume server可以实现更快的文件访问(只需一次磁盘读取操作)。

2. SeaweedFS 安装

2.1 下载

访问:https://github.com/seaweedfs/seaweedfs/releases

下载linux_amd64.tar.gz文件到本地,并解压文件

bash 复制代码
tar -xzvf linux_amd64.tar.gz 

2.2 创建目录

bash 复制代码
mkdir -p /data/seaweedfs/master
mkdir -p /data/seaweedfs/vol1
mkdir -p /data/seaweedfs/vol2
mkdir -p /data/seaweedfs/vol3
mkdir -p /data/seaweedfs/filer
mkdir -p /data/seaweedfs/filermount

2.3 启动mster

bash 复制代码
nohup ./weed -v=3 master -mdir=/data/seaweedfs/master -defaultReplication="001" >> /data/seaweedfs/master/wdfsmaster.log &

2.4 启动volume

bash 复制代码
nohup ./weed volume -port=8081 -dir=/data/seaweedfs/vol1 -mserver=localhost:9333 >> /data/seaweedfs/vol1/vol1.log &
​
nohup ./weed volume -port=8082 -dir=/data/seaweedfs/vol2 -mserver=localhost:9333 >> /data/seaweedfs/vol2/vol2.log &
​
nohup ./weed volume -port=8083 -dir=/data/seaweedfs/vol3 -mserver=localhost:9333 >> /data/seaweedfs/vol3/vol3.log &

1、-dir表示数据存储的目录;

2、-mserver表示Master地址;

3、-port监听的端口;

2.4 开启filer服务器

bash 复制代码
#开启filer服务器:
nohup ./weed -v=3 filer -port=8888 -master=localhost:9333 >> /data/seaweedfs/filer/filer.log &

#开启挂载服务器,通过 filer 上传的文件放置目录:/data/seaweedfs/filermount
nohup ./weed mount -filer=localhost:8888 -dir=/data/seaweedfs/filermount -filer.path=/  >> /data/seaweedfs/filermount/wefsmount.log &

3. SeaweedFS 上传(master模式)

上传文件

申请fid

bash 复制代码
curl -X POST http://127.0.0.1:9333/dir/assign

响应结果

json 复制代码
{"fid":"3,0306b095e5","url":"192.168.1.100:8081","publicUrl":"192.168.1.100:8081","count":1}

通过fid和url来进行上传文件

文件访问地址:http://192.168.1.100:8081/3,0306b095e5

删除文件

通过图片地址发起DELETE请求

bash 复制代码
curl -X DELETE http://192.168.1.100:8081/3,0306b095e5

4. SeaweedFS 上传(filer模式)

上传文件

文件访问地址:http://192.168.1.100:8888/test/su7_1.jpg

文件列表地址:http://192.168.1.100:8888/

删除文件

通过图片地址发起DELETE请求

bash 复制代码
curl -X DELETE http://192.168.1.100:8888/test/su7_1.jpg
相关推荐
江华森14 分钟前
Spring Cloud 微服务全栈实战:从 Eureka 到 Docker Compose 一文贯通
运维
江华森15 分钟前
Matplotlib 数据绘图基础入门
运维
XIAOHEZIcode16 分钟前
Ubuntu 终端美化全栈指南:Bash 到 Kitty 踩坑实录
linux·ubuntu·命令行
江华森16 分钟前
NumPy 数值计算基础入门
运维
唐青枫2 小时前
别再只会用 cron:Linux systemd Timer 定时任务实战详解
linux
AlfredZhao2 天前
生产环境里,为什么不建议把普通端口直接暴露到公网?
linux·https·443·80
戴为沐3 天前
Linux内存扩容指南
linux
zylyehuo3 天前
Linux 彻底且安全地删除文件
linux
用户805533698034 天前
主线 U-Boot 上 RK3506:和闭源 rkbin 拔河的三个隐性契约
linux·嵌入式
用户034095297914 天前
linux fcitx 5 雾凇拼音 设置在中文输入法下仍然输入英文标点
linux