如何安装FastDFS
的有关信息介绍如下: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一、安装libeventfastDFS需要安装libevent比较新的版本,将本机的比较低的版本卸载了。rpm -qa libeventlibevent-1.4.13-1.el6.x86_64rpm -e --nodeps libevent安装一个最新稳定版wget https://github.com/downloads/libevent/libevent/libevent-2.0.18-stable.tar.gztar zxvf libevent-2.0.18-stable.tar.gzcd libevent-2.0.18-stable./configuremake && make install为libevent创建软链接到/lib库下,64位系统对应/lib64ln -s /usr/local/lib/libevent* /lib/ln -s /usr/local/lib/libevent* /lib64/二、安装FastDFSwget http://fastdfs.googlecode.com/files/FastDFS_v3.06.tar.gztar zxvf FastDFS_v3.06.tar.gzcd FastDFS./make.sh./make.sh install三、配置FastDFS环境:tracker server192.168.1.5storage server192.168.1.51192.168.1.521、配置并启动 tracker server①配置 tracker.confmkdir /data/fastdfsvim /etc/fdfs/tracker.confbase_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.conf2、配置并启动 storage server①配置 tracker.confmkdir /data/fastdfsmkdir /data/imagesvim /etc/fdfs/storage.confbase_path=/data/fastdfsstore_path0=/data/imagestracker_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.conf3、为storage节点安装fastdfs-nginx-module模块①安装模块安装Nginx详见:需重新编译Nginxwget http://fastdfs.googlecode.com/files/fastdfs-nginx-module_v1.10.tar.gztar zxvf fastdfs-nginx-module_v1.10.tar.gzwget http://nginx.org/download/nginx-1.2.0.tar.gztar zxvf nginx-1.2.0.tar.gzcd nginx-1.2.0./configure --prefix=/usr/local/nginx --add-module=../fastdfs-nginx-module/srcmake && make installcd ..②配置编辑nginx.confvim /usr/local/nginx/conf/nginx.confserver { 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.confbase_path=/data/fastdfstracker_server=192.168.1.5:22122store_path0=/data/images启动nginx/usr/local/nginx/sbin/nginx四、使用FastDFS1、上传文件FastDFS安装包中,自带了客户端程序,通过程序可以进行文件上传。在使用这个客户端程序之前,首先需要配置client.conf,然后再进行文件上传及下载。在tracker上修改客户端配置文件client.confvim /etc/fdfs/client.confbase_path=/data/fastdfstracker_server=192.168.1.5:22122vim a.htmlThis Is FastDFS Test.上传文件/usr/local/bin/fdfs_test /etc/fdfs/client.conf upload a.htmlThis is FastDFS client test program v3.06Copyright (C) 2008, Happy Fish / YuQingFastDFS may be copied only under the terms of the GNU GeneralPublic 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=0tracker_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=23000group_name=group1, ip_addr=192.168.1.51, port=23000storage_upload_by_filenamegroup_name=group1, remote_filename=M00/00/00/wKgBM0-cxs32qFyYAAAADigvbpc90.htmlsource ip address: 192.168.1.51file timestamp=2012-04-29 12:42:53file size=14file crc32=674197143file url: http://192.168.1.5/group1/M00/00/00/wKgBM0-cxs32qFyYAAAADigvbpc90.htmlstorage_upload_slave_by_filenamegroup_name=group1, remote_filename=M00/00/00/wKgBM0-cxs32qFyYAAAADigvbpc90_big.htmlsource ip address: 192.168.1.51file timestamp=2012-04-29 12:42:53file size=14file crc32=674197143file 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访问看看吧。看了几天了,还是有些地方不是很明白,暂时搁置,不能再浪费时间了。