160530. memcached Cluster (Spring integrated configuration)

Source: Internet
Author: User
Tags memcached

First step: Install the memcached server on a Linux machine or on a Windows machine

Install Memcached:centos in linux command yum-y installed memcached

If there is no network download mencached installation package (note: Need to install dependent libevent)

Download the installation package from the Internet, unzip the Make&&make install and complete the

The second step: the project imports the memcached client jar (clients) with two versions, select the 2.4

Step three: Spring integrated memcached (Memcached.xml)

<?xml version= "1.0" encoding= "UTF-8"?>
<beans xmlns= "Http://www.springframework.org/schema/beans"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xmlns:aop= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"
xmlns:tx= "Http://www.springframework.org/schema/tx" xmlns:jdbc= "Http://www.springframework.org/schema/jdbc"
xmlns:context= "Http://www.springframework.org/schema/context"
Xsi:schemalocation= "
Http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
Http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
Http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP http://www.springframework.org/schema/aop/spring-aop-3.0.xsd ">

<!--Memcached Configuration--
<bean id= "memcachedclient" class= "Com.danga.MemCached.MemCachedClient" >
<constructor-arg>
<value>sockIOPool</value>
</constructor-arg>
</bean>
<!--memcached Connection pool--
<bean id= "Sockiopool" class= "Com.danga.MemCached.SockIOPool" factory-method= "getinstance" init-method= " Initialize "destroy-method=" ShutDown ">
<constructor-arg>
<value>sockIOPool</value>
</constructor-arg>
<property name= "Servers" >
<list>

<!--memcached clusters, there are a few of them listed in 11211 for the port number--

<value>192.168.200.149:11211</value>

<value>192.168.200.150:11211</value>

</list>
</property>
<property name= "Weights" >
<list>
<value>1</value>
</list>
</property>
</bean>
</beans>

160530. memcached Cluster (Spring integrated configuration)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.