安装并测试memcached

1.下载libevent和memcached软件包并解压

memcached依赖于libevent,需确保libevent已经装上,才能安装memcached

[root@localhost software]# tar -xzf libevent-2.1.8-stable.tar.gz   
[root@localhost software]# tar -xzf memcached-1.5.3.tar.gz 

2.配置并安装libevent

-prefix 指定安装路径

[root@localhost libevent-2.1.8-stable]# ./configure -prefix=/usr/local/libevent 
[root@localhost libevent-2.1.8-stable]# make 
[root@localhost libevent-2.1.8-stable]# make install

3.配置并安装memcached

-with-libevent 指定libevent所在路径
-prefix 指定安装路径

[root@localhost libevent-2.1.8-stable]# cd ../memcached-1.5.3/
[root@localhost memcached-1.5.3]# ./configure -with-libevent=/usr/local/libevent -prefix=/usr/local/memcached
[root@localhost memcached-1.5.3]# make
[root@localhost memcached-1.5.3]# make install


4.安装telnet

使用telnet向memcached发送命令

[root@localhost memcached-1.5.3]# yum -y install telnet

5.启动memcached
常用的启动选项包括:

-d 启动为守护进程
-m 分配给Memcache使用的内存数量,单位是MB  
-u 运行Memcache的用户
-l 监听的IP地址(如果主机有多个地址的话)
-p 监听的端口
-c 最大运行的并发连接数,默认是1024 
-P 设置保存Memcache的pid文件,例如: /tmp/memcached.pid

[root@localhost memcached-1.5.3]# cd /usr/local/memcached/bin/
[root@localhost bin]# ./memcached -d -m 50m -p 11211 -u root

6.使用telnet连接并测试

[root@localhost bin]# telnet 127.0.0.1 11211 
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
set str 0 0 11
hello world
STORED
get str
VALUE str 0 11
hello world
END
quit
Connection closed by foreign host.
[root@localhost bin]# 



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值