Linux command line view memcached run status (Shell)

Source: Internet
Author: User
Tags cas memcached

Stats
To view the basic commands for the memcached status, this command allows you to see the following information:
STAT PID 22459 Process ID
STAT uptime 1027046 server running seconds
STAT time 1273043062 Server current UNIX timestamp
STAT version 1.4.4 Server version
STAT pointer_size 64 OS Word size (this server is 64-bit)
STAT rusage_user 0.040000 Process Cumulative User Time
STAT rusage_system 0.260000 Process Cumulative system time
STAT curr_connections 10 Number of currently open connections
STAT total_connections 82 Total connections that were opened
STAT connection_structures 13 Number of connection structures allocated by the server
STAT cmd_get 54 Execute Get Command Total
STAT Cmd_set 34 Execute SET command total
STAT Cmd_flush 3 points to the total number of FLUSH_ALL commands
STAT get_hits 9 Get hit count
STAT get_misses number of Get misses
STAT delete_misses 5 Delete misses
STAT delete_hits 1 Delete hit count
STAT incr_misses 0 incr number of misses
STAT incr_hits 0 incr hit count
STAT decr_misses 0 decr number of misses
STAT decr_hits 0 DECR hit count
STAT cas_misses 0 CAs misses
STAT cas_hits 0 CAs hit count
STAT Cas_badval 0 Use wipe count
STAT Auth_cmds 0
STAT auth_errors 0
STAT bytes_read 15785 Read Bytes total
STAT bytes_written 15222 Write Bytes Total
STAT limit_maxbytes 1048576 Allocated memory number (bytes)
STAT Accepting_conns 1 Number of links currently accepted
STAT Listen_disabled_num 0
STAT Threads 4 Thread Count
STAT Conn_yields 0
STAT bytes 0 Stores the item byte number
STAT Curr_items 0 Item number
STAT total_items Total number of item
STAT evictions 0 To get the total amount of space deleted item


Stats items
Outputs the item information in each slab. S
Stats Slabs
More detailed item information in the output slab
Stats sizes
Output the size and number of all item

Stats Cachedump <slab_id> <limit_num>


According to the <slab_id> output the same <slab_id> in the item information. <limit_num> is the number of outputs, when <limit_num> is 0 is the output of all item.


Manipulating memcached with Shell commands
1. Data storage (assuming key is g,value to 12345)

printf "Set G 0 0 5\r\n12345\r\n" |nc 127.0.0.1 11211

STORED

2. Data retrieval (assuming key is Zhangyan)


printf "Get g\r\n" |nc 127.0.0.1 11211

VALUE G 0 5
12345
END

3, the value is increased by 1 (assuming that key is G, and value is a positive integer)

printf "incr g 1\r\n" | NC 127.0.0.1 11211

12346

4, the value is reduced by 3 (assuming that key is G, and value is a positive integer)

printf "Decr g 3\r\n" | NC 127.0.0.1 11211

12343

5. Data deletion (assuming key is g)

printf "Delete g\r\n" | NC 127.0.0.1 11211

DELETED

6. View memcached Status

printf "stats\r\n" | NC 127.0.0.1 11211

STAT PID 3025
STAT Uptime 4120500
STAT Time 1228021767
STAT version 1.2.6
STAT Pointer_size 32
STAT Rusage_user 433.463103
STAT Rusage_system 1224.515845
STAT Curr_items 1132460
STAT Total_items 8980260
STAT bytes 1895325386
STAT curr_connections 252
STAT total_connections 547850
STAT Connection_structures 1189
STAT Cmd_get 13619685
STAT Cmd_set 8980260
STAT get_hits 6851607
STAT get_misses 6768078
STAT Evictions 0
STAT Bytes_read 160396238246
STAT Bytes_written 260080686529
STAT limit_maxbytes 2147483648
STAT Threads 1
END

7. Simulate top command to view memcached status:

Watch "printf ' stats\r\n ' | NC 127.0.0.1 11211 "

Or

Watch "Echo Stats | NC 127.0.0.1 11211 "

First, echo stats items | nc127.0.0.1 11211
STAT items:1:number 998 Slab id=1; Items: 998 (that is, 998 key values have been stored)
STAT items:1:age 604348 Slab id=1; Time already exists, unit seconds
STAT items:1:evicted 0 Slab id=1; The number of kicked out
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:6:number 91897 Slab id=6; Items: 91897 (that is, 91,897 key values have been stored)
STAT items:6:age 604345 Slab id=6; Time already exists, unit seconds
STAT items:6:evicted 0 Slab id=6; The number of kicked out
STAT Items:6:evicted_nonzero 0
STAT Items:6:evicted_time 0
STAT Items:6:outofmemory 0
STAT Items:6:tailrepairs 0
STAT items:6:reclaimed 0

Linux command line view memcached run status (Shell)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.