04.FastDFS安装配置
文章目录
1.软件介绍
FastDFS是一个开源的分布式文件系统,她对文件进行管理,功能包括:文件存储.文件同步.文件访问(文件上传.文件下载)等.
FastDFS服务端有两个角色:跟踪器(tracker)和存储节点(storage).跟踪器主要做调度工作,在访问上起负载均衡的作用.
存储节点存储文件,完成文件管理的所有功能:存储.同步和提供存取接口.
参考资料:
http://www.viqq.cn/tech/shouji/28934.html
http://www.viqq.cn/tech/shouji/28934.html
http://deidara.blog.51cto.com/400447/440175
http://www.cnblogs.com/PurpleDream/p/4510279.html
2.下载
我使用的操作系统是 CentOS 6.7 64位
FastDFS:https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz
Libfastcommon:https://codeload.github.com/happyfish100/libfastcommon/tar.gz/V1.0.7
Nginx:http://nginx.org/download/nginx-1.10.0.tar.gz
fastdfs-nginx-module:https://codeload.github.com/happyfish100/fastdfs-nginx-module/zip/master
Pcre:ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz
Zlib:https://sourceforge.net/projects/libpng/files/zlib/1.2.8/zlib-1.2.8.tar.gz/download
3.安装
3.1关闭防火墙
|
|
3.2安装GCC
|
|
3.3安装Libfastcommon
|
|
3.4安装FastDFS
|
|
3.5安装Nginx
|
|
4.配置
4.1创建目录
|
|
4.2创建配置文件
|
|
4.3修改配置文件
cd /etc/fdfs
- 修改 tracker.conf
把 base_path=/home/yuqing/fastdfs
修改为 base_path=/usr/local/fastdfs/fastdfs_tracker
- 修改storage.conf
把 base_path=/home/yuqing/fastdfs
修改为 base_path=/usr/local/fastdfs/fastdfs_storage
把 store_path0=/home/yuqing/fastdfs
修改为 store_path0=/usr/local/fastdfs/fastdfs_storage
把 tracker_server=xx.xx.xx.xx:22122
修改为服务器IP地址,不能是127.0.0.1,例如:
tracker_server=10.0.8.137:22122
- 修改client.conf
把 base_path=/home/yuqing/fastdfs
修改为 base_path=/usr/local/fastdfs/fastdfs_storage
把 tracker_server=xx.xx.xx.xx:22122
修改为服务器IP地址,不能是127.0.0.1,例如:
tracker_server=10.0.8.137:22122
5.启动
5.1启动tracker
|
|
5.2启动storage
|
|
第一次启动有点慢,请耐心等待
5.3测试
|
|
若可以正常返回访问路径,类似
查看日志路径:/usr/local/fastdfs/fastdfs_storage/logs
6.配置Nginx
6.1将FastDFS的nginx插件配置copy到FastDFS配置目录
|
|
6.2编辑Nginx配置
vi /usr/local/nginx/conf/nginx.conf
在server段中添加:
|
|
6.3配置扩展模块
vi /etc/fdfs/mod_fastdfs.conf
一般只需改动以下几个参数即可:
|
|
6.4测试
7.双机集群
集群主要是第二台storage(10.0.8.138)的/etc/fdfs/storage.conf
修改为tracker_server=10.0.8.137:22122
在10.0.8.137上,可以通过fdfs_monitor查看集群的情况,即storage是否已经注册到tracker服务器中
/usr/bin/fdfs_monitor /etc/fdfs/storage.conf
文章作者 springrain
上次更新 2019-06-19