FastDFS 安装及使用

FastDFS 安装及使用

2012-11-17 13:10:31|  分类: Linux|举报|字号 订阅

 
 
Google了一下,流行的开源分布式文件系统有很多,介绍如下:
 
mogileFS:Key-Value型元文件系统,不支持FUSE,应用程序访问它时需要API,主要用在web领域处理海量小图片,效率相比mooseFS高很多。
fastDFS:国人在mogileFS的基础上进行改进的key-value型文件系统,同样不支持FUSE,提供比mogileFS更好的性能。
mooseFS:支持FUSE,相对比较轻量级,对master服务器有单点依赖,用perl编写,性能相对较差,国内用的人比较多
glusterFS:支持FUSE,比mooseFS庞大
ceph:支持FUSE,客户端已经进入了linux-2.6.34内核,也就是说可以像ext3/rasierFS一样,选择ceph为文件系统。彻底的分布式,没有单点依赖,用C编写,性能较好。基于不成熟的btrfs,其本身也非常不成熟。
lustre:Oracle公司的企业级产品,非常庞大,对内核和ext3深度依赖
NFS:老牌网络文件系统,具体不了解,反正NFS最近几年没发展,肯定不能用。
鉴于fastDFS是国人开发,也有国内的一些大公司在使用,so…
 
普通的文件架构其实一两年内也是没有问题的,但有句话叫未雨绸缪,于是决定折腾折腾。
源码下载:http://code.google.com/p/fastdfs
寻求帮助:http://www.csource.org
 
一、安装libevent
fastDFS需要安装libevent比较新的版本,将本机的比较低的版本卸载了。
 
rpm -qa libevent
libevent-1.4.13-1.el6.x86_64
rpm -e --nodeps libevent
安装一个最新稳定版
 
wget https://github.com/downloads/libevent/libevent/libevent-2.0.18-stable.tar.gz
tar zxvf libevent-2.0.18-stable.tar.gz
cd libevent-2.0.18-stable
./configure
make && make install
为libevent创建软链接到/lib库下,64位系统对应/lib64
 
ln -s /usr/local/lib/libevent* /lib/
ln -s /usr/local/lib/libevent* /lib64/
二、安装FastDFS
 
wget http://fastdfs.googlecode.com/files/FastDFS_v3.06.tar.gz
tar zxvf FastDFS_v3.06.tar.gz
cd FastDFS
./make.sh
./make.sh install
三、配置FastDFS
环境:
tracker server
192.168.1.5
storage server
192.168.1.51
192.168.1.52
 
1、配置并启动 tracker server
①配置 tracker.conf
 
mkdir /data/fastdfs
vim /etc/fdfs/tracker.conf
base_path=/data/fastdfs
②启动 tracker
 
/usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
③开机启动
 
vim /etc/rc.local
/usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
2、配置并启动 storage server
①配置 tracker.conf
 
mkdir /data/fastdfs
mkdir /data/images
vim /etc/fdfs/storage.conf
base_path=/data/fastdfs
store_path0=/data/images
tracker_server=192.168.1.5:22122
②启动 tracker
 
/usr/local/bin/fdfs_storage /etc/fdfs/storage.conf
③开机启动
 
vim /etc/rc.local
/usr/local/bin/fdfs_storage /etc/fdfs/storage.conf
3、为storage节点安装fastdfs-nginx-module模块
①安装模块
安装Nginx详见:
需重新编译Nginx
 
wget http://fastdfs.googlecode.com/files/fastdfs-nginx-module_v1.10.tar.gz
tar zxvf fastdfs-nginx-module_v1.10.tar.gz
wget http://nginx.org/download/nginx-1.2.0.tar.gz
tar zxvf nginx-1.2.0.tar.gz
cd nginx-1.2.0
./configure --prefix=/usr/local/nginx --add-module=../fastdfs-nginx-module/src
make && make install
cd ..
②配置
编辑nginx.conf
 
vim /usr/local/nginx/conf/nginx.conf
server {
    listen       80;
    server_name  localhost;
 
    location /M00 {
        alias /data/images/data;
        ngx_fastdfs_module;
    }
    ......
}
给 storage 的存储目录做一个软连接
 
ln -s /data/images/data/ /data/images/data/M00
拷贝mod_fastdfs.conf 到 /etc/fdfs/
 
cp fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
vim /etc/fdfs/mod_fastdfs.conf
base_path=/data/fastdfs
tracker_server=192.168.1.5:22122
store_path0=/data/images
启动nginx
 
/usr/local/nginx/sbin/nginx
四、使用FastDFS
1、上传文件
FastDFS安装包中,自带了客户端程序,通过程序可以进行文件上传。在使用这个客户端程序之前,首先需要配置client.conf,然后再进行文件上传及下载。
在tracker上修改客户端配置文件client.conf
 
vim /etc/fdfs/client.conf
base_path=/data/fastdfs
tracker_server=192.168.1.5:22122
vim a.html
This Is FastDFS Test.
上传文件
 
/usr/local/bin/fdfs_test /etc/fdfs/client.conf upload a.html
This is FastDFS client test program v3.06
 
Copyright (C) 2008, Happy Fish / YuQing
 
FastDFS may be copied only under the terms of the GNU General
Public License V3, which may be found in the FastDFS source kit.
Please visit the FastDFS Home Page http://www.csource.org/ 
for more detail.
 
[2012-04-29 12:42:53] INFO - base_path=/data/tracker, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0
 
tracker_query_storage_store_list_without_group: 
server 1. group_name=group1, ip_addr=192.168.1.51, port=23000
server 2. group_name=group1, ip_addr=192.168.1.52, port=23000
 
group_name=group1, ip_addr=192.168.1.51, port=23000
storage_upload_by_filename
group_name=group1, remote_filename=M00/00/00/wKgBM0-cxs32qFyYAAAADigvbpc90.html
source ip address: 192.168.1.51
file timestamp=2012-04-29 12:42:53
file size=14
file crc32=674197143
file url: http://192.168.1.5/group1/M00/00/00/wKgBM0-cxs32qFyYAAAADigvbpc90.html
storage_upload_slave_by_filename
group_name=group1, remote_filename=M00/00/00/wKgBM0-cxs32qFyYAAAADigvbpc90_big.html
source ip address: 192.168.1.51
file timestamp=2012-04-29 12:42:53
file size=14
file crc32=674197143
file url: http://192.168.1.5/group1/M00/00/00/wKgBM0-cxs32qFyYAAAADigvbpc90_big.html
上传成功
试试用
 
http://192.168.1.51/M00/00/00/wKgBM0-cxs32qFyYAAAADigvbpc90_big.html
 
访问看看吧。
 
看了几天了,还是有些地方不是很明白,暂时搁置,不能再浪费时间了。

