第一步:在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 while循环的自增和自减

    自增和自减 --i 是先执行i=i-1,然后再使用i的值, 这时的i 值就是表达式--i的值.i-- 是先使用i的值作为表达式i--的值,然后,执行i=i-1操作. 实例一: #include &qu ...

  2. C# 文件与二进制互转数据库写入读出

    //这个方法是浏览文件对象 private void button1_Click(object sender, EventArgs e) { //用户打开文件浏览 using (OpenFileDia ...

  3. gdb前端: VIM+Pyclewn 调试C/C++

    (gdb) mapkeys C-B : break "${fname}":${lnum} # set breakpoint at current line C-D : down C ...

  4. CA证书的办理

    北京市地方税务局与北京数字证书认证中心(Beijing Certificate Authority ,简称BJCA)合作, 在北京市地方税务局网上纳税及其他网上业务系统中使用BJCA数字证书, 北京数 ...

  5. 《LAMP系统工程师实用教程》读书笔记(一)- linux常用命令

    图书馆看到就借回来啦,这本书虽然其貌不扬,对新手还是挺棒的.来学下shell脚本和php. 把书上不熟悉的命令和选项记录下. mkdir -v创建文件夹并返回信息 mkdir -m创建文件夹并设定权限 ...

  6. /usr/bin/ld: cannot find -lc错误原因及解决方法

    问题解决 我在执行如下命令的时候,出现了错误. gcc -o main main.c -static -L. –lmylib Linux环境下gcc静态编译/usr/bin/ld: cannot fi ...

  7. Linux安装MediaWiki

    1.    编译安装libxml2 # wget http://xmlsoft.org/sources/libxml2-2.6.32.tar.gz # tar zxvf libxml2-2.6.32. ...

  8. 源码分享!!!world文档转换为JPG图片

    http://bbs.csdn.net/topics/390055515 —————————————————————————————————————————————————— 基本思路是:先将worl ...

  9. 组合数学 - BZOJ 3997 - TJOI2015

    TJOI2015 Problem's Link ---------------------------------------------------------------------------- ...

  10. 005杰信-factory删除数据

    factory表的删除分为两种:单行删除,以及批量删除. 过程:在jFactoryCreate.jsp页面上两个按钮,单行删除以及批量删除.