今天开始学习NoSQL——Memcached。工欲善其事必先利其器,首先需要学会如何安装。这里总结一下步骤。
官网介绍:
What is Memcached?
Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.
Memcached is simple yet powerful. Its simple design promotes quick deployment, ease of development, and solves many problems facing large data caches. Its API is available for most popular languages.
翻译:
什么是Memcached?
免费、开放源码、高性能、分布式内存对象缓存系统,在本质上是通用的,但目的是通过减轻数据库负载来加快动态Web应用程序的速度。
memcached是一个内存中的键值(key-value)存储,用于存储来自数据库调用、API调用或页面呈现结果的小块任意数据(字符串、对象)。
memcached很简单,但功能强大。它的简单设计促进了快速部署,易于开发,并解决了许多面临的大数据缓存问题。它的API适用于大多数流行语言。
先安装依赖:
yum -y install libevent libevent-devel
下载源码:
cd /usr/local/src
wget -O memcached.tar.gz https://memcached.org/latest
Memcached源码包很小,不到500K。
解压源码:
tar -zxvf memcached.tar.gz
配置编译选项:
cd memcached-1.5.13
./configure --prefix=/usr/local/memcached
编译安装:
make && make install
/usr/local/memcached/bin/memcached -u nobody -p 11211 -d -m 64
各参数含义:
其他更多参数使用 —help 查看。
先查看memcached进程是否启动:
ps -aux | grep memcached
输出类似如下则已经启动:
nobody 5896 0.0 0.2 414876 4176 ? Ssl 20:20 0:00 /usr/local/memcached/bin/memcached -d -m 64 -u nobody
root 5920 0.0 0.0 112724 984 pts/0 S+ 20:52 0:00 grep --color=auto memcached
使用telnet测试连接到memcached:
telnet 127.0.0.1 11211
显示如下则连接成功:
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
如果提示telnet命令没有找到,使用yum进行安装:
yun -y install telnet
暂无评论,赶紧发表一下你的看法吧。