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
helloworld
STORED
get key
VALUE key
helloworld
END
flush_all
OK
set name
yebin
STORED
get name
VALUE name
yebin
END
stats
STAT pid
STAT uptime
STAT time
STAT version 1.4.
STAT libevent 2.0.-stable
STAT pointer_size
STAT rusage_user 1.381789
STAT rusage_system 1.545765
STAT curr_connections
STAT total_connections
STAT connection_structures
STAT reserved_fds
STAT cmd_get
STAT cmd_set
STAT cmd_flush
STAT cmd_touch
STAT get_hits
STAT get_misses
STAT delete_misses
STAT delete_hits
STAT incr_misses
STAT incr_hits
STAT decr_misses
STAT decr_hits
STAT cas_misses
STAT cas_hits
STAT cas_badval
STAT touch_hits
STAT touch_misses
STAT auth_cmds
STAT auth_errors
STAT bytes_read
STAT bytes_written
STAT limit_maxbytes
STAT accepting_conns
STAT listen_disabled_num
STAT threads
STAT conn_yields
STAT hash_power_level
STAT hash_bytes
STAT hash_is_expanding
STAT bytes
STAT curr_items
STAT total_items
STAT expired_unfetched
STAT evicted_unfetched
STAT evictions
STAT reclaimed
END
上一篇:干货|基于 Spring Cloud 的微服务落地


下一篇:python re正则