018 nginx与第三模块整合[一致性哈希模块整合]
nginx第三方模块官网:http://wiki.nginx.org/HttpUpstreamConsistentHash nginx第三方模块下载地址:https://github.com/replay/ngx_http_consistent_hash/archive/master.zip 下载模块 wget https://github.com/replay/ngx_http_consistent_hash/archive/master.zip 解压:unzip master.zip nginx整合第三方模块 [nginx-1.4.] ./configure --prefix=/usr/local/nginx/ --add-module=/ngx_http_consistent_hash-master/
#杀掉nginx进程
pkill - nginx #重新编译
make && make install cd /usr/local/nginx/ [root@localhost nginx]# ./sbin/nginx [root@localhost nginx]# ls sbin/ 出现:nginx nginx.old 编写conf文件: vim conf/nginx.conf #配置服务器
upstream mcserver{
consistent_hash $request_uri;
server 127.0.0.1:;
server 127.0.0.1:;
server 127.0.0.1:;
} location / { #设置key
set $memcached_key "$uri";
#根据key查找对应的服务器
memcached_pass mcserver;
#出错的时候回调php,查找数据库中的数据
error_page /callback.php;
} #开启memcached ./usr/local/memcached/bin/memcached -m -p -vvv 【注意不能是root用户开启】 ./usr/local/memcached/bin/memcached -u nobody -vv -p 开启telnet telnet 127.0.0.1 回车 ctrl+] 打开回显回车。 #修改callback.php $memc->addServer('127.0.0.1',);
$memc->addServer('127.0.0.1',);
$memc->addServer('127.0.0.1',); #在php.ini中添加
memcache.hash_strategy=consistent 杀掉PHP进程
pkill - php 重新启动php-fpm /usr/sbin/php-fpm 【注意】upstream 做负载均衡时要用IP或者 远程主机名,不能用localhost.
018 nginx与第三模块整合[一致性哈希模块整合]的更多相关文章
- Nginx一致性哈希模块的Lua实现
Nginx一致性哈希模块的Lua重新实现 技术背景: 最近在工作中使用了nginx+redis 的架构,redis在后台做分布式存储,每个redis都存放不同的数据,这些数据都是某门户网站通过Hado ...
- Nginx 第三方模块的安装以及一致性哈希算法的使用
Nginx 第三方模块的安装以及一致性哈希算法的使用 第三方模块安装方法总结: 以ngx_http_php_memcache_standard_balancer-master为例 1:解压 到 pat ...
- Nginx网络架构实战学习笔记(四):nginx连接memcached、第三方模块编译及一致性哈希应用
文章目录 nginx连接memcached 第三方模块编译及一致性哈希应用 总结 nginx连接memcached 首先确保nginx能正常连接php location ~ \.php$ { root ...
- Nginx服务编译安装、日志功能、状态模块及访问认证模式实操
系统环境 [root@web ~]# cat /etc/redhat-release CentOS release 6.9 (Final) [root@web ~]# uname -a Linux d ...
- Nginx的负载均衡 - 一致性哈希 (Consistent Hash)
Nginx版本:1.9.1 我的博客:http://blog.csdn.net/zhangskd 算法介绍 当后端是缓存服务器时,经常使用一致性哈希算法来进行负载均衡. 使用一致性哈希的好处在于,增减 ...
- [译文]Domain Driven Design Reference(三)—— 模型驱动设计的构建模块
本书是Eric Evans对他自己写的<领域驱动设计-软件核心复杂性应对之道>的一本字典式的参考书,可用于快速查找<领域驱动设计>中的诸多概念及其简明解释. 其它本系列其它文章 ...
- nginx介绍(三) 配置篇
3. nginx配置 nginx配置系统受益于Igor Sysoev(nginx创始人)在Apache(阿帕奇软件基金会)的经历.Igor Sysoev洞察出可扩展的配置系统对于一个web服务器来说是 ...
- nginx限制请求之二:(ngx_http_limit_req_module)模块
相关文章: <高可用服务设计之二:Rate limiting 限流与降级> <nginx限制请求之一:(ngx_http_limit_conn_module)模块> <n ...
- Nginx+PHP(FastCGI)高性能服务器加载redis+memcache模块
1)Nginx+FastCGI安装配置: yum install openssl openssl-devel pcre-devel pcre zlib zlib-devel –y #下载Nginx源 ...
随机推荐
- [论文]Clustering-Based Ensembles as an Alternative to Stacking
Clustering-Based Ensembles as an Alternative to Stacking 作者:Anna Jurek, Yaxin Bi, Shengli Wu, and Ch ...
- 转 C++的常量引用
C++的常量引用 如果是对一个常量进行引用,则编译器首先建立一个临时变量,然后将该常量的值置入临时变量中,对该引用的操作就是对该临时变量的操作.对常量的引用可以用其它任何引用来初始化:但不能改变. 关 ...
- 知乎上的一些文章---leetcode【笔记1】
张土汪 http://github.com/shawnfan Java{script}代码仔 42 人赞同 [1.19.2017] 更新: 2017年1月17日, 陪我征战多年的 2014 MackB ...
- Spring积累总结
1.spring 的优点: 1.降低了组件之间的耦合性 ,实现了软件各层之间的解耦 2.可以使用容易提供的众多服务,如事务管理,消息服务等 3.容器提供单例模式支持 4.容器提供了AOP技术,利用它很 ...
- Codeforces 506D Mr. Kitayuta's Colorful Graph(分块 + 并查集)
题目链接 Mr. Kitayuta's Colorful Graph 把每种颜色分开来考虑. 所有的颜色分为两种:涉及的点的个数 $> \sqrt{n}$ 涉及的点的个数 $<= ...
- LoadRunner安装破解
安装过程 1. 运行“setup.exe” 点击安装,其中会有提示缺少“Microsoft Visual C++ 2005 SP1等运行组件”,下载这些组件.这里安装“vcredist_x86.exe ...
- Linked List Cycle - LeetCode
Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using ext ...
- NOI模拟题4 Problem A: 生成树(mst)
Solution 我们考虑答案的表达式: \[ ans = \sqrt{\frac{\sum_{i = 1}^{n - 1} (w_i - \overline{w})^2}{n - 1}} \] 其中 ...
- Linux内核Crash分析
转载自:http://linux.cn/article-3475-1.html 在工作中经常会遇到一些内核crash的情况,本文就是根据内核出现crash后的打印信息,对其进行了分析,使用的内核版本为 ...
- 【IntelliJ IDEA】代码中出现Usage of API documented as @since 1.8+ more..
在idea中写代码过程中.有这种报错出现: Usage of API documented as @since 1.8+ more.. 修改JDK版本的几个地方 最后,在pom.xml文件中添加: & ...