Binding memcached and beanstalk to an external IP address in an EC2 instance

I had a running EC2 server with an elastic IP address that memcached had happily started and beanstalkd was listening on an external IP address on ports 11211 and 11300 respectively. I took the server AMI to update the size, and when the server rebooted, neither memcached nor beanstalkd were started. Troubling for memcached since it was init.d to restart, but beanstalkd was started as a daemon from the command line.

However, after a few hours I cannot figure out how to start them and start again.

For memcached, the configuration file reads:

# Default connection port is 11211
-p 11211

# Specify which IP address to listen on. The default is to listen on all IP addresses
-l <EXTERNAL IP ADDRESS>

When I try to start memcached as root from the command line:

memcached -d -m 1024 -u root -l <EXTERNAL IP ADDRESS> -v -p 11211

I get:

bind(): Cannot assign requested address
failed to listen on TCP port 11211: Cannot assign requested address

However, when I look at netstat, nothing is bound to this port:

netstat -ant | grep LIST
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:23              0.0.0.0:*               LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN

grep , memcached.

Iptables :

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere            tcp spt:11300 state ESTABLISHED 
ACCEPT     tcp  --  anywhere             anywhere            tcp spt:11211 state ESTABLISHED 

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 

EC2 , , .

, , , IP- ifconfig IP-. , : Bcast: memcached , memcached IP.

- . .

+3
1

0.0.0.0, .

+7

All Articles