分布式文件系统研究-fastDFS安装及配置文件说明
fastDFS安装
如果想自己尝试安装fastDSF也可以按照文档一步一步安装。
tracker和storage使用相同的安装包,fastDFS的下载地址在:https://github.com/happyfish100/FastDFS
本教程下载安装包:FastDFS_v5.05.tar.gz
FastDFS是C语言开发,建议在linux上运行,本教程使用CentOS7作为安装环境。
Tracker配置
本小节介绍Tracker的配置文件内容。
fastDFS的配置文件目录 :/etc/fdfs
主要的配置文件:/etc/fdfs/tracker.conf (tracker配置文件 );storage.conf(storage配置文件)
tracker.conf配置内容如下:
端口:port=22122
存储策略:store_lookup=
取值范围:0(轮询向storage存储文件)、1(指定具体的group)、2负载均衡,选择空闲的storage存储
指定具体的group:store_group= 如果store_lookup设置为1则这里必须指定一个具体的group。
tracker 基础目录:base_path=/home/fastdfs,tracker在运行时会向此目录存储storage的管理数据。
storage配置
本小节介绍storage的配置文件内容。
storage.conf配置 内容如下:
组名:group_name=group1
端口:port=23000
向tracker心跳间隔(秒):heart_beat_interval=30
storage基础目录:base_path=/home/fastdfs
磁盘存储目录,可定义多个store_path:
store_path0=/home/fastdfs/fdfs_storage 此目录下存储上传的文件,在/home/fastdfs/fdfs_storage/data下
store_path1=...
...
上报tracker的地址:tracker_server=192.168.101.64:22122
如果有多个tracker则配置多个tracker,比如:
tracker_server=192.168.101.64:22122
tracker_server=192.168.101.65:22122
....
启动停止
fastDFS启动/停止脚本目录:
fdfs_trackerd:tracker脚本,通过此脚本对 tracker进行启动和停止
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
fdfs_storaged:storage脚本,通过此脚本对 storage进行启动和停止
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart