安装memcached:
复制代码 代码示例:
sudo apt-get install memcache
如果系统找不到 memcache 安装包
更新软件源
您可以使用以下列表中的任何一个源镜像只要往您的 /etc/apt/sources.list 文件中添加一行:
复制代码 代码示例:
deb http://security.ubuntu.com/ubuntu hardy-security main universe
重新安装
复制代码 代码示例:
sudo apt-get update
sudo apt-get install memcache
检验是否安装成功.
-----
1. 安装成功之后,memcache就自己启动了.通过进程查看一下
ps -aux
会查到一条记录
/usr/bin/memcached -m 64 -p 11211 -u nobody -l 127.0.0.1
显示的就是 memcached 的端口11211 用户nobody 地址 127.0.0.1
2. 连接memcached 服务器
telnet 127.0.0.1 11211
然后输入
stats
就显示出来当前memcached的各种参数了..
sysadmin@ubuntu:/etc/apt$ telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
stats
STAT pid 3065
STAT uptime 170
STAT time 1334121278
STAT version 1.4.7
STAT libevent 2.0.12-stable
STAT pointer_size 64
STAT rusage_user 0.004000
STAT rusage_system 0.000000
STAT curr_connections 5
STAT total_connections 7
STAT connection_structures 6
STAT cmd_get 0 www.2cto.com
STAT cmd_set 0
STAT cmd_flush 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 auth_cmds 0
STAT auth_errors 0
STAT bytes_read 140
STAT bytes_written 856
STAT limit_maxbytes 67108864
STAT accepting_conns 1
STAT listen_
disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT bytes 0
STAT curr_items 0
STAT total_items 0
STAT evictions 0
STAT reclaimed 0
END
3. 手动启动memcached
memcached -d -m 128 -l 127.0.0.1 -p 11211 -u root
以root用户,分配最大2GM内存启动memcache
memcached -d -m 128 -l 127.0.0.1 -p 11212 -u root
在另外一个端口11212启动另外一个memcache实例。
以上介绍了ubuntu中memcached的安装与简单配置,希望对大家有所帮助。
>>> 猜你喜欢:linux下memcache memcached安装与配置教程大全