memcached

Trying to set up memcached to share memory between two nodes, I'm having a problem making a connection on port 11211 with one of them. When I run netstat on both nodes, I get:

tcp 0 0 localhost:11211 : LISTEN 16952/memcached

tcp 0 0 *:11211 *:* LISTEN 19278/memcached

The first node above can connect to the second, but the second can't connect to the first. Same with telnet. The way I read that is the ports are bound to different servers? On the first 11211 is bound to localhost, the other it's allowing a connection from all (*)?

Am I on the right track, and if so, any idea how to change the first node to accept connections from all?

Thanks.

3 Replies

Your assumption looks correct, the first is bound to localhost the second is bound to any ip.

Memcached should not be exposed to the internet so make sure that you have iptables blocking access from the world (and your "private" ip address if you have one, since it's private between all linode users).

You can open up the first one to use all addresses by removing the -l from memcached configuration line.

Thanks for the reply. Yes, I had thought of that, and tried it. But it doesn't work. If I configure with: "memcached -d -m 20" I still get the netstat below:

tcp 0 0 localhost:11211 : LISTEN 2769/memcached

When I enter another IP behind -l (I even tried -l *), the port still remains bound to localhost.

Both these machines are ubuntu karmic, and I set them up the same way. When I installed memcached, I took the same steps for both.

Any ideas?

Thanks.

okay. Researching this on the web, most information says the configuration is done at the command line. But there is in fact a config file at /etc/memcached.conf that was specifying the bind port. Easy. Should have figured.

Thanks.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct