win7 安装 wamp2.5版本的memcache+memcached
2015-06-13 14:29
731 查看
1. 下载
memcache+memcached
2. 以管理员身份运行 cmd.exe,并转至memcached所在文件夹,比如: cd c:\memcached 。(如果不以管理员身份运行,将得到报错“failed to install service or service already installed”)
(之后屏幕无任何提示)
4. 启动memcached:
c:\memcached> memcached.exe -d start
(之后屏幕无任何提示,但是在“任务管理器”中勾选“显示所有用户进程”,此时可以看到memcached.exe进程正在运行)
默认端口11211,外部访问需要开放该端口,否则无法成功连接。
5. memcached基本参数设置:
-p 监听的端口
-l 连接的IP地址, 默认是本机
-d start 启动memcached服务
-d restart 重起memcached服务
-d stop|shutdown 关闭正在运行的memcached服务
-d install 安装memcached服务
-d uninstall 卸载memcached服务
-u 以的身份运行 (仅在以root运行的时候有效)
-m 最大内存使用,单位MB。默认64MB
-M 内存耗尽时返回错误,而不是删除项
-c 最大同时连接数,默认是1024
-f 块大小增长因子,默认是1.25
-n 最小分配空间,key+value+flags默认是48
-h 显示帮助
设置参数时需要先停止memcached,然后用命令行设置,比如:c:\memcached> memcached.exe -m 1 -d start
6. 停止memcached:
c:\memcached> memcached.exe -d stop
7. 卸载memcached:
c:\memcached> memcached.exe -d uninstall
相关问题:
1. 设置最大占用内存后好像没起作用。
-m tells memcached how much RAM to use for item storage (in megabytes). Note carefully that this isn't a global memory limit, so memcached will use a few % more memory than you tell it to. Set this to safe values. Setting it to less than 48 megabytes
does not work properly in 1.4.x and earlier. It will still use the memory.
转自:http://stackoverflow.com/questions/6112324/memcached-using-more-than-max-memory
参考:https://code.google.com/p/memcached/wiki/NewConfiguringServer
2. 在同一个程序集里将一个值放入到memcache里,马上去时可以取到,但是在另一个程序集里取的时候取不到,或者telnet也拿不到值。
可能问题及解决办法:
a. 存储的值序列化后不同类型,则需要将其更新为同一类型,建议使用同一的常见类型,如string,int等,放入string可以拼成一个xml字符串,然后到使用的时候在做解析
b. 很有可能是memcache池已经满了,可以设置<socketPool minPoolSize="100" maxPoolSize="1000" connectionTimeout="00:10:00" deadTimeout="00:02:00"/>
然后在 php 目录下的 php.ini 增加一段内容
extension=php_memcache.dll
加完之后,重启 apache
然后 在php页面输出phpinfo();
检查 memcache 是否成功加载了。
如果成功加载了 ,就可以 在一个php页面做 memcache测试了<?php
//phpinfo();
$memcache = new Memcache;
$memcache->connect('127.0.0.1',11211) or die('shit');
$memcache->set('key','hello memcache!');
$out = $memcache->get('key');
echo $out;
成功的话会输出
hello memcache!
memcache+memcached
2. 以管理员身份运行 cmd.exe,并转至memcached所在文件夹,比如: cd c:\memcached 。(如果不以管理员身份运行,将得到报错“failed to install service or service already installed”)
3. 安装memcached:
c:\memcached> memcached.exe -d install(之后屏幕无任何提示)
4. 启动memcached:
c:\memcached> memcached.exe -d start
(之后屏幕无任何提示,但是在“任务管理器”中勾选“显示所有用户进程”,此时可以看到memcached.exe进程正在运行)
默认端口11211,外部访问需要开放该端口,否则无法成功连接。
5. memcached基本参数设置:
-p 监听的端口
-l 连接的IP地址, 默认是本机
-d start 启动memcached服务
-d restart 重起memcached服务
-d stop|shutdown 关闭正在运行的memcached服务
-d install 安装memcached服务
-d uninstall 卸载memcached服务
-u 以的身份运行 (仅在以root运行的时候有效)
-m 最大内存使用,单位MB。默认64MB
-M 内存耗尽时返回错误,而不是删除项
-c 最大同时连接数,默认是1024
-f 块大小增长因子,默认是1.25
-n 最小分配空间,key+value+flags默认是48
-h 显示帮助
设置参数时需要先停止memcached,然后用命令行设置,比如:c:\memcached> memcached.exe -m 1 -d start
6. 停止memcached:
c:\memcached> memcached.exe -d stop
7. 卸载memcached:
c:\memcached> memcached.exe -d uninstall
相关问题:
1. 设置最大占用内存后好像没起作用。
-m tells memcached how much RAM to use for item storage (in megabytes). Note carefully that this isn't a global memory limit, so memcached will use a few % more memory than you tell it to. Set this to safe values. Setting it to less than 48 megabytes
does not work properly in 1.4.x and earlier. It will still use the memory.
转自:http://stackoverflow.com/questions/6112324/memcached-using-more-than-max-memory
参考:https://code.google.com/p/memcached/wiki/NewConfiguringServer
2. 在同一个程序集里将一个值放入到memcache里,马上去时可以取到,但是在另一个程序集里取的时候取不到,或者telnet也拿不到值。
可能问题及解决办法:
a. 存储的值序列化后不同类型,则需要将其更新为同一类型,建议使用同一的常见类型,如string,int等,放入string可以拼成一个xml字符串,然后到使用的时候在做解析
b. 很有可能是memcache池已经满了,可以设置<socketPool minPoolSize="100" maxPoolSize="1000" connectionTimeout="00:10:00" deadTimeout="00:02:00"/>
安装php5.5.12 memcache
就到 php/ext 目录下 把 php_memcache.dll 放到里面然后在 php 目录下的 php.ini 增加一段内容
extension=php_memcache.dll
加完之后,重启 apache
然后 在php页面输出phpinfo();
检查 memcache 是否成功加载了。
如果成功加载了 ,就可以 在一个php页面做 memcache测试了<?php
//phpinfo();
$memcache = new Memcache;
$memcache->connect('127.0.0.1',11211) or die('shit');
$memcache->set('key','hello memcache!');
$out = $memcache->get('key');
echo $out;
成功的话会输出
hello memcache!
相关文章推荐
- memcached 之 哈希一致性 和 虚拟节点 分析
- Linux下安装Memcached图解教程
- telnet memcache
- win7 下面操作memcache
- Nginx+Memcached+Tomcat集群配置实践(Sticky Session)
- 在Java Spring+Windows中使用Memcached实例
- 【转】memcached分布式部署
- [转]memcached+magent实现memcached集群
- [转]Memcache的原理和命中率的总结
- [转载]memcached stats 命令
- [转载]memcached stats 命令
- memcacheq 消息队列安装
- memcached 之 哈希一致性 和 虚拟节点 分析
- 完全卸载memcached的方法(CentOS)
- 深入研究memcache 特性和限制
- MEMCACHE类使用方法及参数详解
- Memcached源码分析之三
- 利用magent搭建memcached集群
- 关于Memcached的CAS和Set方法造成Socket泄漏的问题
- memcache真实项目缓存实例