Welcome! Log In Create A New Profile

Advanced

Memcached logging and setup question

Joel Eidsath
August 10, 2011 04:02PM
Hello fellow Nginx-ers,

We have our nginx server set up with a "maintenance mode" (for
upgrades) that will display an error page until the maintenance mode
is turned off.

However, I'd like memcached to bypass this and serve anything it has
cached even when the maint mode is on. So I've made the following
modification (moved the if statement), which doesn't seem to work:

# maintenance mode old setup
# if ( $maintenance ) { return 503; }

location / {

if ($request_method != GET) {
proxy_pass http://backend;
break;
}
default_type "text/html";
set $memcached_key "http://<SERVER_NAME>$uri";
memcached_pass <SERVER_IP>:<MEMCACHE_PORT>;
error_page 404 502 = @cache_miss;
}

location @cache_miss { proxy_pass http://backend;
# new maintenance mode if statement location
if ( $maintenance ) { return 503; }
}

Now, when the maintenance flag is set, nginx returns 503 for
everything, as if it were missing the cache every time.

Any suggestions?

Also, is there a way for me to enable nginx logging of these memcached
results? For debugging I'd like to be able to see hits, misses, keys,
etc.

Thanks!

Joel

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Memcached logging and setup question

Joel Eidsath August 10, 2011 04:02PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 271
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready