Install memcached from YUM repository
Use following YUM command to install memcached package from CentOS 7 base repository:
This installation provides a memcached instance with configuration file /etc/sysconfig/memcached.
Run multiple memcached processes
Assume that you have a requirement of running two memcached processes with following configurations:
config1 – configuration of first process
listen address: 127.0.0.1
listen port: 11211
maximum concurrent connections: 1024
maximum in-memory cache size: 256MB
config2 – configuration of second process
listen address: 127.0.0.1
listen port: 11212
maximum concurrent connections: 2048
maximum in-memory cache size: 512MB
Let us use config1 configuration for the default memcached process.
For that, edit /etc/sysconfig/memcached using your favorite editor (say nano text editor) and make following settings in it:
Start the first memcached process:
Enable it on server boot:
Check status of first memcached process; it should be running if no problem happened:
Use following YUM command to install memcached package from CentOS 7 base repository:
Code:
yum -y install memcached
This installation provides a memcached instance with configuration file /etc/sysconfig/memcached.
Run multiple memcached processes
Assume that you have a requirement of running two memcached processes with following configurations:
config1 – configuration of first process
listen address: 127.0.0.1
listen port: 11211
maximum concurrent connections: 1024
maximum in-memory cache size: 256MB
config2 – configuration of second process
listen address: 127.0.0.1
listen port: 11212
maximum concurrent connections: 2048
maximum in-memory cache size: 512MB
Let us use config1 configuration for the default memcached process.
For that, edit /etc/sysconfig/memcached using your favorite editor (say nano text editor) and make following settings in it:
Code:
nano /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="256"
OPTIONS="-l 127.0.0.1"
Start the first memcached process:
Code:
systemctl start memcached.service
Code:
systemctl enable memcached.service
Code:
systemctl status memcached.service
memcached.service - Memcached
Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled)
Active: active (running) since Mon 2014-12-15 15:20:00 EDT; 17s ago
Main PID: 24217 (memcached)
CGroup: /system.slice/memcached.service
└─24217 /usr/bin/memcached -u memcached -p 11211 -m 64 -c 1024 -l 127.0.0.1
Dec 15 15:20:00 localhost.localdomain systemd[1]: Starting Memcached...
Dec 15 15:20:00 localhost.localdomain systemd[1]: Started Memcached.