nginx+FastDFS文件系统搭建
来源:互联网 发布:php秒赞源码分享 编辑:程序博客网 时间:2024/06/10 19:39
- 安装编译(FDFS)环境
yum -y groupinstall 'Development Tools' yum -y install wget
2.下载安装libfastcommon
git clone https://github.com/happyfish100/libfastcommon.git cd libfastcommon/ ./make.sh ./make.sh install
3.下载安装fastdfs
https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz tar -zxvf V5.05.tar.gz cd fastdfs-5.05/ ./make.sh ./make.sh install
4.修改配置文件
-data -fdfs -tracker -storage -client
5.配置tracker
cd /etc/fdfs mv tracker.conf.sample tracker.conf vi tracker.conf //... base_path=/data/fdfs/tracker //...
配置storage
cd /etc/fdfs mv storage.conf.sample storage.conf vi storage.conf //... base_path=/data/fdfs/storage #指定日志位置 store_path0=/data/fdfs/storage #指定数据位置 tracker_server=192.168.153.130:22122 #指定tracker服务器地址 //...
配置client
cd /etc/fdfs mv client.conf.sample client.conf vi client.conf //... base_path=/data/fdfs/client tracker_server=192.168.153.130:22122 //...
6.启动tracker和storage
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf /usr/bin/fdfs_storaged /etc/fdfs/storage.conf
7.测试
#上传 /usr/bin/fdfs_test /etc/fdfs/client.conf upload /home/lily/a.txt #下载 /usr/bin/fdfs_download_file /etc/fdfs/client.conf group1/M00/00/00/wKiZglauvkmANC2wAAAAPpWmuhI171.txt #删除 /usr/bin/fdfs_delete_file /etc/fdfs/client.conf group1/M00/00/00/wKiZglauvkmANC2wAAAAPpWmuhI171.txt
安装Nginx+fastdfs-nginx-module
1. 下载nginx和fastdfs-nginx-module的安装包
tar -zxvf nginx-1.10.1.tar.gz cd nginx-1.10.1./configure --prefix=/usr/local/nginx (--prefix是安装到那个目录下)makemake install
2.安装完nginx后进行nginx的配置
cd /usr/local/nginx/conf vi nginx.conf //这里编辑的是安装目录中的配置文件
3.在server节点加入下面的配置
location /group1/M00{root /data/fdfs/storage/data; //该路径是真正储存图片的路径ngx_fastdfs_module;}
4.安装和配置nginx插件fastdfs-nginx-module
tar -zxvf fastdfs-nginx-module_v1.16.tar.gz cd fastdfs-nginx-module/src/ vi config (CORE_INCS="$CORE_INCS /usr/local/include/fastdfs /usr/local/include/fastcommon/" CORE_LIBS="$CORE_LIBS -L/usr/lib -lfastcommon -lfdfsclient")//修改配置文件里的东西和括号里的一样,不然编译的时候会保存
5.接着需要将插件添加到nginx
cd /root/nginx-1.10.1/ ./configure --add-module=/root/fastdfs-nginx-module/src/ //将文件上传模块增减到nginx中makemake install
6.拷贝并修改fastdfs-nginx-module的配置文件
cp /root/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs
vim 修改/etc/fdfs/mod_fastdfs.conf 保存退出
修改如下几项:
tracker_server=192.168.1.188:22122
store_path0=/data/fastdfs/storage
base_path=/data/fastdfs/storage/data
url_have_group_name = true(配置多个tracker时,应该将此项设置为true)
建立软连接(配置文件中storage存放数据的路径)
ln -s /data/fastdfs/storage/data /data/fastdfs/storage/data/M00
将FastDFS_v4.06配置目录下的2个文件复制到/etc/fdfs目录下:
cp /usr/local/fastdfs-5.05/conf/http.conf .
cp /usr/local/fastdfs-5.05/conf/mime.types .
最后:
// 启动nginx/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf //启动fdfs/usr/bin/fdfs_trackerd /usr/soft/fastdfs-5.05/conf/tracker.conf start/usr/bin/fdfs_storaged /usr/soft/fastdfs-5.05/conf/storage.conf start
测试上传下载
- nginx+FastDFS文件系统搭建
- FastDFS+Nginx搭建分布式文件系统
- fastdfs nginx 搭建分布式文件系统(单机模式)
- 搭建fastdfs文件系统
- nginx fastDFS 搭建安装
- 【Nginx】FastDFS搭建
- Nginx+fastDFS-nginx-module+FastDFS配置分布式文件系统
- Nginx+fastDFS-nginx-module+FastDFS配置分布式文件系统
- FastDFS+nginx搭建配置信息
- nginx + FastDFS分布式文件服务器搭建
- 分布式文件系统FastDFS+nginx配置详解
- FastDFS+Nginx轻量级分布式文件系统安装使用
- FastDFS+Nginx轻量级分布式文件系统安装使用
- 分布式文件系统 FastDFS 与nginx 结合
- ubuntu16.04+fastdfs+nginx分布式文件系统
- FastDFS+Nginx+fastdfs-nginx-module分布式存储环境搭建
- 搭建FastDFS,Nginx,fastdfs-nginx-module图片资源服务器
- 【FastDFS分布式文件系统之一】:搭建、部署、配置
- Android raw,assets目录源使文件格式使用
- 架构设计:负载均衡层设计方案(8)——负载均衡层总结上篇
- mapreduce实例教程
- 淘淘商城系列——展示购物车商品列表
- Lauterbarch 使用记录
- nginx+FastDFS文件系统搭建
- jquery 选择器总结
- 提取文件后缀名,生成随机字符串
- 架构设计:负载均衡层设计方案(9)——负载均衡层总结下篇
- Docker搭建Swarm集群
- 【Java并发编程】之七:使用synchronized获取互斥锁的几点说明
- celery实现任务统一收集、分发执行
- js 中的执行上下文
- Spring Data MongoDB 一:入门篇(环境搭建、简单的CRUD操作)