Memcached is a high-performance, distributed memory object caching system that can be used to speed up dynamic web applications by alleviating database load. In this article, we will show you how to install and configure Memcached on a Centos 8 / RHEL 8 server.
Install Memcached on CentOS 8 / RHEL 8
You can install Memcached by running the following command:
dnf install -y memcached
Start and Enable Memcached Service
After installing Memcached, you can start the service by running the following command:
systemctl start memcached
To enable Memcached to start automatically at boot, run the following command:
systemctl enable memcached
Configure Memcached on CentOS 8 / RHEL 8
The default Memcached configuration file is located at /etc/sysconfig/memcached. You can edit this file to configure various settings such as the amount of memory to be used by Memcached, the number of connections, and other options.
For example, to increase the amount of memory used by Memcached to 512MB, you can edit the file and change the line that starts with “CACHESIZE=” to “CACHESIZE=512”.
Below are the standard settings, you can add these lines in /etc/sysconfig/memcached file.
After make changes to file restart the service.
systemctl restart memcached
Configure Firewall For Memcached
By default, Memcached listens on port 11211
To allow incoming connections on the Memcached port, run the command:
firewall-cmd --add-port=11211/tcp --permanent
After allowing the Memcached service through the firewall, you need to reload the firewall to apply the changes. You can do this by running the following command:
Memcached is a powerful caching tool that can be used to speed up dynamic web applications. By following the steps outlined in this article, you can easily install and configure Memcached on a Centos 8 / RHEL 8 server.