码迷,mamicode.com
首页 > 系统相关 > 详细

Memcached

时间:2016-04-21 11:58:16      阅读:228      评论:0      收藏:0      [点我收藏+]

标签:memcached

Memcached

[root@www Memcached]# mkdir -p /Memcached 

[root@www Memcached]# cd /Memcached

[root@www Memcached]# cat /etc/redhat-release 

CentOS release 6.5 (Final)

[root@www Memcached]# uname -m

x86_64

[root@www Memcached]# uname -r

2.6.32-431.el6.x86_64

[root@www Memcached]# 


[root@www Memcached]# yum install -y libevent libevent-devel nc


wget http://www.memcached.org/files/memcached-1.4.25.tar.gz

tar xf memcached-1.4.25.tar.gz 

cd memcached-1.4.25

./configure 

make 

make  install 

cd ..


[root@www Memcached]# /usr/local/bin/memcached -m 16m -p 11211 -d -u root -c 8192

[root@www Memcached]# /usr/local/bin/memcached -m 16m -p 11212 -d -u root -c 8192 

[root@www Memcached]# netstat -tnlp

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   

tcp        0      0 0.0.0.0:11211               0.0.0.0:*                   LISTEN      3312/memcached      

tcp        0      0 0.0.0.0:11212               0.0.0.0:*                   LISTEN      3319/memcached    



[root@www Memcached]# printf "set key1 0 0 3\r\nwqh\r\n" | nc 127.0.0.1 11211

STORED

[root@www Memcached]# printf "get key1\r\n" | nc 127.0.0.1 11211

VALUE key1 0 3

wqh

END

[root@www Memcached]# 


[root@www Memcached]# printf "delete key1\r\n" | nc 127.0.0.1 11211   

DELETED

[root@www Memcached]# printf "get key1\r\n" | nc 127.0.0.1 11211   

END

[root@www Memcached]# 


[root@www Memcached]# yum -y install telnet

[root@www Memcached]# telnet 127.0.0.1 11212

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is ‘^]‘.

set user1 0 0 3

wqh

STORED

get user1

VALUE user1 0 3

wqh

END

delete user1

DELETED

get user1

END


# wget http://pecl.php.net/get/memcache-2.2.7.tgz

[root@www Memcached]# tar xf memcache-2.2.7.tgz

[root@www Memcached]# cd memcache-2.2.7

[root@www memcache-2.2.7]# /usr/bin/phpize

# ./configure --enable-memcache --with-php-config=/usr/bin/php-config

# make 

# make install 

Installing shared extensions:     /usr/lib64/php/modules/

[root@www memcache-2.2.7]# 


# ll  /usr/lib64/php/modules/

-rwxr-xr-x 1 root root  246272 Apr 20 17:11 memcache.so



[root@www Memcached]# vim /etc/php.ini 

extension_dir = "/usr/lib64/php/modules"

extension=memcache.so

                                                     

[root@www Memcached]# vim /var/www/html/op_mem.php

<?php

        $memcache = new Memcache;

        $memcache->connect(‘127.0.0.1‘,11211)or die("Could not connect Mc server");

        $memcache->set(‘key‘,‘wqh‘);

        $get = $memcache->get(‘key‘);

        echo $get;

?>

~                                                                                                             

~       


[root@www Memcached]# printf "stats\r\n"|nc 127.0.0.1 11211



[root@www Memcached]# telnet 127.0.0.1 11211

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is ‘^]‘.

stats


[root@www Memcached]# printf "stats items\r\n"|nc 127.0.0.1 11211

STAT items:1:number 1

STAT items:1:age 2101

STAT items:1:evicted 0

STAT items:1:evicted_nonzero 0

STAT items:1:evicted_time 0

STAT items:1:outofmemory 0

STAT items:1:tailrepairs 0

STAT items:1:reclaimed 0

STAT items:1:expired_unfetched 0

STAT items:1:evicted_unfetched 0

STAT items:1:crawler_reclaimed 0

STAT items:1:crawler_items_checked 0

STAT items:1:lrutail_reflocked 0

END

[root@www Memcached]# 




# wget http://www.junopen.com/memadmin/memadmin-1.0.12.tar.gz

# tar xf memadmin-1.0.12.tar.gz -C /var/www/html/


http://192.168.1.212/memadmin/



Memcached

标签:memcached

原文地址:http://wangqh.blog.51cto.com/5367393/1766120

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!