2019独角兽企业重金招聘Python工程师标准>>>

一 存储(storage)节点安装Nginx和fastdfs-nginx-module模块

在storage服务上安装nginx和fastdfs-nginx-module模块

主要目的是为了提供 http 的访问服务,同时解决 group 中 storage服务器的同步延迟问题。
nginx中需要添加fastdfs-nginx-module模块。

fastdfs-nginx-module的下载地址:

http://nchc.dl.sourceforge.net/project/fastdfs/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz

1下载fastdfs-nginx-module并且安装nginx

[root@localhost tools]# wget http://nchc.dl.sourceforge.net/project/fastdfs/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz
--2017-09-07 08:35:43--  http://nchc.dl.sourceforge.net/project/fastdfs/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz
Resolving nchc.dl.sourceforge.net... 211.79.60.17, 2001:e10:ffff:1f02::17
Connecting to nchc.dl.sourceforge.net|211.79.60.17|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 17510 (17K) [application/x-gzip]
Saving to: “fastdfs-nginx-module_v1.16.tar.gz”100%[===============================================================================================================================================================>] 17,510      42.3K/s   in 0.4s    2017-09-07 08:35:45 (42.3 KB/s) - “fastdfs-nginx-module_v1.16.tar.gz” saved [17510/17510]
## 安装nginx所需的依赖包
shell> yum install gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl openssl-devel
## 编译安装nginx(添加fastdfs-nginx-module模块)
shell> cd /usr/local/src
shell> tar -zxvf nginx-1.8.1.tar.gz
shell> tar -zxvf fastdfs-nginx-module-master.zip
shell> cd nginx-1.10.0
shell> ./configure --prefix=/usr/nginx --sbin-path=/usr/bin/nginx --add-module=/usr/local/src/fastdfs-nginx-module/src
shell> make && make install

make时候报错:

