Recent business needs, need to adjust the next memcached cache mode, combined with the company application Test magent and Repcached way, the results show repcached way more suitable for the company's business, if, with today's article.
1. Test environment
Centos6.5_x64 two units, two nodes of repcached, respectively, and then deployed Memcached+tomcat+repcached and the company's special applications on both nodes.
2. Operation Process
A) upload the installation package
Libevent-2.0.21-stable.tar.gzmemcached-1.4.13.tar.gzrepcached-2.3.1-1.4.13.patch.gz Description: repcached memory Copy plug-in version must be consistent with the memcached version, Otherwise, there will be a variety of errors such as version incompatibility
b) Installation dependencies (according to the actual situation of your system)
Yum-y Install install g++ make Popt-devel
c) Install Libevent (operate on two nodes)
# cd/www/test# Tar zxvf libevent-2.0.21-stable.tar.gz# cd libevent-2.0.21-stable#./configure--prefix=/usr# Make && Amp Make install
d) memcached installation and patch Pack installation:
# cd /www/b2b# gzip -d repcached-2.3.1-1.4.13.patch.gz# tar -xf MEMCACHED-1.4.13.TAR.GZ# CD MEMCACHED-1.4.13# PATCH -P1 -I&NBSP, .... /repcached-2.3.1-1.4.13.patch# ./configure --prefix=/www/test/memcached-repcached -- With-libevent=/usr --enable-replication# make && make install# echo $? Add memcached Self-startup script, stored in/etc/init.d/memcached-repcached#!/bin/bash#start () {/www/test/ memcached-repcached/bin/memcached -d -m 512 -u root -p 11211 -c 4096 -t 8 -p /var/run/repcached.pid}stop () {kill ' cat /var/run/ Repcached.pid '}# see how we were called.case "$" in start) start ;; stop) stop ;; restart|reload) stop start ;; Esaccd /etc/rc3.d/ln -s /etc/init.d/memcached-repcached s98memcached-repcached
e) Open repcached on the master node
/www/test/memcached-repcached/bin/memcached-v-d-p 11213-l 10.10.10.53-u root-p/var/run/repcached.pid
f) Turn on the repcached from the node
/www/test/memcached-repcached/bin/memcached-v-d-p 11213-l 10.10.10.54-u root-x 10.10.10.53-p/var/run/repcached.pid
g) Back up the Tomcat configuration memcached related configuration file:
Cp-a/www/test/tomcat_1/conf/context.xml/tmpcp-a/www/test/tomcat_1/webapps/root/web-inf/configs/ Application-context.xml/tmp
h) Modify the Tomcat configuration file
--Modify the Tomcat configuration file (/www/test/tomcat_1/conf/context.xml): "memcachednodes=" n1:10.10.10.53:11211 N2 : 10.10.10.54:11211 "" Modified to "memcachednodes=" n1:10.10.10.53:11213 n2:10.10.10.54:11213 "-Modify Tomcat configuration file (/www/test/ Tomcat_1/webapps/root/web-inf/configs/application-context.xml) will "<property name=" Servers "value=" 10.10.10.53:11212,10.10.10.54:11212 "/>" modified to "<property name=" Servers "value=" 10.10.10.53:11213,10.10.10.54:11213 "/>"
i) Restart the Tomcat service and use Telnet to synchronize writes on the ports on both servers
This article is from the "Frozen vs watermelon" blog, so be sure to keep this source http://molewan.blog.51cto.com/287340/1959828
Tomcat+memcached+repcached (not finished, to be continued)