nginx反代mogilefs实现
来源:互联网 发布:java投票统计 编辑:程序博客网 时间:2024/05/16 06:50
一、网络拓扑
二、说明
1、规划说明
实验共有5台主机,nginx做为前端反向代理接收用户请求;mariadb作为存储mogilefs元数据的数据库;剩下的三台主机分别安装tracker+mogstore。
2、nginx反代流程
为了能够基于URL进行(而非fid),nginx需要安装一个第三方的mogilefs模块(nginx-mogilefs就是利用mogilefs的API开发的一个应用程序)来自动转换fid到URL的映射;当用户请求来的时候,nginx通过location的判定明确知道这是一个存储在后端mogilefs应用的话,将会启用反向代理机制,nginx把自己扮演为mogilefs的客户端,此时把URL当作键直接向后端发起文件查询请求,tracker就会返回一个地址;nginx再次扮演成客户端到对应的mogstored进程上取,当nginx拿到后就去响应前端的http请求
三、MogileFS分布式文件系统的实现
请参考博客 http://www.it165.net/admin/html/201405/3056.html
四、配置nginx服务器
1、解压nginx-mogilefs-module-master.zip模块
2、先停止nginx服务器,编译安装第三方模块
cd nginx-1.4.7./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-pcre --add-module=/root/mogilefs/nginx-mogilefs-module-mastermake && make install
3、修改nginx配置文件
<pre class="html" name="code">[root@shuishui ~]# vim /etc/nginx/nginx.confhttp { 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; upstream mogcluster { #定义upstream,做负载均衡轮调 server 172.16.7.200:7001; server 172.16.7.201:7001; server 172.16.7.202:7001; } server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; } location /images/ { #增加此location mogilefs_tracker mogcluster; mogilefs_domain images; mogilefs_methods GET PUT DELETE; mogilefs_pass { proxy_pass $mogilefs_path; proxy_hide_header Content-Type; proxy_buffering off; } } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }}
五、基于key做访问测试
浏览器中访问地址 http://localhost:8080/images/linux.jpg
0 0
- nginx反代mogilefs实现
- nginx反代mogilefs实现海量小文件存储
- nginx反代mogilefs实现海量小文件存储
- Keepalived实现Nginx反代的高可用
- 在MogileFS中使用nginx代替perlbal实现internal redirect
- 在MogileFS中使用nginx代替perlbal实现internal redirect
- Linux之使用MogileFS分布式文件系统并使用nginx实现反向代理
- mogilefs
- mogilefs
- Nginx mogilefs module - 绝对是个好东西
- mogilefs + nginx 图片分布式存储spring配置
- Nginx mogilefs module (v 1.0.4)文档
- 实现基于mysql主从模式的mogilefs
- 实验:实现Mogilefs分布式存储服务
- 使用apache反代tomacat
- 通过 nginx 搞了一个反代,整合 谷歌学术, V2EX ,知乎等搜索的页面
- Nginx反爬虫
- 安装nginx、php、mysql、MogileFS等需要安装的依赖库和工具包
- Android高手进阶——Android内存性能优化
- 轻量级Java EE企业应用实战-----17、二级缓存和查询缓存
- Hi CSDN
- PL/SQL Developer编码格式设置及中文乱码解决方案分享
- Unix网络编程学习笔记之第1章 简介
- nginx反代mogilefs实现
- 点击LinearLayout使用selector改变TextView字体颜色
- Android快速开发系列 10个常用工具类
- HTTP头
- 《实体解析与信息质量》- 2.1.4 信息质量管理
- kyeremal-poj2104-K-th Number-主席树
- 加载项目时:-pie can only be used when targeting iOS 4.2 or later 错误
- nyoj1112 求次数 (对结构体字符串排序)
- 浮点数的存储