本文主要是介绍memcached相关,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1,安装
1)先安装libevent ,它是 memcached 所依赖的异步事件通知库.
2) 安装memcached
2,开启
./memcached -d - m 512 -l xxx.xxx.xxx.xxx -p 11211 -u root -P /var/rn/memcached.pid
表示:这会以守护程序的形式启动 memcached(-d),为其分配 512 内存(-m 512),并指定监听 localhost,端口 11211
3,使用
telnet xxx.xxx.xxx.xxx
用 stats 命令查看
显示:
stats pid xxxx
stats uptime xxxx
....,表明是正确的。
4,关闭
kill -9 `/var/run/memcached`
查看下:netstat -anp | grep memcached
此时没了。
在安装的过程中出现了一些问题:
1,“configure: error: no acceptable C compiler found in $PATH”
没找到可用的C编译器,可能是GCC没装,装了GCC就行了搜索(如果已经装了,把路径加入PATH即可)
yum install gcc gcc-c++ autoconf automake
2, can't run as root without the -u switch
这是因为在使用 ./memcached -d ...命令时未使用 -u root
3, telnet localhost 11211
telnet:comment not found
yum install telnet 就好。
这篇关于memcached相关的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!