PORT="11211" # 端口,同时监听tcp和udp的11211端口,其中udp端口可以关闭 USER="memcached" # 运行的用户名 MAXCONN="1024" # 最大并发连接数 CACHESIZE="64" # 内存空间大小 OPTIONS="" # 指定额外的选项

-s <file> Unix socket path to listen on (disables network support). # 使用本地的套接字通信,基于内存共享的方式向本机提供服务 -l <ip_addr> Listen on <ip_addr>; default to INADDR_ANY. # 监听的地址,默认监听本地所有地址 -d Run memcached as a daemon. # 将memcached运行为守护进程 -u <username> Assume the identity of <username> (only when run as root). # 以指定用户的身份运行memcached -m <num> Use <num> MB memory max to use for object storage; the default is 64 megabytes. # 使用的内存空间,默认为64M -c <num> Use <num> max simultaneous connections; the default is 1024. # 最大并发连接数,默认为1024 -p <num> Listen on TCP port <num>, the default is port 11211. # 监听的tcp端口,默认端口为11211 -U <num> Listen on UDP port <num>, the default is port 11211, 0 is off. # 监听的udp端口,默认为11211,且设置成0表示关闭 -M Disable automatic removal of items from the cache when out of memory. Additions will not be possible until adequate space is freed up. 禁止使用LRU算法去清理内存 -f <factor> The default is 1.25. # 增长因子,默认为1.25 -v Be verbose during the event loop; print out errors and warnings. # 显示详细信息 -vv Be even more verbose; same as -v but also print client commands and responses. # 显示更详细的信息 -t <threads> Number of threads to use to process incoming requests. The default is 4. # 指明memcached提供服务的线程数,默认为4个 -B <proto> Specify the binding protocol to use. By default, the server will autonegotiate client connections. By using this option, you can specify the protocol clients must speak. Possible options are "auto" (the default, autonegotiation behavior), "ascii" and "binary". # 所支持的协议,有两种,ascii和binary,默认是自动选择
[root@c7_node_03 /]# memcached-tool 127.0.0.1 # Item_Size Max_age Pages Count Full? Evicted Evict_Time OOM 1 96B 8299s 1 1 yes 0 0 0
set mykey 0 600 5 hello STORED # 表示存储一个键名为mykey的数据,存储时间为600秒,占据5个字节,存储内容为hello # 如果显示STORED,则表明数据已经存储完成
add mykey_2 0 600 5 # 存储一个先前不存在的键值对数据 world STORED add mykey_2 0 600 5 # 因为这个键已经存在了,所以无法存储成功 hello NOT_STORED
replace mykey 0 600 3 # 将名为mykey的键的值替换为123 123 STORED
get mykey mykey_1 # 获取mykey和mykey_1键对应的值和相关信息 VALUE mykey 0 3 123 VALUE mykey_1 0 5 hello END
gets mykey_1 VALUE mykey_1 0 5 6 hello END
cas mykey 0 0 3 8 456 EXISTS cas mykey 0 0 3 9 456 STORED
append mykey 0 0 3
456
STORED
prepend mykey 0 0 3
456
STORED
delete mykey
DELETED
flush_all
OK
pid Memcached 进程ID uptime Memcached 运行时间,单位:秒 time Memcached 当前的UNIX时间 version Memcached 的版本号 rusage_user 该进程累计的用户时间,单位:秒 rusage_system 该进程累计的系统时间,单位:秒 curr_items Memcached 当前存储的内容数量 total_items Memcached 启动以来存储过的内容总数 bytes Memcached 当前存储内容所占用的字节数(*/1024/1024=mb) curr_connections 当前连接数量 total_connections Memcached 运行以来接受的连接总数 connection_structures Memcached 分配的连接结构的数量 cmd_get 查询请求总数 cmd_set 存储(添加/更新)请求总数 get_hits 查询成功获取数据的总次数 get_misses 查询成功未获取到数据的总次数 bytes_read Memcached 从网络读取到的总字节数 bytes_written Memcached 向网络发送的总字节数 limit_maxbytes Memcached 在存储时被允许使用的字节总数
stats items STAT items:1:number 1 STAT items:1:age 12 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 END
stats slabs STAT 1:chunk_size 96 STAT 1:chunks_per_page 10922 STAT 1:total_pages 1 STAT 1:total_chunks 10922 STAT 1:used_chunks 1 STAT 1:free_chunks 10921 STAT 1:free_chunks_end 0 STAT 1:mem_requested 75 STAT 1:get_hits 10 STAT 1:cmd_set 10 STAT 1:delete_hits 1 STAT 1:incr_hits 0 STAT 1:decr_hits 0 STAT 1:cas_hits 0 STAT 1:cas_badval 0 STAT 1:touch_hits 0 STAT active_slabs 1 STAT total_malloced 1048512 END
stats sizes STAT 96 1 END
stats reset
RESET
原文:https://www.cnblogs.com/hgzero/p/13172584.html