I can see that nginx is trying to read from correct redis server, but it has troubles updating redis.
I am using ngx_openresty-1.7.7.1. Nginx config file as well as error log are attached.
Thank you for help.
#user nobody;
worker_processes 1;
error_log logs/error.log debug;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
upstream redis1 {
server 192.168.43.201:6379;
keepalive 512;
}
upstream redis2 {
server 192.168.43.81:6379;
keepalive 512;
}
upstream redis3 {
server 192.168.43.2:6379;
keepalive 512;
}
upstream_list universe redis1 redis2 redis3;
server {
listen 80;
server_name .*;
# redis_connect_timeout 100ms;
# redis_send_timeout 100ms;
# redis_read_timeout 100ms;
location / {
default_type text/css;
srcache_response_cache_control off;
srcache_ignore_content_encoding on;
set $key $uri;
set_escape_uri $escaped_key $key;
srcache_fetch GET /redis-get $key;
srcache_store PUT /redis2-set key=$escaped_key&exptime=120;
proxy_pass http://racks.tripadvisor.com;
proxy_set_header Host $host;
proxy_read_timeout 300s;
proxy_set_header User-Agent $http_user_agent;
proxy_pass_header Set-Cookie;
proxy_pass_header X-Track;
proxy_pass_header P3P;
add_header Cache-Control no-cache;
add_header X-Cache-Status $srcache_fetch_status;
# proxy_http_version 1.1;
# proxy_set_header Connection "";
# proxy_set_header X-Request-Protocol http;
# proxy_set_header Host $host;
}
location /redis-get {
internal;
set_md5 $redis_key $args;
set_hashed_upstream $backend universe $redis_key;
redis_pass $backend;
}
location /redis2-set {
internal;
set_unescape_uri $exptime $arg_exptime;
set_unescape_uri $key $arg_key;
set_md5 $key;
proxy_set_header Accept-Encoding "";
redis2_query set $key $echo_request_body;
redis2_query expire $key $exptime;
set_hashed_upstream $backend universe $key;
redis_pass 192.168.43.2:6379;
}
}
}
Attachment:
error.log
Description: Binary data