Nginx and memcached

Hi folks!

I try to use nginx with memcached with less success, maybe this is just
a well known issue but i did not find anything in google:

config:

    location / {

        set  $memcached_key  $uri;
        memcached_pass    127.1.0.1:11212;
        default_type      text/html;
        error_page        404 = /fallback;

        location = /fallback {
          root   /usr/local/www/nginx-dist/;
          index  index.html index.htm;
        }

    }

error log in debug mode:

2008/07/20 13:52:43 [error] 73685#0: *5 memcached sent invalid response:
“marugoto_end” while reading response header from upstream, client:
xx.xx.116.179, server: zen.xx.xx.hu, request: “GET / HTTP/1.1”,
upstream: “memcached://127.1.0.1:11212”, host: “zen.xx.xx.hu”

test:

nc -v 127.1.0.1 11212

Connection to 127.1.0.1 11212 port [tcp/*] succeeded!
marugoto_end

any suggestion?

thanx in advance

lix

Hello!

On Sun, Jul 20, 2008 at 06:45:56PM +0100, Istvan Szukacs wrote:

[…]

any suggestion?

Your memcached server isn’t memcached. Probably it’s something
locally modified, or something completely different. You should
use memcached instead or ask author of modifications you use to
revert incompatible protocol changes.

Maxim D.

Hi!

I think it is…

[root@mimas ~]# which memcached
/usr/local/bin/memcached
[root@mimas ~]# pkg_info |grep memcached
memcached-1.2.5 High-performance distributed memory object cache
system
[root@mimas ~]#

[root@mimas /usr/ports/databases/memcached]# pwd
/usr/ports/databases/memcached

[root@mimas /usr/ports/databases/memcached]# head -15 Makefile

New ports collection makefile for: memcached

Date created: July 21, 2003

Whom: Sean C. [email protected]

$FreeBSD: ports/databases/memcached/Makefile,v 1.26 2008/04/13

03:00:55 mnag Exp $

PORTNAME= memcached
PORTVERSION= 1.2.5
CATEGORIES= databases
MASTER_SITES= http://www.danga.com/memcached/dist/
${MASTER_SITE_GENTOO}
MASTER_SITE_SUBDIR= distfiles

MAINTAINER= [email protected]

[root@mimas /usr/ports/databases/memcached]# man memcached|tail -8
AUTHOR
The memcached daemon was written by Anatoly Vorobey
[email protected]
and Brad Fitzpatrick [email protected] and the rest of the crew of
Danga
Interactive http://www.danga.com

                            April 11, 2005

MEMCACHED(1)

[root@mimas ~]# sockstat
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN
ADDRESS
nobody memcached 75786 4 tcp4 127.1.0.1:11212 :
nobody memcached 75786 5 tcp4 127.1.0.1:11211 :

heh the memcached has a console or something listening on 11212 and the
proper for nginx is 11211

thank you Maxim!

Hello!

On Sun, Jul 20, 2008 at 09:59:24PM +0100, Istvan Szukacs wrote:

[root@mimas ~]# sockstat
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
nobody memcached 75786 4 tcp4 127.1.0.1:11212 :
nobody memcached 75786 5 tcp4 127.1.0.1:11211 :

heh the memcached has a console or something listening on 11212 and the
proper for nginx is 11211

Ah, I see. It’s repcached replication patches, 11212 - default
replication port.

Maxim D.

Hello!

On Sun, Jul 20, 2008 at 09:32:30PM +0100, Istvan Szukacs wrote:

Hi!

I think it is…

[root@mimas ~]# which memcached
/usr/local/bin/memcached
[root@mimas ~]# pkg_info |grep memcached
memcached-1.2.5 High-performance distributed memory object cache system

[…]

nc -v 127.1.0.1 11212

Connection to 127.1.0.1 11212 port [tcp/*] succeeded!
marugoto_end

Memcached has no “marugoto_end” initial message. Probably
something different listens on 11212 port.

Maxim D.