GIT – Memcached can speed up database driven dynamic web site. It must be deployed within trusted network where vm01 and vm02 clients may freely connect to our server. You need to type the following commands on vm03 having an IP address 192.168.1.12.
Install memcached server on vm03
Type the following yum command to install memcached server on RHEL based system:
# yum install -y memcached
Install memcached client on vm01 and vm02
You may need to install any one of the following package on vm01 and vm02 (server running php5+apache/Lighttpd):
- perl-Cache-Memcached : Perl client (library) to work with memcached server.
- python-memcached : Python client (library) to work with memcached server.
- php-pecl-memcache : PHP extension to work with the Memcached server.
Edit /etc/sysconfig/memcached file, enter:
# vi /etc/sysconfig/memcached
PORT="11211" USER="memcached" MAXCONN="1024" CACHESIZE="512" ## make sure we accept connection from vm01 and vm02 on 192.168.1.12:11211 OPTIONS="-l 192.168.1.12 -L"
Save and close the file. Start the memcached server:
# chkconfig memcached on
# /sbin/service memcached start
Edit /etc/sysconfig/iptables and make sure only vm01 and vm02 are allowed to connect to the our server:
## open vm01 and vm02 tcp/udp port for memcached server ## -A INPUT -m state --state NEW -s 192.168.1.10 -m tcp -p tcp --dport 11211 -j ACCEPT -A INPUT -m state --state NEW -s 192.168.1.11 -m udp -p udp --dport 11211 -j ACCEPT -A INPUT -m state --state NEW -s 192.168.1.10 -m udp -p udp --dport 11211 -j ACCEPT -A INPUT -m state --state NEW -s 192.168.1.11 -m tcp -p tcp --dport 11211 -j ACCEPT
Save and close the file. Restart the iptables service, enter:
# /sbin/service iptables restart
# /sbin/iptables -L -v -n
Increase file system and ports limits on vm03
For busy memcached server you need to increase system file descriptor and IP port limits:
# Increase system file descriptor limit to fs.file-max = 50000 # Increase system IP port limits net.ipv4.ip_local_port_range = 2000 65000
- INDEX: Run Service Per System or VM Instance
- Configure/Install: NFS file server
- Configure/Install: MySQL database server
- Configure/Install: Memcached caching server
- Configure/Install: Apache+php5 app web server
- Configure/Install: Lighttpd web server for static assets
- Configure/Install: Nginx web server as proxy / LB