memcache运维整理

memcache运维总结

第一部分:memcache安装

1、安装libevent

 

2、安装memcache

 

3、安装php的memcache扩展

 

4、测试



第二部分:memcache客户端操作

1、重要操作(来源: http://blog.163.com/xiao66_fei/blog/static/1099087642012911114848150/)

Command

Description

Example

get

Reads a value

get mykey

set

Set a key unconditionally

set mykey 0 60 5

add

Add a new key

add newkey 0 60 5

replace

Overwrite existing key

replace key 0 60 5

append

Append data to existing key

append key 0 60 15

prepend

Prepend data to existing key

prepend key 0 60 15

incr

Increments numerical key value by given number

incr mykey 2

decr

Decrements numerical key value by given number

decr mykey 5

delete

Deletes an existing key

delete mykey

flush_all

Invalidate specific items immediately

flush_all

Invalidate all items in n seconds

flush_all 900

stats

Prints general statistics

stats

Prints memory statistics

stats slabs

Prints memory statistics

stats malloc

Print higher level allocation statistics

stats items

 

stats detail

 

stats sizes

Resets statistics

stats reset

version

Prints server version.

version

verbosity

Increases log level

verbosity

quit

Terminate telnet session

quit

 

2、操作实例

[root@localhost yebin]# telnet xxx.xxx.xxx.xxx 40xxx 

Trying xxx.xxx.xxx.xxx...

Connected to xxx.xxx.xxx.xxx.

Escape character is '^]'.

set key 32 0 10

helloworld

STORED

get key  

VALUE key 32 10

helloworld

END

flush_all

OK

set name 10 0 5

yebin

STORED

get name

VALUE name 10 5

yebin

END

stats

STAT pid 7436

STAT uptime 107690

STAT time 1413881141

STAT version 1.4.15

STAT libevent 2.0.21-stable

STAT pointer_size 64

STAT rusage_user 1.381789

STAT rusage_system 1.545765

STAT curr_connections 5

STAT total_connections 271

STAT connection_structures 8

STAT reserved_fds 20

STAT cmd_get 248

STAT cmd_set 4

STAT cmd_flush 1

STAT cmd_touch 0

STAT get_hits 2

STAT get_misses 246

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 7968

STAT bytes_written 1873

STAT limit_maxbytes 536870912

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 bytes 75

STAT curr_items 1

STAT total_items 2

STAT expired_unfetched 0

STAT evicted_unfetched 0

STAT evictions 0

STAT reclaimed 1

END

 

你可能感兴趣的:(memcache)