Saturday, February 21, 2015

Install Memcached Caching System on Redhat/CentOs

Linux man page :-
Memcached is a flexible memory object caching daemon designed to alleviate database load in dynamic web applications by storing objects in memory. It's based on libevent to scale to any size needed, and is specifically optimized to avoid swapping and always use non-blocking I/O.

Step #1 : Download and install EPEL Repo
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

Step 2# : Install memcached

yum --enablerepo=epel,remi install memcached  php-pecl-memcache
 
Step #3 : Configure memcached

[root@app02 web]# vim /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="1024"
# listen to loopback ip 127.0.0.1, for network connection use real ip e.g., 10.0.0.4
OPTIONS="-l 127.0.0.1"

The above using 1GB of memory, and listening on IP 127.0.0.1, port 11211. Save and close the file

Step #4 : Restart memcached services
[root@app02 web]#service memcached start
[root@app02 web]#chkconfig memcached on

Note :- If you want to run memcached on socket please make below changes in /etc/sysconfig/memcached

[root@app02 web]# vim /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="1024"
# listen to loopback ip 127.0.0.1, for network connection use real ip e.g., 10.0.0.4
#OPTIONS="-l 127.0.0.1" (Uncomment)
OPTIONS="-s /var/run/memcached/memcached.sock -a 0666"

[root@app02 web]#service memcached start
[root@app02 web]#chkconfig memcached on 

Check mamcached Listening on socket:--

[root@vsrv02 /]# netstat -nlp | grep memcached
unix  2      [ ACC ]     STREAM     LISTENING     2782009389 23554/memcached     /var/run/memcached/memcached.sock

Note:- Unix Socket can only be accessed localy.

Renew k8s certificates

Check If certificate expires: amikum@~:03:06:54(⎈ |local-cluster:default):sudo kubeadm certs check-expiration CERTIFICATE                EXP...