首页 > 代码库 > Memcached 小结
Memcached 小结
memcached 分布式内存对象缓存系统;
内存缓存;把所取对象或数据缓存在内存中;内存中缓存的这些数据通过API的方式被存取;
数据就像是一张HASH表,以key-value对的方式存在。
用来减轻数据库的压力,提高网站的响应速度,构建快速可扩展的web应用。
内置内存管理方式;使用LUR自动删除不使用的存储,重用过期数据的内存空间。
所以重启机器之后缓存数据会丢失。
下载依赖 libevent
也可以 yum安装
# yum install libevent
源码
# https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
# tar -xf libevent-2.0.22-stable.tar.gz
# cd libevent-2.0.22-stable
# ./configure
# make &&make install
memcached 下载安装;
# wget https://memcached.org/latest
[you might need to rename the file] 默认是最新版本;
# tar -zxf memcached-1.x.x.tar.gz
# cd memcached-1.x.x
# ./configure --prefix=/usr/local/memcached
# make && make test && sudo make install
启动失败?
[root@Ansible memcached-1.4.30]# /usr/local/bin/memcached
/usr/local/bin/memcached: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory
[root@Ansible memcached-1.4.30]# find / -name libevent-2.0.so.5
/opt/memcached/libevent-2.0.22-stable/.libs/libevent-2.0.so.5
/usr/local/lib/libevent-2.0.so.5
编辑 /etc/ld.so.conf 添加以上;
[root@Ansible memcached-1.4.30]# vi /etc/ld.so.conf
[root@Ansible memcached-1.4.30]# ldconfig
启动:指定root 或者切换非root
[root@Ansible memcached-1.4.30]# /usr/local/bin/memcached -m 32m -p 11211 -d -u root
# yum install telnet
[root@Ansible memcached-1.4.30]# telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is ‘^]‘.
查看状态:
stats
管理工具
memcached-tool
yum install memcached-tool
本文出自 “logs” 博客,请务必保留此出处http://51log.blog.51cto.com/6076767/1851188
Memcached 小结