First, clean-up yum:
yum clean all
As a matter of best practice we’ll update our packages:
First, clean-up yum:
yum clean all
As a matter of best practice we’ll update our packages:
yum -y update
Installing Memcached and related packages is now as simple as running just one command:
yum -y install memcached
Use the following command to view information on the memcached command:
memcached -h
The default configuration file can be found at:
/etc/sysconfig/memcached
When started, Memcached will start on port 11211 by default per the default configuration file:
PORT=â€11211″
USER=â€memcachedâ€
MAXCONN=â€1024″
CACHESIZE=â€64″
OPTIONS=â€â€
To change the port (PORT), the user Memcached runs as (USER), the maximum number of allowed connections to Memcached (MAXCONN), or the cache size in megabytes (CACHESIZE), simply edit the configuration file.
EXAMPLE: If I wanted to run Memcached on port 1337, with 4GB of memory, and allow a maximum of 2,000 connections, I would change the config file as follows.
Let’s edit the configuration file:
vim /etc/sysconfig/memcached
To the following:
PORT=â€1337″
USER=â€memcachedâ€
MAXCONN=â€2000″
CACHESIZE=â€4096″
OPTIONS=â€â€
Exit and save the configuration file, and then restart MemcachedÂ
systemctl restart memcached
And then start Memcached:
systemctl start memcached
Be sure that Memcached starts at boot:
systemctl enable memcached
To check the status of Memcached:
systemctl status memcached
To stop Memcached:
systemctl stop memcached