Linux View memcached Status

Source: Internet
Author: User
Tags cas memcached touch command

First, using the Memcache top script

Memcache-top is a Perl-written command-line gadget used to get detailed information about the memcached cache server in real time, such as cache hit ratio. To the official website to download the script, put in the user directory, directly run.

/home/nihaoya/memcache-top

INSTANCE USAGE hit% CONN time evict/s read/s write/s
10.50.11.5:11211 88.8% 69.6% 1123 1.9ms 0.3 13.1K 36.2K
10.50.11.5:11212 88.7% 69.6% 1175 0.6ms 0.3 12.4K 28.1K
10.50.11.5:11213 88.8% 69.4% 1148 0.7ms 0.0 16.6K 32.1K
10.50.12.5:11211 89.3% 81.5% 1460 0.7ms 0.3 17.7K 204.0K
10.50.12.5:11212 89.4% 69.3% 1174 0.6ms 1.0 28.9K 63.5K
10.50.12.5:11213 89.3% 69.4% 1158 0.7ms 0.7 166.3K 194.4K
10.50.15.5:11211 89.3% 71.8% 1472 0.8ms 0.0 37.3K 59.2K
10.50.15.5:11212 89.4% 69.3% 1143 0.7ms 0.7 44.9K 35.4K
10.50.15.5:11213 89.3% 84.5% 1371 0.7ms 0.7 49.0K 187.2K
10.50.9.90:11211 30.2% 76.3% 259 0.7ms 0.0 243 999
10.50.9.90:11212 19.2% 60.3% 261 0.7ms 0.0 40 801
10.50.9.90:11213 17.5% 16.9% 235 0.6ms 0.0 70 600

average:72.4% 67.3% 998 0.8ms 0.3 32.2K 70.2K

TOTAL:23.4GB 11.7K 9.2ms 4.0 386.4K 842.3K

Second, using Telnet, you can only view a node's

[[Email protected] ~]# telnet 127.0.0.1 11211

Trying 127.0.0.1 ...

Connected to 127.0.0.1.

Escape character is ' ^] '.

Stats

STAT PID 22362 The process ID of the//memcache server www.2cto.com

STAT uptime 1469315//number of seconds the server has been running

STAT time 1339671194//server current UNIX timestamp

STAT version 1.4.9//memcache version

STAT libevent 1.4.9-stable//libevent version

STAT pointer_size 64//Current operating system pointer size (32-bit system is generally 32bit,64 is 64-bit operating system)

STAT Rusage_user 3695.485200//process Cumulative User Time

STAT Rusage_system 14751.273465//Process Cumulative system time

STAT curr_connections 69//The number of items currently stored by the server

STAT total_connections 855430//Total number of items stored since server startup

STAT Connection_structures 74//Number of connection constructs allocated by the server

STAT Reserved_fds 20//

STAT cmd_get 328806688//get command (GET) total number of requests

STAT cmd_set 75441133//set Command (save) The total number of requests www.2cto.com

STAT cmd_flush//flush Command Request count

STAT cmd_touch 0//touch command Request count

STAT get_hits 253547177//Total hit count

STAT get_misses 75259511//Total number of misses

STAT delete_misses 4//delete command Miss Count

STAT delete_hits 565730//delete command hit Count

STAT incr_misses 0//incr command Miss Count

STAT incr_hits 0//incr command hit count

STAT decr_misses 0//DECR command Miss Count

STAT decr_hits 0//DECR command hit count

STAT cas_misses 0//cas command Miss Count

STAT cas_hits 0//cas command hit count

STAT Cas_badval 0//Use wipe count

STAT touch_hits 0//touch command Miss Count

STAT touch_misses 0//touch command hit count

STAT AUTH_CMDS 0//Number of authentication command processing

STAT auth_errors 0//Authentication failure number

STAT Bytes_read 545701515844//Total Read bytes (number of requests bytes)

STAT Bytes_written 1649639749866//Total Bytes sent (Result byte count)

STAT limit_maxbytes 2147483648//memory size allocated to Memcache (bytes)

STAT Accepting_conns 1//Whether the server has reached the maximum connection (0/1)

STAT Listen_disabled_num 0//number of failed listeners

STAT Threads 4//When the number of front-line

STAT conn_yields 14//Connection operation active Discard number

STAT Hash_power_level 16//

STAT hash_bytes 524288

STAT hash_is_expanding 0

STAT expired_unfetched 30705763

STAT evicted_unfetched 0

STAT bytes 61380700//number of bytes currently occupied by storage

STAT Curr_items 28786//Total data currently stored

STAT Total_items 75441133//Total number of data stored since startup

STAT Evictions 0//number of items deleted for free memory (allocated to Memcache to remove old items to get space allocated to new items)

STAT reclaimed 39957976//Expired data entry to store the number of new data

END

Quit: Quit or CTRL +] and then press Q on the line.

Installing the Telenet method

1. Yum Install Telnet-server Server

2. Yum Install Telnet Client

3, Vi/etc/xinetd.d/telnet

Service Telnet
{
Flags = Reuse
Socket_type = Stream
wait = no
user = root
Server =/usr/sbin/in.telnetd
Log_on_failure + = USERID
Disable = yes
}

Change the Disable entry from Yes to No.

4,/etc/init.d/xinetd restart

Other ways:

Pre-project, Linux under memcached start/End mode

By default, memcached is installed under/usr/local/bin.

Enter the installation directory and start memcached:/usr/local/memcached/bin/memcached-d-C 10240-m 1024-u Root

Get running Status: Echo Stats | NC localhost 11211 (can view PID) or use Ps-ef|grep memcached

Stop memcached:kill-9 PID (-9 for forced kill, PID for process identifier)

The-D option is to start a daemon,

-M is the amount of memory allocated to Memcache, in megabytes, 1024MB, and 64MB by default

-U is the user running memcache, this is root

-L is the server IP address of the listener, the default should be native

-P is the port that sets Memcache listening, the default is 11211, preferably more than 1024 ports

The-c option is the maximum number of concurrent connections, the default is 1024, where 10240 is set according to the load on your server

-P is the PID file location where the memcache is set to save

-H Printing Help information

-V Output warnings and error messages

-VV request and return information for the print client

Ps-ef|grep memcached (Command description)

grep: Function Description: Find a string in the file that matches the criteria.

|: Pipeline command operator

PS (process Status): Function Description: Report the status of the program.

Connect to memcached:

Telnet IP port, such as Telnet 192.168.100.11 11211

Stats View status, Flush_all: Clear Cache

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

Another example:
Start/End
Memcached-d-M 10-u root-l 192.168.0.122-p 11200-c 256-p/tmp/memcached.pid

The-D option is to start a daemon,

-M is the amount of memory allocated to Memcache, in megabytes, 10MB

-U is the user running memcache, this is root

-L is the server IP address of the listener, if there are multiple addresses, this specifies the IP address of the server 192.168.0.122

-P is the port that sets Memcache listening, which is set to 12000, preferably more than 1024 ports

The-c option is the maximum number of concurrent connections, the default is 1024, where 256 is set according to the load on your server

-P is a PID file that is set to save Memcache

Kill ' Cat/tmp/memcached.pid '

Get Run status

Echo Stats | NC 192.168.1.123 11200

Watch "Echo Stats | NC 192.168.1.123 11200 "(real-time status)

Linux View memcached Status

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.