FastDFS文件系统

本文详细介绍了在Linux系统上搭建FastDFS分布式文件系统的步骤,包括安装libevent、libfastcommon、Tracker和Storage服务,以及配置nginx作为HTTP服务。在安装过程中可能遇到的错误和解决方法也一并给出。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

FastFNS分布式文件系统的搭建

FastDNS分布式文件系统基于c++,安装前需要c语言运行环境(同nginx)

第一步:把fastDFS都上传到linux系统。

第二步:安装FastDFS之前,先安装libevent工具包。

执行密令yum -y installlibevent在线安装,

第三步:安装libfastcommonV1.0.7工具包。

下载地址:

https://sourceforge.net/projects/libfastcommon/?source=typ_redirect

1、解压缩

2、./make.sh

3、./make.shinstall


4、把/usr/lib64/libfastcommon.so文件向/usr/lib/下复制一份(32位略过)

错误描述(可能会出现如下错误)

错误:字段‘ev_read’的类型不完全fast_task_queue.h:30:错误:字段‘ev_write’的类型不完全tracker_service.c:在函数‘tracker_service_init’中:tracker_service.c:99:警告:隐式声明函数‘event_base_new’tracker_service.c:99: 警告:赋值时将整数赋给指针,未作类型转换tracker_service.c: 在函数‘work_thread_entrance’中:tracker_service.c:253: 错误:‘ev_notify’的存储大小未知tracker_service.c:258: 警告:隐式声明函数‘event_set’tracker_service.c:259:错误:‘EV_READ’未声明(在此函数内第一次使用)tracker_service.c:259: 错误:(即使在一个函数内多次出现,每个未声明的标识符在其tracker_service.c:259: 错误:所在的函数内也只报告一次。)tracker_service.c:259:错误….

查看资料说是缺少libevent安装

联网状态下运行如下命令:

yum install libevent-devel.x86_64  

yum install libevent-devel后,再次./make.sh, 没看到报错信息了

第四步:安装Tracker服务。

下载tar 包:http://fastdfs.googlecode.com/files/FastDFS_v3.06.tar.gz

http://download.csdn.net/detail/u011650048/8382263

1、解压缩

2、./make.sh

3、./make.shinstall

安装后在/usr/bin/ 或/usr/local/bin/(具体根据程序安装路径决定)目录下有以fdfs开头的文件都是编译出来的。

find fdfs_* 查看文件目录

配置文件都放到/etc/fdfs文件夹

4、把/root/FastDFS/conf(FastDFS安装路径下的conf文件夹)目录下的所有的配置文件都复制到/etc/fdfs下。

5、配置tracker服务。修改/root/FastDFS/conf/tracker.conf文件。(tracker)


6、启动tracker。/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf

重启使用命令:/usr/bin/fdfs_trackerd/etc/fdfs/tracker.conf restart

第五步:安装storage服务。

1、如果是在不同的服务器安装,第四步的1~4需要重新执行。

2、配置storage服务。修改/root/FastDFS/conf/storage.conf文件



3、启动storage服务。

/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart

 

第六步:测试服务。

1、修改配置文件/etc/fdfs/client.conf



2、测试

/usr/bin/fdfs_test/etc/fdfs/client.conf upload anti-steal.jpg

第七步:搭建nginx提供http服务。

可以使用官方提供的nginx插件。要使用nginx插件需要重新编译。

fastdfs-nginx-module_v1.16.tar.gz

下载地址:http://download.csdn.net/download/u011650048/8382249

1、解压插件压缩包

2、修改/root/fastdfs-nginx-module/src/config文件,把其中的local去掉。


3、对nginx重新config

./configure \

--prefix=/usr/local/nginx\

--pid-path=/var/run/nginx/nginx.pid\

--lock-path=/var/lock/nginx.lock\

--error-log-path=/var/log/nginx/error.log\

--http-log-path=/var/log/nginx/access.log\

--with-http_gzip_static_module\

--http-client-body-temp-path=/var/temp/nginx/client\

--http-proxy-temp-path=/var/temp/nginx/proxy\

--http-fastcgi-temp-path=/var/temp/nginx/fastcgi\

--http-uwsgi-temp-path=/var/temp/nginx/uwsgi\

--http-scgi-temp-path=/var/temp/nginx/scgi\

--add-module=/root/fastdfs-nginx-module/src(与正常安装nginx只差了这一句)


4、make

5、make install

6、把/root/fastdfs-nginx-module/src/mod_fastdfs.conf文件复制到/etc/fdfs目录下。编辑:

日志目录以及图片数据目录必须存在要不然会报



第八步nginx的配置

在nginx的配置文件中添加一个Server:

server {

        listen       80;

        server_name  192.168.101.3;

 

        location /group1/M00/{

                #root/home/FastDFS/fdfs_storage/data;

                ngx_fastdfs_module;

        }

}

7、将libfdfsclient.so拷贝至/usr/lib下

cp /usr/lib64/libfdfsclient.so /usr/lib/

8、启动nginx


备注:抱歉上次图片没传上去。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值