/usr/tools/fastdfs-nginx-module/src/ngx_http_fastdfs_module.c:882: error: ‘struct fdfs_http_context’ has no member named ‘arg’
/usr/tools/fastdfs-nginx-module/src/ngx_http_fastdfs_module.c:883: error: ‘struct fdfs_http_context’ has no member named ‘header_only’
/usr/tools/fastdfs-nginx-module/src/ngx_http_fastdfs_module.c:884: error: ‘struct fdfs_http_context’ has no member named ‘url’
/usr/tools/fastdfs-nginx-module/src/ngx_http_fastdfs_module.c:885: error: ‘struct fdfs_http_context’ has no member named ‘output_headers’
/usr/tools/fastdfs-nginx-module/src/ngx_http_fastdfs_module.c:886: error: ‘struct fdfs_http_context’ has no member named ‘send_file’
/usr/tools/fastdfs-nginx-module/src/ngx_http_fastdfs_module.c:887: error: ‘struct fdfs_http_context’ has no member named ‘send_reply_chunk’
/usr/tools/fastdfs-nginx-module/src/ngx_http_fastdfs_module.c:887: error: ‘fdfs_send_reply_chunk’ undeclared (first use in this function)
/usr/tools/fastdfs-nginx-module/src/ngx_http_fastdfs_module.c:888: error: ‘struct fdfs_http_context’ has no member named ‘proxy_handler’
/usr/tools/fastdfs-nginx-module/src/ngx_http_fastdfs_module.c:894: error: ‘struct fdfs_http_context’ has no member named ‘if_modified_since’
/usr/tools/fastdfs-nginx-module/src/ngx_http_fastdfs_module.c:897: error: ‘struct fdfs_http_context’ has no member named ‘if_modified_since’
/usr/tools/fastdfs-nginx-module/src/ngx_http_fastdfs_module.c:927: error: ‘struct fdfs_http_context’ has no member named ‘range’
/usr/tools/fastdfs-nginx-module/src/ngx_http_fastdfs_module.c:933: error: ‘struct fdfs_http_context’ has no member named ‘if_range’
/usr/tools/fastdfs-nginx-module/src/ngx_http_fastdfs_module.c:933: error: ‘true’ undeclared (first use in this function)
make[1]: *** [objs/addon/src/ngx_http_fastdfs_module.o] Error 1
make[1]: Leaving directory `/usr/tools/nginx-1.8.1'
make: *** [install] Error 2

解决办法:
执行以下2条命令,然后重新make&make install

# ln -sv /usr/include/fastcommon /usr/local/include/fastcommon
# ln -sv /usr/include/fastdfs /usr/local/include/fastdfs

2 复制 fastdfs-nginx-module 源码中的配置文件到/etc/fdfs 目录,并修改

cp /usr/tools/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
vi /etc/fdfs/mod_fastdfs.conf
connect_timeout=10
base_path=/tmp
tracker_server=192.168.184.132:22122
storage_server_port=23000
group_name=group1
url_have_group_name=true
store_path0=/fastdfs/storage

3 复制FastDFS源文件目录中HTTP相关的配置文件到/etc/fdfs目录

cd /usr/tools/FastDFS/conf
cp http.conf mime.types /etc/fdfs/

4 创建数据存放目录的软链接

ln -s /fastdfs/storage/data/ /fastdfs/storage/data/M00

5 配置fastdfs-nginx-module

http {include       mime.types;default_type  application/octet-stream;#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '#                  '$status $body_bytes_sent "$http_referer" '#                  '"$http_user_agent" "$http_x_forwarded_for"';#access_log  logs/access.log  main;sendfile        on;#tcp_nopush     on;#keepalive_timeout  0;keepalive_timeout  65;#gzip  on;server {listen       8080;server_name  localhost;#charset koi8-r;#access_log  logs/host.access.log  main;location / {root   html;index  index.html index.htm;}#error_page  404              /404.html;# FastDFS 文件访问配置(fastdfs-nginx-module模块)location ~/group([0-9])/M00 {ngx_fastdfs_module;}# redirect server error pages to the static page /50x.html#error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}

Storage 对应有多个 group 的情况下,访问路径带 group 名,如:http://xxxx/group1/M00/00/00/xxx, 对应的 Nginx 配置为:

location ~/group([0-9])/M00 {ngx_fastdfs_module;
}

6启动nginx

[root@localhost sbin]# ./nginx
ngx_http_fastdfs_set pid=5930

7 浏览器访问文件测试

http://192.168.184.132:8080/group1/M00/00/00/wKi4hFmxZJ6AYqyCAAAADFmwwCQ352.txt

这是上篇内容上传的某个txt测试文件,内容为hello world

这里我上传一个window图片测试看下

[root@localhost bin]# fdfs_upload_file /etc/fdfs/client.conf /usr/tools/window.png
group1/M00/00/00/wKi4hFmxdpuAbAwtAAdXoefn-Kg866.png
[root@localhost bin]#

然后浏览器访问

http://192.168.184.132:8080/group1/M00/00/00/wKi4hFmxdpuAbAwtAAdXoefn-Kg866.png

转载于:https://my.oschina.net/u/3164861/blog/1531388

分布式文件系统FastDFS+nginx的使用配置相关推荐

  1. 分布式文件系统FastDFS 架构剖析及配置优化

    FastDFS概述 FastDFS是一款开源的轻量级分布式文件系统 – 纯C实现,支持Linux.FreeBSD等UNIX系统 – 类google FS,不是通用的文件系统,只能通过专有API访问,目 ...

  2. 高可用高性能分布式文件系统FastDFS实践Java程序

    在前篇 高可用高性能分布式文件系统FastDFS进阶keepalived+nginx对多tracker进行高可用热备 中已介绍搭建高可用的分布式文件系统架构. 那怎么在程序中调用,其实网上有很多栗子, ...

  3. 分布式文件系统FastDFS架构剖析

    文/余庆 FastDFS是一款类Google FS的开源分布式文件系统,它用纯C语言实现,支持Linux.FreeBSD.AIX等UNIX系统.它只能通过专有API对文件进行存取访问,不支持POSIX ...

  4. 实战:轻量级分布式文件系统FastDFS(GraphicsMagick图片压缩)

    轻量级分布式文件系统FastDFS--实现用户头像上传/压缩屏幕适配 一.需求分析 1.1 业务场景: 用户上传的头像图片大小不一.手机和PC等设备显示尺寸也存在差异,因此需要能根据http请求指定的 ...

  5. 网站文件系统发展分布式文件系统fastDFS

    网站文件系统发展 1.单机时代的图片服务器架构 初创时期由于时间紧迫,开发人员水平也很有限等原因.所以通常就直接在website文件所在的目录下,建立1个upload子目录,用于保存用户上传的图片文件 ...

  6. 分布式文件系统FastDFS详解-附带视频教程

    目录 1.FastDFS教程 2.FastDFS安装 安装FastDFS FastDFS配置文件详解 FastDFS启动 3.FastDFS重启与FastDFS关闭 FastDFS关闭 4.FastD ...

  7. 分布式文件系统----FastDFS

    FastDFS 1.分布式文件系统 1.1 FastDFS简介 1.2 FastDFS整体架构 1.3 FastDFS的存储策略 1.4 FastDFS的上传过程 1.5 FastDFS的文件同步 1 ...

  8. 轻量级分布式文件系统FastDFS使用安装说明手册(新手入门级)

    轻量级分布式文件系统FastDFS使用安装说明手册(新手入门级) 实验室所在的课题组以研究云计算为主,但所有的研究都是在基于理论的凭空想像,缺少分布式环境的平台的实践,云计算神马的都是浮云了.因此,我 ...

  9. (转)淘淘商城系列——分布式文件系统FastDFS

    http://blog.csdn.net/yerenyuan_pku/article/details/72801777 商品添加的实现,包括商品的类目选择,即商品属于哪个分类?还包括图片上传,对于图片 ...

最新文章

  1. RTX组织架构刷新出现了问题
  2. SQLSERVER拆分字符串的函数(表值函数)
  3. Linux:进程实例信息(/proc)
  4. PCM设备在电网系统中的应用介绍
  5. C语言学习及应用笔记之四:C语言volatile关键字及其使用
  6. Debian11安装VLC Media Player视频播放器
  7. mac升级10.12后,安全和隐私中没有了安装任何来源的选项的解决办法
  8. 【Java线程】深入理解Volatile关键字和使用
  9. 哪些深度相机有python接口_用树莓派和YOLO打造一个深度学习照相机
  10. 前端每日一算(我掐指一算,這题不难~入门啊入门)
  11. 事务方法调用事务方法_实现系统调用的几种方法
  12. mongodb 学习笔记--- 基础知识
  13. qstring如何初始化_qstringlist 初始化
  14. 基于Eviews的稳定性检验——以个股的β系数为例(含ADF检验步骤及结果分析)
  15. 1080i和1080p区别
  16. c# 蓝牙虚拟串口_32feet.net 蓝牙虚拟串口编程
  17. vue项目将localhost改成自己的ip访问
  18. Linux笔记:文本编辑器nano简单说明
  19. 第三十五天:XSS跨站反射存储DOM盲打劫持
  20. 【JAVA|Swing】简单表格的制作

热门文章

  1. Android之ViewPager讲解
  2. Hadoop伪分布式环境搭建
  3. 人工智能实践:TensorFlow笔记学习(六)—— 全连接网络实践
  4. (iOS-框架封装)AFN3.x 网络请求封装
  5. swift_029(Swift 的泛型)
  6. BZOJ1095 [ZJOI2007]Hide 捉迷藏 【动态点分治 + 堆】
  7. 2018年各大互联网前端面试题四(美团)
  8. JavaScript的前世今生
  9. HDU 1574 RP问题
  10. 【转载】应读者强烈要求给出《超容易的Linux系统管理入门书》一书的主要知识点...