Linux搭建FastFDFS文件管理系统搭建,部署及上传材料
昨天下午花了三四个小时在Linux centos 6 上搭建了一个分布式文件系统。纯粹是搭建来做自己的文件备份。所以把一些自己在其中遇到的一些问题给总结出来,免得更多人走错路。
FastDFS 的一些介绍(英文来自官方github):

FDFS , 开源分布式文件系统。主要的功能是:文件存储,同步,存取(上传和下载),它可以解决高容量和运载平衡的问题。FastDFS是符合了那些 图片,视频,照片分享的网站的需求。
FDFS 有分别有 tracker 和 storage 两个角色。tracker 负责安排和平衡文件的操作。storage 负责存储文件和其它对文件的操作(文件的保存,同步,提供访问文件的接口)。通过key&value文件的方式进行展现元数据。例如:width=1024,key为width 则 value为"1024"
trackerd 可以是一个或者多个的服务器。在 tracker 集群或者 storaged 集群中你可以随时随地可以添加或者移除集群而丝毫不影响在线的网站。tracker 集群变得越来越流行了。
storaged 组合文件的容量或者群组去获得高容量。storage 系统包含着一个或者多个在这些没有任何联系的容量卷。整个storage 系统的容量相当于所有容量的总和。一个文件卷可以包含一个或更多的存储类型是相同的storaged 服务器。
当整个storage 的容量爆了,你可以继续添加更多的卷去扩大内存。所以,你需要更多的服务器。...
卷名和文件名是组成身份认证的两个部分。
客户端测试的代码请参考目录:client / test
FastDFS的搭建过程:
从搭建部署到测试成功需要 9 步:
#step 1. download libfastcommon source package from github and install it,
the github address:
https://github.com/happyfish100/libfastcommon.git
下载libfastcommon 资源包
#step 2. download FastDFS source package and unpack it,
tar xzf FastDFS_v5.x.tar.gz
#for example:
tar xzf FastDFS_v5.08.tar.gz
下载FastDFS 的资源包并解压
#step 3. enter the FastDFS dir
cd FastDFS
进入FastDFS解压后的文件夹
#step 4. execute:
./make.sh
安装
#step 5. make install
./make.sh install
安装
#step 6. edit/modify the config file of tracker and storage
修改 tracker.conf 和 storage.conf 两个配置文件
#step 7. run server programs
#start the tracker server:
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
#in Linux, you can start fdfs_trackerd as a service:
/sbin/service fdfs_trackerd start
#start the storage server:
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
#in Linux, you can start fdfs_storaged as a service:
/sbin/service fdfs_storaged start
其中storage 和 tracker 两个服务
#step 8. run test program
#run the client test program:
/usr/bin/fdfs_test <client_conf_filename> <operation>
/usr/bin/fdfs_test1 <client_conf_filename> <operation>
#for example, upload a file:
/usr/bin/fdfs_test conf/client.conf upload /usr/include/stdlib.h
测试
#step 9. run monitor program
#run the monitor program:
/usr/bin/fdfs_monitor <client_conf_filename>
通过moniter检测项目运行情况
接下来我们进行正确的步骤:
所需软件包的github地址:
FastDFS : https://github.com/happyfish100/fastdfs.git
libfastcommon : https://github.com/happyfish100/libfastcommon.git
所需的的环境:
Linux centos 6.5或者以上
如果系统没有gcc,那就命令行( yum install gcc )进行安装
下载:
cd /opt && mkdir fastdfs && cd fastdfs #在opt目录下建立文件夹 fastdfs
git clone https://github.com/happyfish100/fastdfs.git #下载FastDFS
git clone https://github.com/happyfish100/libfastcommon.git #下载libfastcommon
cd /opt/fastdfs/libfastcommon #进入目录进行安装
./make.sh && ./make.sh install
cd /opt/fastdfs/fastdfs
./make.sh && ./make.sh install
配置文件:
所有的配置文件都在 /usr/bin/fdfs/ 下 :
client.conf.sample storage.conf.sample storage_ids.conf.sample tracker.conf.sample
cd /etc/fdfs
mv tracker.conf.sample tracker.conf
mv storage.conf.sample storage.conf.sample
mv client.conf.sample client.conf.sample
修改配置文件的内容如下:
storage.conf
# the base path to store data and log files
base_path=/mnt/xfsd/fastdfs/storage # store_path#, based , if store_path0 not exists, it's value is base_path
# the paths must be exist
store_path0=/mnt/xfsd/fastdfs/storage # tracker_server can ocur more than once, and tracker_server format is
# "host:port", host can be hostname or ip address
tracker_server=host: #standard log level as syslog, case insensitive, value list:
### emerg for emergency
### alert
### crit for critical
### error
### warn for warning
### notice
### info
### debug
log_level=debug # the port of the web server on this storage server
http.server_port=
bash_path 是storage存储的数据和日志的地址
store_path0 和bash_path一样,只不过这个是优先存储的地址,如果不存在,默认是bash_path
tracker_server 是指tracker服务角色的 地址:端口。(如果tracker 和 storage 是同一个服务器的话,那么就填写服务器的ip和地址。)
log_level 是输出日志的级别设计
http.server_port 是http服务的接受端口
tracker.conf
# the tracker server port
port= # the base path to store data and log files
base_path=/mnt/xfsd/fastdfs/tracker/ # HTTP port on this tracker server
http.server_port=
修改后可以启动服务了
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf (start | restart | stop)
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf (start | restart | stop)
检查服务:
/usr/bin/fdfs_moniter /etc/fdfs/storaged.conf
开启端口(我用的是iptables,简单便捷就可以配置了,可以去网上看下怎么安装iptables):