FastDFS的安装(复制自己用)的更多相关文章

  1. FASTDFS 5X安装

    FASTDFS 5X安装 http://www.wingdevops.com/?p=603 流行的开源分布式文件系统有很多,FastDFS 是国人在mogileFS的基础上进行改进的key-value ...

  2. 图片服务器FastDFS的安装及使用

    FastDFS介绍 FastDFS是用c语言编写的一款开源的分布式文件系统.FastDFS为互联网量身定制,充分考虑了冗余备份.负载均衡.线性扩容等机制,并注重高可用.高性能等指标,使用FastDFS ...

  3. 01.FastDFS的安装部署

    1.FastDFS简介 (1)FastDFS的功能介绍 FastDFS是一个开源的分布式文件系统,它对文件进行管理,功能包括:文件存储.文件同步.文件访问(文件上传.文件下载)等,解决了大容量存储和负 ...

  4. SqlServer 由于未在SqlServer的此实例上安装复制组件解决方法

    sqlserver2005在复制订阅时出现: “由于未在SqlServer的此实例上安装复制组件,Microsoft SQL server 无法访问这些组件,请参阅SQL Server……” 解决方法 ...

  5. 轻量级分布式文件系统FastDFS使用安装说明手册(新手入门级)

    轻量级分布式文件系统FastDFS使用安装说明手册(新手入门级) 实验室所在的课题组以研究云计算为主,但所有的研究都是在基于理论的凭空想像,缺少分布式环境的平台的实践,云计算神马的都是浮云了.因此,我 ...

  6. FastDFS + Nginx 安装

    1.安装FastDFS依赖lib包 cd /usr/local/src/ git clone https://github.com/happyfish100/libfastcommon.git cd  ...

  7. FastDFS部署安装全过程

    你好!欢迎阅读我的博文,你可以跳转到我的个人博客网站,会有更好的排版效果和功能. 此外,本篇博文为本人Pushy原创,如需转载请注明出处:https://pushy.site/posts/153205 ...

  8. Docker与FastDFS的安装命令及使用

    Docker特点 1)上手快 用户只需要几分钟,就可以把自己的程序“Docker 化”.Docker 依赖于“写时复制” (copy-on-write)模型,使修改应用程序也非常迅速,可以说达到“随心 ...

  9. fastdfs基本安装流程和集成springboot总结

    FastDFS介绍 1.简介 FastDFS 是一个开源的高性能分布式文件系统(DFS). 它的主要功能包括:文件存储,文件同步和文件访问,以及高容量和负载平衡.主要解决了海量数据存储问题,特别适合以 ...

随机推荐

  1. 500 Days Of Summer

    <和莎莫的500天>,一部爱情片. Summer和Tom两人不同的爱情观走在了一起,或许真的就是爱情观不同,或许是Summer爱Tom爱的不够深,最终的结局是那么不尽人意. 有人愿意把秘密 ...

  2. Android(java)学习笔记98:如何让你的GridView不再滚动

    1. 如何让你的GridView不再滚动: GridView显示不完整的原因是因为,他的外层也套用了一个滑动的控件,这个解决办法是:重写GridView,是控制GridView不能滚动,就是写一个类继 ...

  3. 深入理解计算机系统_3e 第十一章家庭作业 CS:APP3e chapter 11 homework

    注:tiny.c csapp.c csapp.h等示例代码均可在Code Examples获取 11.6 A. 书上写的示例代码已经完成了大部分工作:doit函数中的printf("%s&q ...

  4. for循环语句中的先后执行顺序

    for(int i=0;i<10;i++){ cout<<i; } 分析程序运行结果:for(cout<<"a";cout<<" ...

  5. 微信小程序页面跳转绑定点击事件

    https://www.cnblogs.com/mrszhou/p/7931747.html

  6. 第18题:在O(1)时间删除链表结点+删除链表中重复的节点

    题目描述:题目描述在O(1)时间删除链表结点 给定单向链表的头指针和一个结点指针,定义一个函数在O(1)时间删除该结点. 考查创新编程能力. 思路: 1.如果从头到尾遍历,时间O(n) 2.如果将待删 ...

  7. 【思维题 经典模型】cf632F. Magic Matrix

    非常妙的经典模型转化啊…… You're given a matrix A of size n × n. Let's call the matrix with nonnegative elements ...

  8. 【Django】URL中传递中文的问题

     开发环境:Ubuntu16.04+Django 1.11.9+Python2.7 在开发中,在做查找某些信息这个功能的时候,遇到的一个问题.需要在URL中传递查找的关键字,当关键字为中文的时候,并不 ...

  9. 爬取代理IP,并判断是否可用。

    # -*- coding:utf-8 -*- from gevent import monkey monkey.patch_all() import urllib2 from gevent.pool ...

  10. 第二篇:ssh.invoke_shell() 切换root出现的新问题

    接上一篇:按照上一篇的方式,在没有对ssh.invoke_shell()执行后的登录提示符进行判断的话,那边有部分机器就回因为返回为空导致程序卡死. 正常机器  ssh.recv(9999)  命令返 ...