@enviroment CentOS-6.6 64bit @author 陈景贵 @since 2015年11月18日
fastdfs是高性能的的分布式文件系统,他主要的功能包括:文件存储,同步和访问,设计基于高可用和负载均衡
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
cd /usr/local/libfastcommon/lib64/
ln -s libfastcommon.so /usr/lib/libfastcommon.so
ln -s libfastcommon.so /usr/lib64/libfastcommon.so
选择tags5.05 下载最新的发布版本5.05
╔═══════════════════════════════════════╗
║ 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
配置详细解释:http://bbs.chinaunix.net/thread-1941456-1-1.html
base_path=/data/fastdfs/tracker
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:没钱没机器就别玩高可用
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
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
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
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
原文:http://www.cnblogs.com/anole/p/4988820.html