最后,进行测试:
fdfs_delete_file # 删除文件
fdfs_upload_file #上传文件
fdfs_test # 测试文件
fdfs_download_file #下载文件
拿fdfs_test来测试:
/usr/bin/fdfs_test /etc/fdfs/client.conf upload /目标文件路径
成功后会有以下信息:

Linux搭建FastFDFS文件管理系统搭建,部署及上传材料的更多相关文章
- nexus搭建maven私服及私服jar包上传和下载
nexus搭建maven私服及私服jar包上传和下载 标签: nexus管理maven库snapshot 2017-06-28 13:02 844人阅读 评论(0) 收藏 举报 分类: Maven(1 ...
- ftp服务器搭建(windows)+实现ftp图片上传对接
ftp服务器搭建(windows): vsftpd简介: vsftpd是“very secure FTP daemon”的缩写,是一个完全免费的.开放源代码的ftp服务器软件. 下载地址: http: ...
- 在IDEA中搭建Java源码学习环境并上传到GitHub上
打开IDEA新建一个项目 创建一个最简单的Java项目即可 在项目命名填写该项目的名称,我这里写的项目名为Java_Source_Study 点击Finished,然后在项目的src目录下新建源码文件 ...
- 【Azure 应用服务】App Service 在使用GIt本地部署,上传代码的路径为/home/site/repository,而不是站点的根目录/home/site/wwwroot。 这个是因为什么?
问题描述 App Service 在使用GIt本地部署,上传代码的路径为/home/site/repository,而不是站点的根目录/home/site/wwwroot. 这个是因为什么? 并且通过 ...
- 一般处理程序上传文件(html表单上传、aspx页面上传)
html 表单上传文件 一般处理程序由于没有 apsx 页面的整个模型和控件的创建周期,而比较有效率.这里写一个用 html 表单进行文件上传的示例. 1. 表单元素选用 ...
- ASP.NET MVC 网站开发总结(二)——一个或多个文件的异步或同步上传
简而言之,直接用代码展示如何实现文件的上传,这里需要使用到一个bootstrap的文件上传插件File Input(请自行下载). 前台页面: <!----> <!DOCTYPE h ...
- html5+php实现文件的断点续传ajax异步上传
html5+php实现文件的断点续传ajax异步上传 准备知识:断点续传,既然有断,那就应该有文件分割的过程,一段一段的传.以前文件无法分割,但随着HTML5新特性的引入,类似普通字符串.数组的分割, ...
- Springmvc+uploadify实现文件带进度条批量上传
网上看了很多关于文件上传的帖子,众口不一,感觉有点乱,最近正好公司的项目里用到JQuery的uploadify控件做文件上传,所以整理下头绪,搞篇文档出来,供亲们分享. Uploadify控件的主要优 ...
- ajaxfileupload.js插件结合一般处理文件实现Ajax无刷新上传
先上几张图更直观展示一下要实现的功能.本功能主要通过Jquery ajaxfileupload.js插件结合ajaxUpFile.ashx一般应用程序处理文件实现Ajax无刷新上传功能,结合NPOI2 ...
随机推荐
- 正则匹配所有的a标签
<a\b[^>]+\bhref="([^"]*)"[^>]*>([\s\S]*?)</a>分组1和分组2即为href和value解释: ...
- hashMap_使用
转]Java中HashMap遍历的两种方式原文地址: http://www.javaweb.cc/language/java/032291.shtml 第一种: Map map = new HashM ...
- Leaflet+heatmap实现离线地图加载和热力图应用
本人博客主页:http://www.cnblogs.com/webbest/ 2017年春节已经过完,新一年的奋斗也刚刚开始.今年要经历的挑战也是大大的...不扯了. 年底前软件项目相对较多,恰巧在年 ...
- Yii2前后台分离
Yii2前后台都需要注册的时候会产生前后台登录一个另一个同步登录和退出,这是因为登录和退出之前的sitecontroller里面公用了common/model下面的LoginForm.php和user ...
- 【craps赌博游戏】
/* cpaps赌博游戏 说明: 一个简单的赌博游戏,游戏规则如下:玩家掷两个骰子,点数为1到6,如果第一次点数和为7或11,则玩家胜,如果点数和为2.3 或12,则玩家输,如果和 为其它点数,则记录 ...
- GCD 多线程 ---的记录 iOS
先写一个GCD static UserInfoVoModel *userInfoShare = nil; +(instancetype)shareUserInfoVoModel { static di ...
- swift 可选类型笔记
晚上十一点半了,看书累了,原本想睡了的,想了想,还是把刚看的总结一下,把这篇笔记写了吧.广州下雨,真特么的冷..好了,废话不说了,说正题说说Swift可选类型. 先定义一个变量: var string ...
- css3绘制腾讯logo
CSS3绘制的腾讯LOGO,下边是对比图. 演示地址
- java 文件操作 读取字节级数据(读取)
package com.swust; import java.io.*; /* * 功能:按照双精度浮点型.整型.布尔型.字符型.和字符串型的顺序从名为sample.dat文件读取数据 * 分析:用F ...
- Linux的CentOS7系统下配置LNMP
友情提示:在执行以下操作之前,请确保您已经安装了centos7,因为以下所有操作均是在centos7下操作完成的. 1.首先要停掉本机自带的防火墙,再配置iptables,开放21/22/80/808 ...