Windows下安装Memcache
来源:互联网 发布:直销源码 编辑:程序博客网 时间:2024/05/29 02:58
由于官网没有Window版本的memcache,需要在网上搜索下载:
- 32位系统 1.4.4版本:http://static.runoob.com/download/memcached-win32-1.4.4-14.zip
- 64位系统 1.4.4版本:http://static.runoob.com/download/memcached-win64-1.4.4-14.zip
memcached <1.4.5 版本安装
1、解压下载的安装包到指定目录。
2、在 1.4.5 版本以前 memcached 可以作为一个服务安装,使用管理员权限运行以下命令:
c:\memcached\memcached.exe -d install
注意:你需要使用真实的路径替代 c:\memcached\memcached.exe。
3、然后我们可以使用以下命令来启动和关闭 memcached 服务:
c:\memcached\memcached.exe -d startc:\memcached\memcached.exe -d stop
4、如果要修改 memcached 的配置项, 可以在命令行中执行 regedit.exe 命令打开注册表并找到 "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\memcached" 来进行修改。
如果要提供 memcached 使用的缓存配置 可以修改 ImagePath 为:
"c:\memcached\memcached.exe" -d runservice -m 512
-m 512 意思是设置 memcached 最大的缓存配置为512M。
此外我们还可以通过使用 "c:\memcached\memcached.exe -h" 命令查看更多的参数配置。
5、如果我们需要卸载 memcached ,可以使用以下命令:
c:\memcached\memcached.exe -d uninstall
memcached >= 1.4.5 版本安装
1、解压下载的安装包到指定目录。
2、在 memcached1.4.5 版本之后,memcached 不能作为服务来运行,需要使用任务计划中来开启一个普通的进程,在 window 启动时设置 memcached自动执行。
我们使用管理员身份执行以下命令将 memcached 添加来任务计划表中:
schtasks /create /sc onstart /tn memcached /tr "'c:\memcached\memcached.exe' -m 512"
注意:你需要使用真实的路径替代 c:\memcached\memcached.exe。
注意:-m 512 意思是设置 memcached 最大的缓存配置为512M。
注意:我们可以通过使用 "c:\memcached\memcached.exe -h" 命令查看更多的参数配置。
3、如果需要删除 memcached 的任务计划可以执行以下命令:
schtasks /delete /tn memcached
SpringMVC中Maven配置Memcached
第一步:引入jar;在pom文件中添加以下内容
<!-- memcache --> <dependency><groupId>com.whalin</groupId><artifactId>Memcached-Java-Client</artifactId><version>3.0.0</version></dependency>
第二步:配置Memcache相关属性(init.properties)
#######################设置Memcached服务器参数########################设置服务器地址memcached.server=目标服务器ip:11211 #该端口号默认为11211#容错memcached.failOver=true#设置初始连接数memcached.initConn=20#设置最小连接数memcached.minConn=10#设置最大连接数memcached.maxConn=250#设置连接池维护线程的睡眠时间memcached.maintSleep=3000#设置是否使用Nagle算法(Socket的参数),如果是true在写数据时不缓冲,立即发送出去memcached.nagle=false#设置socket的读取等待超时时间memcached.socketTO=3000#设置连接心跳监测开关memcached.aliveCheck=true#######################设置Memcached服务器参数#######################
第三步:加载Memcache属性(memcached-content.xml)
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"xmlns:aop="http://www.springframework.org/schema/aop" xmlns:task="http://www.springframework.org/schema/task"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsdhttp://code.alibabatech.com/schema/dubbohttp://code.alibabatech.com/schema/dubbo/dubbo.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-3.2.xsdhttp://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd"><!-- Memcached配置 --> <bean id="memcachedPool" class="com.whalin.MemCached.SockIOPool" factory-method="getInstance" init-method="initialize" destroy-method="shutDown"> <property name="servers"> <list> <value>${memcached.server}</value> </list> </property> <property name="initConn"> <value>${memcached.initConn}</value> </property> <property name="minConn"> <value>${memcached.minConn}</value> </property> <property name="maxConn"> <value>${memcached.maxConn}</value> </property> <property name="maintSleep"> <value>${memcached.maintSleep}</value> </property> <property name="nagle"> <value>${memcached.nagle}</value> </property> <property name="socketTO"> <value>${memcached.socketTO}</value> </property> </bean></beans>
第四步:引入到spring配置文件中(applicationContext.xml)
<!-- 只需要加入这一句就可以 --><import resource="memcached-content.xml"/>
ok,大功告成!至于Memcache应用, 可以网上搜以下,就是一个单纯的exe文件, 用的时候打开就行,如图, 打开后就是这个样子
要想看是否连接成功的话,可以在cmd中telnet 服务器地址 11211 (服务器地址与端口号之间是一个空格, 不要输入冒号)
- Windows下安装Memcache
- windows下安装memcache
- windows 下安装memcache
- WINDOWS下安装MEMCACHE
- windows下安装memcache
- windows下安装memcache
- Windows下安装Memcache
- Windows下的Memcache安装
- Windows下的Memcache安装
- Windows下的Memcache安装
- Windows下Memcache的安装
- windows下memcache的安装
- Windows下的Memcache安装
- Windows下的Memcache安装
- Windows下的Memcache安装
- Windows下的Memcache安装
- Windows下的Memcache安装
- Windows下的Memcache安装
- angularJS1界面跳转
- 高德地图报错java.lang.UnsatisfiedLinkError: Native method not found
- AndroidStudio快捷键设置2
- 用纯js实现悬浮按钮组件
- 揭开Unity AssetBundle庐山真面目(二)
- Windows下安装Memcache
- TextView 显示内容时出现 ArrayIndexOutOfBoundsException 的解决方法(Android 4.1)
- WEB前端之HTML5[2]~HTML5新增的元素
- 深度学习常用激活函数之— Sigmoid & ReLU & Softmax
- 开机 CSU - 1254
- 若人工智能研发是登山,我们都经历了什么
- 关于电脑引导
- IBM“大数据云计算”系列讲座笔记
- Python 多进程池的学习