阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

搭建FastDFS分布式存储环境

105次阅读
没有评论

共计 2233 个字符,预计需要花费 6 分钟才能阅读完成。

FastDFS 简介 http://www.linuxidc.com/Linux/2014-10/107591.htm

下面的实验准备搭建一个 FastDFS 分布式存储环境, 网络拓扑如下

搭建 FastDFS 分布式存储环境
 首先, 在每一台服务器上安装 FastDFS
 [root@slaveOne FastDFS]# yum install libevent libevent-devel libevent-headers -y
 [root@slaveOne FastDFS]# ./make.sh
 [root@slaveOne FastDFS]# ./make.sh install
安装成功之后,可以看到 /etc 下其相应的配置文件

 配置 tracker 服务器,192.168.1.1
修改 /etc/fdfs/tracker.conf 配置文件
base_path=/tracker
启动服务
[root@master fdfs]# fdfs_trackerd tracker.conf

配置 storage 服务器
192.168.1.2 和 192.168.1.3 修改 /etc/fdfs/storage.conf 配置文件
group_name=group1
 base_path=/storage
 store_path0=/storage
 tracker_server=192.168.1.1:22122

 192.168.1.10 修改 /etc/fdfs/storage.conf 配置文件
group_name=group2
base_path=/storage
store_path0=/storage
tracker_server=192.168.1.1:22122

启动 storage 服务
[root@slaveOne fdfs]# fdfs_storaged storage.conf
 data path: /storage/data, mkdir sub dir…
 mkdir data path: 00 …
 mkdir data path: 01 …
 mkdir data path: 02 …
 mkdir data path: 03 …

……
 mkdir data path: FE …
 mkdir data path: FF …
 data path: /storage/data, mkdir sub dir done.

 

环境已经搭建完成, 现在在 192.168.1.1 Tracker 服务器上进行测试。
 修改 /etc/fdfs/client.conf 配置文件
base_path=/tmp/fastdfs
 tracker_server=192.168.1.1:22122

执行命令上传文件
[root@master fdfs]# fdfs_upload_file client.conf /root/jquery-easyui-1.4.zip
 group1/M00/00/00/wKgBA1QnlouAcPe0AAu0LAhS8cw4.4.zip

 

从返回的信息看, 文件已经上传到 group1 的指定位置,
group1 的存储服务器 192.168.1.2 和 192.168.1.3 的 /storage/data/00/00 路径下可以找到该文件。

 如果需要下载文件, 可以使用如下命令

Tracker 的配置文件 /etc/fdfs/tracker.conf 的 store_lookup 参数

# the method of selecting group to upload files
 # 0: round robin
 # 1: specify group
 # 2: load balance, select the max free space group to upload file
 store_lookup=0

 0 表示轮调算法,1 表示指定 group,2 表示负载均衡, 找剩余空间最大的 group
如果选择 1, 则还需要指定 store_group 参数.
 # which group to upload file
 # when store_lookup set to 1, must set store_group to the group name
 store_group=group2

参考:http://www.linuxidc.com/Linux/2014-10/107574.htm

 搭建 FastDFS 分布式存储环境(使用 Nginx 模块)http://www.linuxidc.com/Linux/2014-10/107659.htm

CentOS 6.2 下 fastDFS 的完整安装和配置步骤 http://www.linuxidc.com/Linux/2012-12/75989.htm

FastDFS 在 Ubuntu 下的安装,PHP 客户端 http://www.linuxidc.com/Linux/2012-09/71459.htm

FastDFS 分布式文件服务器安装,及配置,测试 http://www.linuxidc.com/Linux/2012-09/71458.htm

FastDFS 整合 Nginx 问题整理 http://www.linuxidc.com/Linux/2012-09/71232.htm

CentOS 下搭建 FastDFS http://www.linuxidc.com/Linux/2012-09/70995.htm

Ubuntu 安装 FastDFS 全程记录 http://www.linuxidc.com/Linux/2012-03/56377.htm

FastDFS 的详细介绍:请点这里
FastDFS 的下载地址:请点这里

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-20发表,共计2233字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中