How to run multiple memcached instances

I had copied a PrestaShop site to another domain. Both domains are on same server, using same Memcached server for caching. When i visit one of the site, resources like css/js files are loading from other website. To fix this, i configured 2 Memcached servers running on 2 different ports, each site use its own Memcached instance.

On Ubuntu server, i installed memcached and supervisor with

Create file

Inside add

By default Memcached runs on port 11211, above configuration will make an instance of Memcached that runs on port 11212.

If you want to create another instance of memcached, duplicate above lines, in the lines, change

with

Find

Replace port with different port, say 11213 and /var/run/memcached/memcached2.pid with /var/run/memcached/memcached2.pid

Here is the complete configuration with 2 Memcached instances running under supervisiord

Reload supervisor

Check status

Here is an example with 4 memcached instances running

Here are the configuration file for above 4 Memcached instance setup

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *