经过几天的折腾,终于搞定了。
现在和大家分享一下:
一、安装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
1、配置并启动 tracker server
①配置 tracker.conf
mkdir /data/fastdfs
vim /etc/fdfs/tracker.conf
base_path=/data/fastdfs
http.server_port=8080 -> http.server_port=8020
##include http.conf -> #include http.conf
②启动 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
①配置 storage.conf
mkdir /data/fastdfs
mkdir /data/images
vim /etc/fdfs/storage.conf
base_path=/data/fastdfs
store_path0=/data/images
tracker_server=127.0.0.1:22122
②启动 tracker
/usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf
③开机启动
vim /etc/rc.local
/usr/local/bin/fdfs_storaged /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
#user nobody;
user root; --如果下载遇到权限问题就改为root
server {
listen 8010;
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=127.0.0.1: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=127.0.0.1:22122
1
2
vim a.html
This Is FastDFS HELLO SONGYI.
上传文件
[root@uhzc006469 sy]# /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-11-01 23:30:03] INFO - base_path=/home/sy/data/fastdfs, 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=223.4.155.155, port=23000
group_name=group1, ip_addr=223.4.155.155, port=23000
storage_upload_by_filename
group_name=group1, remote_filename=M00/00/00/3wSbm1CSlXv7SNZHAAAAGmciNqs65.html
source ip address: 223.4.155.155
file timestamp=2012-11-01 23:30:03
file size=26
file crc32=1730295467
file url: http://223.4.155.155:8010/group1/M00/00/00/3wSbm1CSlXv7SNZHAAAAGmciNqs65.html
storage_upload_slave_by_filename
group_name=group1, remote_filename=M00/00/00/3wSbm1CSlXv7SNZHAAAAGmciNqs65_big.html
source ip address: 223.4.155.155
file timestamp=2012-11-01 23:30:03
file size=26
file crc32=1730295467
file url: http://223.4.155.155:8010/group1/M00/00/00/3wSbm1CSlXv7SNZHAAAAGmciNqs65_big.html
上传成功 大功告成!
试试用 地址栏:
http://223.4.155.155:8010/M00/00/00/3wSbm1CSlXv7SNZHAAAAGmciNqs65_big.html
分享到:
相关推荐
FastDFS分布式文件服务器
3.能够理解FastDFS分布式文件系统架构、及架构思想 4.能够理解文件上传、下载、 文件服务器访问的流程 5.能够完成FastDFS环境搭建(使用docker镜像即可) 6.能够理解FastDFS&nginx访问流程 7.能够掌握FastDFS错误...
摘要: FastDFS简介 •FastDFS是一个轻量级的开源分布式文件系统 •FastDFS主要解决了大容量的文件存储和高并发访问的问题,文件存取时实现了负载均衡 •FastDFS实现了软件方式的RAID,可以使用廉价的IDE硬盘进行...
fastDFS分布式文件系统部署方案,详细部署步骤,一看便知; FastDFS 是一个开源的高性能分布式文件系统( DFS )。 它的主要功能包括:文件存储,文件同步和 文件访问,以及高容量和负载平衡。主要解决了海量数据...
本系统使用FastDFS分布式文件系统作为本系统的图片服务器,需自行安装虚拟机进行配置。 一个本科毕业设计项目,基于springboot的论坛管理系统,前后端,源码+数据库 技术栈: SpringBoot+SpringSecurity+Maven+...
3. 文件下载流程4. 简易FastDFS架构5 FastDFS安装5.1 安装fastdfs依赖包1. 解压缩libfastcommon-master.zip
三个文件 1、fastdfs-5.11.tar.gz 2、fastdfs-nginx-module-master.zip 3、libfastcommon-master.zip
FastDFS是一款分布式文件系统,功能主要包括:文件存储、文件同步、文件访问(文件上传、文件下载)等,解决了文件大容量存储和 高性能访问的问题。FastDFS特别适合以文件为载体的在线服务,如图片、视频、文档等等...
FastDFS 分布式文件系统实现了文件多台服务器之间分布式存储,附件为 tracker、storage、mod_fastdfs、nginx 软件及详情的安装、配置步骤说明
在Linux下FastDFS+Nginx实现分布式图片服务器搭建详细教程(单机模式)所需要的包,主要包含: fastdfs-5.11.tar.gz fastdfs-nginx-module-1.20.tar.gz libfastcommon-1.0.39.tar.gz nginx-1.17.1.tar.gz
2> 本文称tracker或跟踪服务器是同一个意思 3> 本文称storage或存储服务器是同一个意思FastDFS集群架构图安装集群节点安装所需的依赖包she
FastDFS文件系统安装说明书文件状态:[ √ ] 草稿[ ] 正式发布[ ] 正在修改文件标识当前版本V1.0作 者huangjianwei审 核完成日期版
基于SpringBoot结合分布式文件系统FastDFS实现的文件上传实例demo,可拿来直接嵌入到自己的系统中 文件上传后的路径: group1/M00/00/43/wKgCYVwhkTOAUxZ1AGf8LohRDBw966.jpg 解读: 一、组名:文件上传后所在...
搭配好的FastDFS文件服务器安装包.,不用担心安装时发生版本问题! 可以拿下来,直接跟着博客文章《FastDFS 分布式文件系统安装与集成最后并与SpringBoot 集成文件上传与下载》 来进行安装测试
FastDFS分布式文件系统使用手册 1、概述 1.1、FastDFS简介 FastDFS是由国人余庆所开发,其项目地址:https://github.com/happyfish100,FastDFS是一个轻量级的开源分布式文件系统,主要解决了大容量的文件存储和高...
主要介绍了python-django框架中使用FastDFS分布式文件系统的安装方法,本文图文并茂给大家介绍的非常详细,具有一定的参考借鉴价值 ,需要的朋友可以参考下
一、源码描述 FastDFS特别适合大中型网站使用,用来存储资源文件(如:图片、文档、音频、视频等等) 是一个轻量级的开源分布式文件系统 ,主要解决了大容量的文件存储和高并发访问的问题。 感兴趣的朋友可以下载看...
个人在世界的工作中整理的FastDFS 文件分布式存储配置,服务器采用ubuntu。并实现了java的调用demo