0
votes

I have 6 application servers (PHP) on Centos I want to install a memcached on each to share sessions.

But I have a first problem with a test with 2 servers. Memcached works fine only in local (that's not a firewall problem):

Server 1 is on centos with PHP and memcached as Server 2

on Server1:

memcached-tool Server1:11211

works fine, but:

memcached-tool Server2:11211

fails (Couldn't connect to Server2:11211)

on Server2

memcached-tool Server2:11211 

works fine, but

memcached-tool Server1:11211

fails (Couldn't connect to Server1:11211)

In /etc/sysconfig/memchached I tried the option

-l 0.0.0.0

to be sure of listening every IP But same wrong.

telnet Server 11211 gives same results as memcached-tool command

Despite of this with php-memcached library and session.save_handler = memcached in php.ini

I tried with session.save_path

to test Server1 with memcached on Server1 => success
to test Server2 with memcached on Server1 => fails  
to test Server2 with memcached on Server2 => success
to test Server1 with memcached on Server2 => fails

Thanks for help. BenoƮt

1
I say to check your firewall first - markdwhite
already checked, not a firewall problem, servers on the same VLAN :-( - saillantist
Until you can prove that you can connect from one machine to the other on any port, and from one machine to the other on the required port (telnet, nc), it still smells like an addressing or network issue. If you have, fair enough, but your reply is sparse on detail. It sounds like you've assume they're accessible to each other merely because they're on the same C-class, and maybe they are, and maybe they're not. Like I say, it's not clear. - markdwhite
the telnet command on 11211 gives (from Server1): telnet Server2 11211 telnet: connect to address Server2: No route to host for example the port 9000 is closed and the telnet command on 9000 gives (from Server1) telnet Server2 9000 telnet: connect to address Server2: Connection refused - saillantist

1 Answers

0
votes

Finally I found the solution.

It is a firewall problem but not a network firewall.

Red Hat / Centos have a system firewall named firewalld

So you have to add 11211 port to the firewall:

firewall-cmd --add-port=11211/tcp --permanent 
firewall-cmd --reload