Install and Configure memcached on Ubuntu

Windows Articles

Is ReactOS a real alternative to Windows?

Oh! The eternal struggle of computer operating systems. Windows vs. GNU/Linux and Mac as a distant spectator However, there are also interesting...

How to install Firebird on Ubuntu 20.04/ 18.04?

Database management systems are sufficient for many kinds of projects. Of course, they abound with MySQL / MariaDB or PostgreSQL popular but...

How to disable Firewall in Windows Server 2019/2016

Hello! The Firewall performs an essential security task on any version of Windows Server. In fact, it has the mission of preventing...

How to install ArangoDB on Ubuntu 20.04?

In this post, you will learn how to install ArangoDB on Ubuntu 20.04 So let's go for it What...

How to create GPO in Windows Server 2019.

Hi, in today's post we will be looking at GPOs in Windows Server 2019. The Group Police Object are a set of...

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.

sudo apt update && sudo apt upgrade -y

Now, run the following command for installing memcached server –

sudo apt install memcached

Configuring memcached server

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

sudo gedit /etc/memcached.conf

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

-m 512

For connection, the default port of memcached is 11211.

-p 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.

-l 127.0.0.1,127.0.0.2

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

-c 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.

sudo apt install libmemcached-tools

Check if memcached connectivity is working –

memcstat --servers=127.0.0.1

Restart, stop and reload memcached

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

  • Start memcached
sudo systemctl start memcached
  • Stop memcached
sudo systemctl stop memcached
  • Restart memcached
sudo sytemctl restart memcached
  • Memcached status
sudo systemctl status memcached

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!

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

Is ReactOS a real alternative to Windows?

Oh! The eternal struggle of computer operating systems. Windows vs. GNU/Linux and Mac as a distant spectator However, there are also interesting...

How to install Firebird on Ubuntu 20.04/ 18.04?

Database management systems are sufficient for many kinds of projects. Of course, they abound with MySQL / MariaDB or PostgreSQL popular but...

How to disable Firewall in Windows Server 2019/2016

Hello! The Firewall performs an essential security task on any version of Windows Server. In fact, it has the mission of preventing...

How to install ArangoDB on Ubuntu 20.04?

In this post, you will learn how to install ArangoDB on Ubuntu 20.04 So let's go for it What...

How to create GPO in Windows Server 2019.

Hi, in today's post we will be looking at GPOs in Windows Server 2019. The Group Police Object are a set of...