参见本博博文
http://blog.csdn.net/tao_627/article/details/78936447
worker_processes 1;
user root;
error_log logs/error.log info;events {worker_connections 1024;
}http {upstream apache.org {server apache.org;}upstream nginx.org {server nginx.org;}server {listen 8080;location = /redis {internal;set_unescape_uri $key $arg_key;redis2_query get $key;redis2_pass 127.0.0.1:6379;}location / {set $target '';access_by_lua 'local key = ngx.var.http_user_agentlocal res = ngx.location.capture("/redis", { args = { key = key } })print("key: ", key)if res.status ~= 200 thenngx.log(ngx.ERR, "redis server returned bad status: ",res.status)ngx.exit(res.status)endif not res.body thenngx.log(ngx.ERR, "redis returned empty body")ngx.exit(500)endlocal parser = require "redis.parser"local server, typ = parser.parse_reply(res.body)if typ ~= parser.BULK_REPLY or not server thenngx.log(ngx.ERR, "bad redis response: ", res.body)ngx.exit(500)endprint("server: ", server)ngx.var.target = server';proxy_pass http://$target;}}
}
对性能调优,我们能想到的就是,对redis连接开启连接池,参见Redis2 Nginx Module's README等文档
6.参考文献
[1].https://openresty.org/cn/dynamic-routing-based-on-redis.html
#vim /etc/init.d/redis 粘贴以下内容 # chkconfig: 2345 10 90 # description: Start and Stop redis PATH=/usr/local/bin:/sbin:/usr/bin:/bin REDISPORT=6379 #实际环境而定 EXEC=/us...
1、打开https://redis.io/在Download it下面直接点击“Redis 5.0.3 is the latest stable version.”下载redis-5.0.3.tar.gz然后传到centos系统 2、安装c++编译器(视网速快慢可能会等待很久) # yum install gcc-c++ Is th...
1.安装依赖 yum install -y wget gcc make tcl 2.下载源码并安装 进入redis官网 https://redis.io/download/ 下载最新版 wget http://download.redis.io/releases/redis-4.0.6.tar.gz tar xzf...
easy_install-2.7 redis或者pip redis...
下面是几个常用命令行工具,先截图,再描述 在生成环境调试的命令 sudo gdb ./traffic_server -p $(pidof traffic_server) -batch -x [macro_file] 参考文献 [1].ATS Debugging Fall Summ...
Page1.aspx: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Page1.aspx.cs" Inherits="Application.跨页面传送.Page1" %>
在下面的例子中,我们在一个 .aspx 文件中声明了一个 TextBox 控件和一个 Label 控件。当您更改了 TextBox 中的值,并且在 TextBox 外单击时,change 子例程就会被执行。change 子例程会向 Label 控件写一条文本: