设为首页 收藏本站
查看: 1057|回复: 0

[经验分享] Nginx mogilefs module (v 1.0.3)

[复制链接]

尚未签到

发表于 2016-12-25 10:19:42 | 显示全部楼层 |阅读模式
  原文地址:http://www.grid.net.ru/nginx/mogilefs.en.html (在墙外)
  

Nginx mogilefs module (v 1.0.3)


rus eng

  MogileFS client for nginx web server.

Description
  The module queries MogileFS tracker specified by mogilefs_tracker directive and uses first path returned by tracker to fetch requested file. The file key is specified by mogilefs_pass directive. If no domain or no file with specified key is found by tracker "404 Not found" status is retuned. If file is found but zero paths are returned by tracker "503 Service unavailable" status is retuned. If tracker has returned successful response the modules tries to fetch file using path with the greatest priority.
  


Configuration directives

  
syntax: mogilefs_pass [<key>] {<fetch block>}
default: none
severity: mandatory
context: server, location, limit_except
  Specifies key of the file to query from MogileFS tracker. The key can contain any variables. If key is omitted, the part of request URI will be uses as key, which remains after stripping the name of mathced location.

            location /download/ {
mogilefs_pass {
[...]
}
}

  In this example if request URI is /download/example.jpg, the tracker will be queried for file with the key example.jpg.
  The fetch block contains configuration which will be used to fetch file from storage node. In this block it is necessary to use proxy_pass directive with $mogilefs_path as an argument. Example:

            mogilefs_pass {
proxy_pass $mogilefs_path;
proxy_hide_header Content-Type;
proxy_buffering off;
}

  The variable $mogilefs_path contains absolute URL to the file on storage node. The fetch block creates a hidden internal location with the name /mogilefs_fetch_XXXXXXXX, where redirected will be performed after successful tracker response.

  
syntax: mogilefs_methods <[[method 1] method 2 ... ]>
default: GET
severity: optional
context: main, server, location
  Specifies which methods will be allowed to access MogileFS. GET retrieves a resource from MogileFS, PUT creates or replaces, DELETE deletes a resource in MogileFS.

  
syntax: mogilefs_domain <domain>
default: default
severity: optional
context: main, server, location
  Specifies the name of MogileFS domain to query. The specification may contain variables.

  
syntax: mogilefs_class <class0> [ <class1> [ ... ] ]
default: N/A
severity: optional
context: main, server, location
  This directive specifies what to use as "class" parameter when making a request to tracker. The arguments of this directives will be evaluated and first non-empty value will be used as class. Arguments can contain variables.

  
syntax: mogilefs_tracker <IP|IP:port|upstream>
default: none
severity: mandatory
context: main, server, location
  Specifies address of MogileFS tracker to query.

  
syntax: mogilefs_noverify <on/off>
default: off
severity: optional
context: main, server, location
  Enables sending of noverify argument to MogileFS.

  
syntax: mogilefs_connect_timeout <time>
default: 60s
severity: optional
context: main, server, location
  Specifies a timeout to be used to connect to mogilefs tracker. Could not be longer than 75 seconds.

  
syntax: mogilefs_send_timeout <time>
default: 60s
severity: optional
context: main, server, location
  Specifies a timeout to be used to send data to mogilefs tracker. If no data will be received by mogilefs tracker during this time interval, nginx will close the connection.

  
syntax: mogilefs_read_timeout <time>
default: 60s
severity: optional
context: main, server, location
  Specifies a timeout to be used to receive data from mogilefs tracker. If no data will be send by mogilefs tracker during this time interval, nginx will close the connection.


Example configuration

error_log  logs/error.log notice;
working_directory /usr/local/nginx;
http {
include       mime.types;
default_type  application/octet-stream;
server {
listen       80;
#
# This location could be used to retrieve files from MogileFS.
# It is publicly available.
#
location /download/ {
#
# Query tracker at 192.168.2.2 for a file with the key
# equal to remaining part of request URI
#
mogilefs_tracker 192.168.2.2;
mogilefs_domain example_domain;
mogilefs_pass {
proxy_pass $mogilefs_path;
proxy_hide_header Content-Type;
proxy_buffering off;
}
}
#
# This location could be used to store or delete files in MogileFS.
# It may be configured to be accessable only from local network.
#
location /upload/ {
allow 192.168.2.0/24;
deny all;
mogilefs_tracker 192.168.2.2;
mogilefs_domain example_domain;
mogilefs_methods PUT DELETE;
mogilefs_pass {
proxy_pass $mogilefs_path;
proxy_hide_header Content-Type;
proxy_buffering off;
}
}
}
}

  
Requirements
  nginx 0.7.1 or above is required to compile this module.

Download


  Latest version 1.0.3: 


FileMD5SHA1
nginx_mogilefs_module-1.0.3.tar.gze3c1b9f4ceb26d7573af5acfda59e9a8d17d36b3f1ee4902379aaccc3bf993fec89911a0
nginx_mogilefs_module-1.0.3.zip3ea34b9d99c3cb8cf1a733642ab2d96665566dc205f05c7d3f8414163b09108187539244
  
or go to download area
  
Browse repository


  http://github.com/vkholodkov/nginx-mogilefs-module/tree/master 
  



How to use
  Download sources from one of the links above. Unpack the archive:

tar xvzf nginx_mogilefs_module-1.0.3.tar.gz
  Configure nginx with additional module:

cd <path to nginx sources>
./configure --add-module=<path to mogilefs module sources>
make
make install
Nginx


  nginx -- is a web-server, developed by Igor Sysoev.

Licence
  The above-described module is an addition to nginx web-server, nevertheless they are independent products. The licence of above-described module is BSD You should have received a copy of license along with the source code. By using the materials from this site you automatically agree to the terms and conditions of this license. If you don't agree to the terms and conditions of this license, you must immediately remove from your computer all materials downloaded from this site.

Contact author
  Valery Kholodkov valery+nginx@grid.net.ru
Please use address extension while composing an Email to me.

  Copyright (C) 2009 Valery Kholodkov

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-319089-1-1.html 上篇帖子: 深入浅出分布式文件系统MogileFS集群 下篇帖子: mogilefs + nginx 图片分布式存储
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表