标签:memcached libevent ubuntukylin 安装
Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载。它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提高动态、数据库驱动网站的速度。Memcached基于一个存储键/值对的hashmap。其守护进程(daemon )是用C写的,但是客户端可以用任何语言来编写,并通过memcached协议与守护进程通信。
参考:百度百科-Memcached介绍
到官网下载源码,我下载的版本为memcached-1.4.24。解压后进入目录memcached-1.4.24。
2.1配置Libevent安装路径:
因为我把Libevent安装到了/usr目录下,因此配置如下:
//配置Libevent路径
./configure --with-libevent=/usr
//编译
make
//安装
sudo make install
查看目录/usr/local/bin/是否有memcached的可执行文件,如果有即为安装成功!
运行/usr/local/bin/memcached -d -m 128 -u root -p 8000 -c 500 -P /tmp/memcached.pid
其中:
-d表示启动后台守护进程。
-m表示分配内存大小,单位为M。
-u指定运行Memcached的用户。
-p指定服务端口号。
-c指定最大并发数。
-P指定Memcached的pid文件位置。
查看启动情况:
ps -ef|grep memcached
kang 5152 1786 0 10:04 ? 00:00:00 /usr/local/bin/memcached -d -m 128 -u root -p 8000 -c 500 -P /tmp/memcached.pid
可以看到其进程ID为5152。
客户的测试:
kang@kang-ubuntu:~$ telnet localhost 8000
Trying 127.0.0.1...
Connected to localhost.
Escape character is ‘^]‘
输入stats查看其状态:
stats
STAT pid 5152
STAT uptime 386
STAT time 1440727843
STAT version 1.4.24
STAT libevent 2.0.22-stable
STAT pointer_size 64
STAT rusage_user 0.004911
STAT rusage_system 0.004911
STAT curr_connections 10
STAT total_connections 11
STAT connection_structures 11
STAT reserved_fds 20
STAT cmd_get 0
STAT cmd_set 0
STAT cmd_flush 0
STAT cmd_touch 0
STAT get_hits 0
STAT get_misses 0
STAT delete_misses 0
STAT delete_hits 0
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT touch_hits 0
STAT touch_misses 0
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 7
STAT bytes_written 0
STAT limit_maxbytes 134217728
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT hash_power_level 16
STAT hash_bytes 524288
STAT hash_is_expanding 0
STAT malloc_fails 0
STAT bytes 0
STAT curr_items 0
STAT total_items 0
STAT expired_unfetched 0
STAT evicted_unfetched 0
STAT evictions 0
STAT reclaimed 0
STAT crawler_reclaimed 0
STAT crawler_items_checked 0
STAT lrutail_reflocked 0
END
可以看出STAT pid为5152。至此安装完成。
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:memcached libevent ubuntukylin 安装
原文地址:http://blog.csdn.net/kangroger/article/details/48064811