Brief analysis of memcache startup and telnet command details

  • 2020-06-23 00:05:07
  • OfStack

1. Start common parameters of Memcache

-p <num>  Listen to the TCP port ( The default : 11211)
-U <num> UDP Listen on port  ( The default : 11211, 0  When closing )
-d  Runs as a daemon 
-u <username>  Run run  Memcached The account of   non root The user 
-m <num>  The largest unit of memory usage is MB  The default is 64MB
-c <num>  The default is the number of soft connections 1024
-v  Output warning and error messages 
-vv  Print the client's request and return information 
-h  Print help information 
-i  print memcached and libevent Copyright information of 
-l <ip_addr>  Binding address  ( The default : All are allowed , Whether internal or external network or machine replacement IP , there is a security hazard, if set as 127.0.0.1 It can only be accessed locally )
-P <file>  will PID Written to the file <file> , which allows the later fast process to terminate ,  Need to be  -d 1 The use 

2. Memcache telnet
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
3, stats command details
pid ID server process ID uptime The number of seconds the server has been running time The current unix timestamp of the server version memcache version pointer_size Pointer size of current operating system (32bit for 32-bit system 1) rusage_user The cumulative user time of a process rusage_system The cumulative system time of the process curr_items The number of items currently stored by the server total_items The total number of items stored since the server started bytes The current number of bytes held by items is stored on the server curr_connections The number of connections currently open total_connections The number of connections that have been opened since the server started connection_structures Number of connection constructs allocated by the server cmd_get get command (fetch) total number of requests cmd_set set command (save) total number of requests get_hits Total hit count get_misses Total misses evictions The number of items deleted to get free memory (the old items needs to be deleted when the space allocated to memcache is full to get the space allocated to the new items) bytes_read Total number of bytes read (number of bytes requested) bytes_written Total number of bytes sent (number of resulting bytes) limit_maxbytes Size of memory allocated to memcache (bytes) threads Current number of threads
Memcache Start tips
a: Listens for Intranet addresses
b: Modify the default port number
c: Sets the maximum number of connections, the maximum number of memory usage

Related articles: