How to make Nginx work with distributed/multiple memcached servers?
agentzh
agentzh at gmail.com
Wed Apr 20 08:15:14 MSD 2011
On Wed, Apr 20, 2011 at 12:11 PM, agentzh <agentzh at gmail.com> wrote:
>
> Another way is to use Lua to pick up a memcached backend from your
> memcached cluster, such that you can define your own hashing
> algorithm, including your custom consistent hashing ones.
>
Here's an example for defining custom backend routing rules in Lua (by
means of our ngx_lua module) from my slides:
http://agentzh.org/misc/slides/nginx-state-of-the-art/#67
http://agentzh.org/misc/slides/nginx-state-of-the-art/#68
http://agentzh.org/misc/slides/nginx-state-of-the-art/#69
http://agentzh.org/misc/slides/nginx-state-of-the-art/#70
Well, you can also use the arrow keys or pageup/pagedown keys to
switch pages in my (ajax-based) slides.
> Here we use fastcgi_param to pass nginx variable $backend to your
> fastcgi app such that your fastcgi app can read that from its
> environment MEMC_BACKEND. Another approach is to append the $backend
> value to the query string of the forwarded http request.
>
Basically it's as simple as
fastcgi_param QUERY_STRING "$query_string&_memc_backend=$backend";
Cheers,
-agentzh
More information about the nginx
mailing list