下载:
google上很多帖子都介绍了window下1.2.1版本的安装方法,但是下载地址己经失效,还有很多window下的版本是需要有gnu环境来编译的非常麻烦,需要有linux的环境软件,所以我直接下载了一个1.2.6的exe版就是编译完成的,下载地址:http://code.jellycan.com/memcached/选择win32 binary,下载完成,解压到本地,运行memcached.exe,打开cmd进入命令行输入:telnet 127.0.0.1 11211 回车后马上切换到另一个窗口,输入stats回车显示
STAT pid 2952
STAT uptime 23573
STAT time 1295357441
STAT version 1.2.6
STAT pointer_size 32
STAT curr_items 0
STAT total_items 0
STAT bytes 0
STAT curr_connections 2
STAT total_connections 4
STAT connection_structures 3
STAT cmd_get 0
STAT cmd_set 0
STAT get_hits 0
STAT get_misses 0
STAT evictions 0
STAT bytes_read 30
STAT bytes_written 826
STAT limit_maxbytes 67108864
STAT threads 1
END
说明memcache已经启动,
pid Process id of this server process (memcache服务器的进程ID)
uptime Number of seconds this server has been running (服务器已经运行的秒数)
time Current UNIX time according to the server (服务器当前的UNIX时间)
version Version string of this server (memcache版本)
pointer_size Current system pointer 当前操作系统的指针大小(32位系统一般是32bit)
rusage_user Accumulated user time for this process (该进程累计的用户时间(秒:微妙))
rusage_system Accumulated system time for this process (该进程累计的系统时间(秒:微妙))
curr_items Current number of items stored by the server (服务器当前存储的内容数量)
total_items Total number of items stored by this server ever since it started (服务器启动以来存储过的内容总数)
bytes Current number of bytes used by this server to store items (服务器当前存储内容所占用的字节数)
curr_connections Number of open connections (当前打开着的连接数量)
total_connections Total number of connections opened since the server started running (服务器运行以来接受的连接总数)
connection_structures Number of connection structures allocated by the server (服务器分配的连接结构的数量)
cmd_get Cumulative number of retrieval requests (get命令(获取)总请求次数)
cmd_set Cumulative number of storage requests (set命令(保存)总请求次数)
get_hits Number of keys that have been requested and found present (请求成功的总次数)
get_misses Number of items that have been requested and not found (请求失败的总次数)
threads Current number of thread (当前线程数)
bytes_read Total number of bytes read by this server from network (服务器从网络读取到的总字节数)
bytes_written Total number of bytes sent by this server to network (服务器向网络发送的总字节数)
limit_maxbytes Number of bytes this server is allowed to use for storage. (服务器在存储时被允许使用的字节总数)
evictions Number of valid items removed from cache to free memory for new items (为获取空闲内存而删除的items数(分配给memcache的空间用满后需要删除旧的items来得到空间分配给新的items))
其中,最关注最多的几个参数:
uptime:是memcached运行的秒数。
cmd_get:是查询缓存的次数。
cmd_get/uptime 结果是平均每秒请求缓存的次数——结果值越大,说明Memcached的利用率越高,站点的访问量大,如果太低,用文件系统缓存就可以了,根本不会体现出使用memcached的强大性能。
cmd_set:是设置key=>value的次数。整个memcached是个大hash,用cmd_get没有找到的内容,就会调用一下cmd_set写进缓存里。
get_hits:是缓存命中的次数。所谓的命中率 = get_hits/cmd_get * 100%。
get_misses:是缓存未命中的次数。get_misses加上get_hits就等于cmd_get。
stats:显示服务器信息、统计数据等
stats reset:清空统计数据
stats slabs:显示各个slab的信息,包括chunk的大小、数目、使用情况等
stats items:显示各个slab中item的数目和存储时长(最后一次访问距离现在的秒数)
quit:退出
三、利用shell命令操作Memcached
1、数据存储(key为wan,value为123)
2、数据取回
3、替换数据(将以wan为key存储的值替换为122)
4、数值增加 1
5、数值减少 2
6、数据删除
7、查看Memcached当时状态
printf "stats/r/n" | nc 127.0.0.1 11211
8、查看Memcached实时状态
watch "printf 'stats/r/n' | nc 127.0.0.1 11211"
Memcached protocol 中英文档可以参考:
http://blog.s135.com/book/memcached/
四. 查看slabs的使用状况
使用memcached的创造着Brad写的名为 memcached-tool 的Perl脚本,可以方便地获得slab的使用情况(它将memcached的返回值整理成容易阅读的格式)。可以从下面的地址获得脚本:
http://code.sixapart.com/svn/memcached/trunk/server/scripts/memcached-tool
[root@localhost html]# vim memcached-tool
[root@localhost html]# chmod +x memcached-tool
[root@localhost html]# ./memcached-tool 127.0.0.1:11211
# Item_Size Max_age 1MB_pages Count Full?
1 80 B 0 s 1 0 no
2 104 B 12175 s 1 1 no
3 176 B 1339587 s 33 196567 yes
各列的含义:
#: slab class编号
Item_Size: Chunk大小
Max_age: LRU内最旧的记录的生存时间
1MB_pages: 分配给Slab的页数
Count: Slab内的记录数
Full?: Slab内是否含有空闲chunk
五. 也可以图形化监控 Memcached 的运行状态
http://livebookmark.net/journal/2008/05/21/memcachephp-stats-like-apcphp/
是一个PHP源文件,只需要修改源码中的用户名、密码以及数组$MEMCACHE_SERVERS 就可以了。
其他版本的memcache下载地址及编译安装方法参见http://weimingtom.javaeye.com/blog/745451
分享到:
相关推荐
Memcache是一款强大的NOSQL工具,使用简单,高效。这个版本是1.2.6,在windows服务器上可以使用,是稳定版。目前在我的个人博客已经使用。
一、在 linux 编译安装memcache、redis等,需要 gcc,make,cmake,autoconf,libtool 等工具, 直接使用yum安装即可: yum install gcc make cmake autoconf libtool 二、下载官方源码: memcached依赖于libevent库,因此...
memcache window 环境下软件的安装下载
本程序包适用于无法联网情况一键编译安装apache2.2.31 php5.3.29 memcache用于64位环境下安装centos6系列,不是64位的不要下载。普通安装在一些特殊环境下不能连接互联网,所以这里把所有依赖包全部找齐了。源码编译...
最新windows的memcache模块下载 这个模块是平和php5.4的,在我的windowsxp php5.3.4上安装成功
技术分享:Linux下Memcache的源码安装
window底下安装memcache的插件,包含memcache.exe和dll.
memcache 客户端监控工具编译版(window版),很有用的一个工具,监控key情况助手,好东西一定要分享。
Windows下的Memcache安装: 1. 下载memcache的windows稳定版,解压放某个盘下面,比如在c:\memcached 2. 在终端(也即cmd命令界面,"注意这里一定要在超级管理员下执行,否则会出现问题")下输入 'c:\memcached\...
本人在安装和操作过程中终于遇到的问题和解决方法,还有过程。
Linux环境下Memcache的安装
源码编译安装 apache2.2.31 + php5.3.29 + memcache 自动安装mysql,mysqlli,pdo_mysql,openssl,curl,gd,memcache等扩展。 chmod +x hj.sh ./hj.sh 如果提示:no such file or directory:说明hj.sh非unix编码重新...
CentOS Minimal LNMP + Memcache 编译安装过程 CentOS Minimal LNMP + Memcache 编译安装过程
memcache安装与详解,可以用做memcache手册
ubuntu 编译安装php 5.3.3+memcache的方法,需要的朋友可以参考下。
当初自己在linux下安装memcache缓存服务器,由于第一次操作,花费不少时间, 搞了半天记录成文档,亲自测试启动memcache可以运行,分享给第一次操作的生手。 如果本机linux有lib库也可以直接编译自己的lib库(建议...
在Linux下memcache安装配置文档,很详细的哦
memcached-1.2.6-win32-bin
NULL 博文链接:https://limon87.iteye.com/blog/836763