How to connect to memcached from another machine

I'm trying to use memcached from a different machine (which has access to my server), but I can't figure out how.

on the memcached machine I can test the connection by running

telnet 127.0.0.1 port

And it works, but on the other machine it just keeps trying to connect

telnet machine_address port
Trying machine_address...

I'm not sure if I should set up something else to get it working. I know the port is working and accessible because if I try to run other services on it, they works.

Os is ubuntu


In /etc/memcached.conf:

# Specify which IP address to listen on. The default is to listen on all IP addresses
# This parameter is one of the only security measures that memcached has, so make sure
# it's listening on a firewalled interface.
-l 127.0.0.1

Change that to

-l 0.0.0.0

and restart memcached.


Edit the -l line in /etc/memcached.conf. This is where your startup options are stored.

The following line will allow memcached to listen on all interfaces:

sudo sed 's/-l/#-l/' /etc/memcached.conf && sudo service memcached restart