首页 > 其他 > 详细

FastDFS-5.05安装笔记

时间:2015-11-23 18:26:05      阅读:420      评论:0      收藏:0      [点我收藏+]

FastDFS-5.05安装笔记

@enviroment CentOS-6.6 64bit @author 陈景贵 @since 2015年11月18日


简介

fastdfs是高性能的的分布式文件系统,他主要的功能包括:文件存储,同步和访问,设计基于高可用和负载均衡

1. FastDFS 5 使用libfastcommon库替代libevent

  1. cd /download
  2. git clone https://github.com/happyfish100/libfastcommon.git
  3. 指定安装目录 

    修改 libfastcommon/src/Makefile.in 大约在52行

     mkdir -p $(DESTDIR)/usr/local/libfastcommon/$(LIB_VERSION)  
     install -m 755 $(SHARED_LIBS) $(DESTDIR)/usr/local/libfastcommon/$(LIB_VERSION)  
     mkdir -p $(DESTDIR)/usr/local/libfastcommon/include  
     install -m 644 $(HEADER_FILES) $(DESTDIR)/usr/local/libfastcommon/include  
    
  4. ./make.sh
  5. ./make.sh install。这样这个库就被成功安装到了 /usr/local/libfastcommon
  6. 建立2个软链到lib目录(tracker和storage的运行需要用到)
     cd /usr/local/libfastcommon/lib64/  
     ln -s libfastcommon.so /usr/lib/libfastcommon.so  
     ln -s libfastcommon.so /usr/lib64/libfastcommon.so  
    

2. 从 github https://github.com/happyfish100/fastdfs

选择tags5.05 下载最新的发布版本5.05

3. 修改 make.sh文件 大约在61行

╔═══════════════════════════════════════╗
║ TARGET_PREFIX=$DESTDIR/usr/           ║
║ TARGET_CONF_PATH=$DESTDIR/usr/fdfs    ║
║ TARGET_INIT_PATH=$DESTDIR/etc/init.d  ║
╚═══════════════════════════════════════╝
改为  
TARGET_PREFIX=/opt/FastDFS-5.05  
TARGET_CONF_PATH=/opt/FastDFS-5.05/conf  
TARGET_INIT_PATH=$DESTDIR/etc/init.d  

旧版的需要开启with_httpd, 这里请保留使用WITH_LINUX_SERVICE=1

4. 修改 tracker 和 storage 的配置文件

配置详细解释:http://bbs.chinaunix.net/thread-1941456-1-1.html

tracker:
base_path=/data/fastdfs/tracker
storage:
base_path=/data/fastdfs/storage
store_path0=/data/fastdfs/storage
tracker_server=172.18.107.194:22122
[subdir_count_per_path=2] 为测试方便,将子目录设为2个, 默认创建256*256个很耗时 
得到文件:
/opt/FastDFS-5.05/conf/tracker.conf
/opt/FastDFS-5.05/conf/storage.conf

备份storage的端口必须一致,无法在同一台机器上配置多个同组storeage

除了端口,还有子目录数也要一致等

ps:没钱没机器就别玩高可用

5. 启动服务

tracker:
/opt/FastDFS-5.05/bin/fdfs_trackerd /opt/FastDFS-5.05/conf/tracker.conf
[请先启动tracker, 因为启动storage后会定时发心跳到tracker],正常启动会很快看到trackerd服务

netstat -tunlp  
---
tcp     0   0   0.0.0.0:22122   0.0.0.0:*   LISTEN      16105/fdfs_trackerd

storage:
/opt/FastDFS-5.05/bin/fdfs_storaged /opt/FastDFS-5.05/conf/storage.conf
如果创建目录不多,会很快看到storaged服务

netstat -tunlp  
---
tcp     0   0   0.0.0.0:23000   0.0.0.0:*   LISTEN      16105/fdfs_storaged 

6. 测试上传文件

client:

t 是我自己创建的一个文件
---
base_path=/data/fastdfs/client  
tracker_server=172.18.107.194:22122  
/opt/FastDFS-5.05/bin/fdfs_test /opt/FastDFS-5.05/conf/client.conf upload t  

7. 启动、关闭、监控

cd  /opt/FastDFS-5.05/bin/
---
关闭 stop.sh /opt/FastDFS-5.05/bin/fdfs_storaged
重启 fdfs_trackerd /opt/FastDFS-5.05/conf/tracker.conf [start|stop|restart]  
     fdfs_storaged /opt/FastDFS-5.05/conf/storag.conf [start|stop|restart]  
查看集群: fdfs_monitor /opt/FastDFS-5.05/conf/client.conf

8. 高可用storage,tracker配置

  1. 保证配置内容一模一样
  2. 使用2台以上的机器分别启动
     cd /opt/FastDFS-5.05/conf/  
     mkdir -p /data/fastdfs/tracker  
     /opt/FastDFS-5.05/bin/fdfs_trackerd tracker.conf start  
     mkdir -p /data/fastdfs/group1  
     /opt/FastDFS-5.05/bin/fdfs_storaged storage1.conf start  
     mkdir -p /data/fastdfs/group2  
     /opt/FastDFS-5.05/bin/fdfs_storaged storage2.conf start  
     mkdir -p /data/fastdfs/client  
     /opt/FastDFS-5.05/bin/fdfs_monitor client.conf  
     /opt/FastDFS-5.05/bin/fdfs_test client.conf upload t  
    

fastdfs-nginx-module_v1.15 后续再补全

FastDHT 后续再补全

FastDFS-5.05安装笔记

原文:http://www.cnblogs.com/anole/p/4988820.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!