#
#
#yamynginx2020-10-28 21:37:08
linux
#yamynginx, 2020-10-28 21:37:08

How to run memcached on TCP and UDS at the same time?

Hello, there is a service that needs memcached, but here's the problem - it can only connect to it via TCP. Of course, in my applications I use memcached only via UDS. Googling, I did not find a sensible instruction. How is it possible to raise memcached simultaneously on TCP and UDS?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Yuriev, 2020-10-28
@muxui

If you use nginx - proxy through it the port to the socket

stream {
    upstream memcached {
        server unix:/tmp/memcached.sock; #поменяйте путь до сокета
    }
    server {
        listen 127.0.0.1:11211; # если хотите забиндить только на локалхост
        #listen 11211;          # если хотите забиндить на все интерфейсы, а не только локалхост
        proxy_pass memcached;
    }
}

Using standard memcached tools, it really didn’t work to make both the port and the socket listen (at least in an obvious way), I chose this path for myself. You can read about the stream
directives in the official documentation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question