1 message in ru.sysoev.nginxMap module & multiple memcached serve...
FromSent OnAttachments
Kon WilmsJul 29, 2008 10:44 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Map module & multiple memcached servers -port number not passed to upstream moduleActions...
From:Kon Wilms (konf@public.gmane.org)
Date:Jul 29, 2008 10:44:54 am
List:ru.sysoev.nginx

Hi folks,

First thanks for a great product, I'm migrating a cluster to a single machine, replacing with nginx, and if the testing works out it will serve 1 billion requests a month on average on what previously took a good number of servers running lighty. :-)

I'm having an issue with the map module and using it to pass parameters to the memcached module. I am running multiple memcached servers and I want to distribute requests to them based on a fixed URL (which maps to a backend application server).

Given the following map directive to distribute resources across memcached servers:

map $uri $mcs { default 127.0.0.1:11401; /resource-1 127.0.0.1:11401; /resource-2 127.0.0.1:11401; /resource-3 127.0.0.1:11402; /resource-4 127.0.0.1:11403; }

The following when attempting to start nginx returns an error message that the port is missing for upstream module (memcached_pass $mcs directive is the fault):

location /resource-1 { expires -1; add_header Cache-Control no-cache; set $memcached_key $uri; memcached_pass $mcs; break; }

Right now I have just duplicated the resource-nnn multiple times, and not used the map. But since I have 20+ resources across 6 memcached servers this seems unoptimal when hitting the last resource as all the previous directives need to be iterated.

Any advice appreciated :-)

Cheers Kon