How to Install Memcached on CentOS 8 - MS TV Life.COM

How to Install Memcached on CentOS 8

How to Install Memcached on CentOS 8

We hope this post helped you to find out  How to Install Memcached on CentOS 8

Memcached is a free and open-source high-performance in-memory key-value information retailer. Usually, it used as a caching system to hurry up functions by caching numerous objects from the outcomes of database calls.

This text reveals the way to set up and configure Memcached on CentOS 8.

Putting in Memcached on CentOS #

Memcached packages are included within the default CentOS Eight repositories. The set up is fairly simple, enter the next command as root or user with sudo privileges:

sudo dnf install memcached libmemcached

The libmemcached package deal gives a number of command-line instruments for managing the Memcached server.

As soon as the set up is accomplished, allow and begin the Memcached service by typing:

sudo systemctl enable memcached --now

To verify that memcached is running, type:

sudo systemctl status memcached

The output should look something like this:

● memcached.service - memcached daemon
   Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2020-04-13 20:12:52 UTC; 2s ago
   ...

That’s it, you’ve got put in Memcached in your CentOS Eight server and you can begin utilizing it.

Configuring Memcached #

Memcached choices might be configured within the /and many others/sysconfig/memcached file. By default, Memcached is about to hear solely on localhost.

If the shopper connecting to the server can also be working on the identical host, you shouldn’t make any adjustments.

Distant Entry #

If the applying that may hook up with Memcached is hosted on a distant server, it’s essential to configure your firewall and permit entry to the Memcached port 11211 solely from the shopper IP handle.

When improperly configured Memcached can be utilized to carry out a distributed denial-of-service (DDoS) assault.

The next instance assumes that you simply need to hook up with the Memcached server over a non-public community. The Memcached server IP is 192.168.100.20, and the shopper’s IP handle is 192.168.100.30.

Step one is to edit the Memcached configuration and set the service to hear on the server’s non-public networking interface:

Open the memcached configuration file:

sudo nano /etc/sysconfig/memcached

In the OPTIONS parameter, add the server IP address -l 192.168.100.20. This instructs Memcached to bind to the specified interface only.

/etc/sysconfig/memcached

OPTIONS="-l 192.168.100.20"

Save the file and restart the Memcached service for the changes to take effect:

sudo systemctl restart memcached

As soon as the service is configured, the subsequent step is to open the memcached port in your firewall.

CentOS comes with a firewall configuration instrument FirewallD. The instructions beneath will create a brand new zone named memcached, open the port 11211 and permit entry solely from the shopper IP handle.

sudo firewall-cmd --new-zone=memcached --permanentsudo firewall-cmd --zone=memcached --add-port=11211/udp --permanentsudo firewall-cmd --zone=memcached --add-port=11211/tcp --permanentsudo firewall-cmd --zone=memcached --add-source=192.168.100.30/32 --permanentsudo firewall-cmd --reload

Connecting to Memcached #

To connect with the Memcached server it’s essential to use a language-specific shopper.

PHP #

To make use of Memcached as a caching database to your PHP software corresponding to WordPress, Drupal, or Magento, it’s essential to set up the php-pecl-memcached extension:

sudo apt install php-pecl-memcache

Python #

There are several Python libraries for interacting with memcached. You can install your preferred library using pip:

pip install pymemcache
pip install python-memcached

Conclusion #

We’ve proven you the way to set up Memcached on CentOS 8. For extra data on this matter, seek the advice of Memcached Wiki.

We hope the How to Install Memcached on CentOS 8 help you. If you have any query regarding How to Install Memcached on CentOS 8 drop a comment below and we will get back to you at the earliest.

We hope this post helped you to find out  How to Install Memcached on CentOS 8  . You may also want to see – How to Install Anaconda on CentOS 8

Copy link
Powered by Social Snap