Install and Configure memcached on Ubuntu

Windows Articles

How to create backups in Windows 10 with FileFort Backup

There is no doubt that the computer is an essential element in our lives. Indeed, its uses go beyond work or study....

Trisquel 9.0 available

Trisquel is a GNU/Linux distribution endorsed and supported by the Free Software Foundation. This means that in addition to incorporating the Linux...

How to install PandoraFMS on CentOS 8?

Worldwide many IT infrastructures are running Linux on one of their servers. This opens the door to an endless number of different...

How to force close a program using PowerShell

Hi! We have mentioned in the past that Windows allows you to open multiple programs at once. In fact, that is one...

How to install the Owncloud desktop client Ubuntu 20.04?

In this post, You will learn how to install the Owncloud desktop client on Ubuntu 20.04. Many users and...

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

How to create backups in Windows 10 with FileFort Backup

There is no doubt that the computer is an essential element in our lives. Indeed, its uses go beyond work or study....

Trisquel 9.0 available

Trisquel is a GNU/Linux distribution endorsed and supported by the Free Software Foundation. This means that in addition to incorporating the Linux...

How to install PandoraFMS on CentOS 8?

Worldwide many IT infrastructures are running Linux on one of their servers. This opens the door to an endless number of different...

How to force close a program using PowerShell

Hi! We have mentioned in the past that Windows allows you to open multiple programs at once. In fact, that is one...

How to install the Owncloud desktop client Ubuntu 20.04?

In this post, You will learn how to install the Owncloud desktop client on Ubuntu 20.04. Many users and...
x