FastDFS安装指南

来源:互联网 发布:java程序员 常用软件 编辑:程序博客网 时间:2024/06/05 18:57

引言: FastDFS是国人开发的一款轻量级的分布式文件系统,本文讲描述如何基于Linux来进行快速安装。


1. FastDFS

 FastDFS是一个开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储、文件同步、文件访问(文件上传、文件下载)等,解决了大容量存储和负载均衡的问题。特别适合以文件为载体的在线服务,如相册网站、视频网站等等。

2.  安装环境

  Ubuntu 15.05

3.  安装步骤

 a. 下载源代码 git clonehttps://github.com/happyfish100/fastdfs.git

 b.  编译并安装common包   

<style type="text/css">p { margin-bottom: 0.1in; line-height: 120%; }a:link {  }</style><p style="margin-bottom: 0in; line-height: 100%">git clone<a target=_blank href="https://github.com/happyfish100/libfastcommon.git">https://github.com/happyfish100/libfastcommon.git</a></p>./make.sh sudo ./make.sh install   ### 安装

  c. 进入到fastdfs的目录,安装之

./make.sh    ### 编译原代码 sudo ./make.sh install  ### 安装应用

检查fastdfs的安装之后的文件信息

4. FastDFS的配置

4.1 配置Tracker跟踪器,开放tracker监听端口访问

 

4.2 复制tracker.conf

sudo cp tracker.conf.sample tracker.conf
4.3 从安装源目录复制配置文件

 sudo cp ~/sourcecode/fastdfs/conf/http.conf . sudo cp ~/sourcecode/fastdfs/conf/mime.types 
4.4 设置配置的路径

 sudo sed -i 's:base_path=.*:base_path=/data/fastdfs:g' tracker.conf   sudo sed -i 's:http.server_port=.*:http.server_port=80:g' tracker.conf
4.5 启动tracker服务

sudo  /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
4.6  检查日志

cat/data/fastdfs/logs/trackerd.log

通过日志,可以发现tracker已经正常启动了。


5. Storage服务启动

5.1开放tracker监听端口访问

 firewall-cmd --zone=public --add-port=23000/tcp –permanent firewall-cmd --reload

5.2 配置存储文件,并设置

cd /etc/fdfs cp storage.conf.sample storage.conf  sed -i 's:base_path=.*:base_path=/data/fastdfs:g' storage.conf sed -i 's:store_path0=.*:store_path0=/data/fastdfs:g' storage.conf sed -i 's/tracker_server=.*/tracker_server=192.168.71.126:22122/g' storage.conf sed -i 's:http.server_port=.*:http.server_port=80:g' storage.conf

5.3启动storage服务,并检查日志

启动命令:sudo/usr/bin/fdfs_storaged /etc/fdfs/storage.conf

查看日志: cat/data/fastdfs/logs/storaged.log

6.客户端测试

tracker,storage之外的一台主机上安装FastDFS,然后执行

以下的操作需要切换到fastdfs的源目录下,其中有个client的目录,放入以下命令.

上传测试:

查看文件信息:

下载文件:

7. FAQ:

Q1:error while loading shared libraries:libfastcommon.so

 bladestone@BladeStone-Laptop:/etc/fdfs$ sudo /usr/bin/fdfs_trackerd/etc/fdfs/tracker.conf

/usr/bin/fdfs_trackerd: error while loading shared libraries:libfastcommon.so: cannot open shared object file: No such file ordirectory

检查发现libfastcommon.so其实是存在的,位置在/usr/lib64/libfastcommon.so

修复办法:ln -s /usr/lib64/libfastcommon.so/usr/lib/libfastcommon.so










0 0
原创粉丝点击