第一步:在linux机或windows机上安装memcached服务端(server)

linux中安装memcached:centos中命令 yum -y install memcached

如果没有联网下载mencached的安装包(注意:需要安装依赖libevent)

从网上下载安装包,解压后make&&make install就完成了

第二步:项目中导入memcached客户端jar(client)有两个版本,选择2.4的

第三步:spring集成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 配置 -->
    <bean id="memCachedClient" class="com.danga.MemCached.MemCachedClient">
        <constructor-arg>
            <value>sockIOPool</value>
        </constructor-arg>
    </bean>
    <!-- Memcached连接池 -->
    <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集群,有几个就列几个11211为端口号-->

<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集群(spring集成的配置)的更多相关文章

  1. (转)实验文档3:在kubernetes集群里集成Apollo配置中心

    使用ConfigMap管理应用配置 拆分环境 主机名 角色 ip HDSS7-11.host.com zk1.od.com(Test环境) 10.4.7.11 HDSS7-12.host.com zk ...

  2. redis + 主从 + 持久化 + 分片 + 集群 + spring集成

    Redis是一个基于内存的数据库,其不仅读写速度快,每秒可以执行大约110000的写操作,81000的读取操作,而且其支持存储字符串,哈希结构,链表,集合丰富的数据类型.所以得到很多开发者的青睐.加之 ...

  3. 在kubernetes集群里集成Apollo配置中心(6)之实战使用apollo分环境管理dubbo服务

    生产实践 1.迭代新需求/修复BUG(编码--->提git) 2.测试环境发版,测试(应用通过编译打包发布至test命名空间) 3.测试通过,上线(应用镜像直接发布至prod命名空间) 系统架构 ...

  4. 在kubernetes集群里集成Apollo配置中心(1)之交付Apollo-configservice至Kubernetes集群

    1.Apollo简介 Apollo(阿波罗)是携程框架部门研发的分布式配置中心,能够集中化管理应用不同环境.不同集群的配置,配置修改后能够实时推送到应用端,并且具备规范的权限.流程治理等特性,适用于微 ...

  5. 在kubernetes集群里集成Apollo配置中心(3)之交付Apollo-portal至Kubernetes集群

    1.执行apollo-portal数据库脚本 apollo-portal数据库脚本链接:https://raw.githubusercontent.com/ctripcorp/apollo/1.5.1 ...

  6. 在kubernetes集群里集成Apollo配置中心(1)之交付Apollo-adminservice至Kubernetes集群

    1.部署apollo-adminservice软件包 apollo-adminservice软件包链接地址:https://github.com/ctripcorp/apollo/releases/d ...

  7. 在kubernetes集群里集成Apollo配置中心(4)之dubbo服务提供者连接apollo实战

    1.登录portal.od.com(Apollo-portal),新建一个dubbo-demo-service项目 2.在Apollo项目中的dubbo-demo-service添加配置 (1)添加d ...

  8. 在kubernetes集群里集成Apollo配置中心(5)之dubbo服务消费者连接apollo实战

    1.在Apollo的portal创建dubbo消费者项目 (1)添加dubbo消费者项目 (2)在dubbo消费者项目中添加配置项 (3)发布 2.通过jenkins构建dubbo消费者镜像 3.登录 ...

  9. Nginx+Tomcat+MemCached 集群配置手册

    系统实施文档 Nginx+Tomcat+MemCached 集群配置手册 目    录 第1章   概述 1.1   目标 互联网的快速发展带来了互联网系统的高负载和高可用性, 这要求我们在设计系统架 ...

随机推荐

  1. C++ 基类指针和子类指针相互赋值

    首先,给出基类animal和子类fish [cpp] view plaincopy //======================================================== ...

  2. Java运行Python脚本的几种方式

    由于在项目需要执行Python,找寻相关资料,总结出以下几种方式: 直接执行Python脚本代码 引用 org.python包 PythonInterpreter interpreter = new ...

  3. Atitit.软件仪表盘(2)--vm子系统--资源占用监测

    Atitit.软件仪表盘(2)--vm子系统--资源占用监测 1.  Jvisualvm.exe 2. jprofile 3. Heap //permgen   monitor 作者::老哇的爪子At ...

  4. Atitit. Dwr 抛出异常error解决方案

    Atitit. Dwr 抛出异常error解决方案 1. Dwr3的处理机制..setErrorHandler 1 2. remote Mteh  try catch 1 3. 林吧,子好java 处 ...

  5. struts2设置加载非默认路径的struts.xml文件解决方案

    方案一:   首先我们要明白struts2加载配置文件都是从它自己的jar包和\WEB-INF\classes两个默认的位置加载的,如果你想改变strusts2中的文件的默认加载路径,可以在web项目 ...

  6. zookeeper单节点windows下安装

    由于需要在windows下面安装zookeeper,故做个整理 1.下载zookeeper http://mirrors.hust.edu.cn/apache/zookeeper/ 2.解压 3.修改 ...

  7. jquery 情况form表单的所有内容

    #project_file_upload 为表单的id $(':input','#project_file_upload') .not(':button, :submit, :reset, :hidd ...

  8. vuex 定义

    vuex是什么? vuex是一个专为vue.js应用程序开发的状态管理模式,它采用集中式存储管理应用的所有组件的状态,并以相应的规则保证状态以一种可预测的方式发生变化.Vuex也集成到vue的官方调试 ...

  9. 正则 群组 Group

    static void Main(string[] args) { string strUrl = "<a href=\"user.php?act=order_detail& ...

  10. hadoop onekey_step2

    #onekey_step2 # Rrogram: # 安装hadoop简易集群程序 # 使用说明 # History: # -- luoqi v0. release # email: # @qq.co ...