Install and Configure memcached on Ubuntu

0
201

You probably have heard about “memcached”, right? It’s a high-performance, distributed memory object caching server that can dramatically improve the performance of a database and web applications. Memcached is an open-source software that reduces the load on the database and thus, speeds things up.

Today, let’s get memcached ready on our Ubuntu machine.

Installing memcached

At first, make sure that your system is ready with all the latest updates.

Now, run the following command for installing memcached server –

Configuring memcached server

For configuring the memcached server, you have to edit “memcached.conf” file. Run the following command –

At first, start up with a memory cap of 512MB –

For connection, the default port of memcached is 11211.

Now, it’s time to tell which IP address to listen on. By default, the memcached server will listen to all IP addresses. This is the only parameter you can configure for security. Make sure that the server is listening to a firewalled interface.

You can also cap the incoming simultaneous connections. The default daemon value is 1024. Let’s increase it to 2048.

Now, save the file and restart the memcached server.

Need to verify that memcached is running? We need the “libmemcached-tools” for testing purpose.

Check if memcached connectivity is working –

Restart, stop and reload memcached

If you’re going to use memcached, you may need to perform the above actions.

  • Start memcached

  • Stop memcached

  • Restart memcached

  • Memcached status

For enjoying memcached features in other languages, you need to get additional packages –

  • ruby-dalli (Ruby client)
  • php-memcached (PHP module)
  • python3-pymemcache (Python 3.x implementation)
  • python-memcache (Python client)
  • libcache-memcached-libmemcached-perl – (Perl for Memcached::libmemcached)

Enjoy!

Spread the love
  • 5
    Shares

PS. If you like this post please share it with your friends on the social networks using the buttons above.Thanks.

LEAVE A REPLY

Please enter your comment!
Please enter your name here