1. Start common memcache Parameters
-P <num> TCP port of the listener (default: 11211)
-U <num> UDP listening port (default: 11211, disabled when 0)
-D run as a daemon
-U <username> the account running memcached is not a root user.
-M <num> the maximum memory usage unit is MB. The default value is 64 MB.
-C <num> the default number of soft connections is 1024.
-V output warning and error message
-VV: print the client's request and return information
-H: Print help information
-I print the copyright information of memcached and libevent.
-L <ip_addr> binding address (default: All IP addresses are allowed, regardless of Intranet and Internet addresses or local IP addresses. If this parameter is set to 127.0.0.1, only local access is allowed)
-P <File> writes the PID to the file <File>. This can cause the process to terminate after the end, which must be used with-D.
2. memcache Telnet commands
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 |
Memcache server process ID |
Uptime |
Number of seconds that the server has run |
Time |
Current UNIX timestamp of the server |
Version |
Memcache version |
Pointer_size |
Pointer size of the current operating system (32-bit system is generally 32bit) |
Rusage_user |
Cumulative user time of the process |
Rusage_system |
Cumulative system time of processes |
Curr_items |
Number of items currently stored on the server |
Total_items |
Total number of items stored after server startup |
Bytes |
Number of bytes occupied by items stored on the current server |
Curr_connections |
Number of currently opened connections |
Total_connections |
Number of connections that have been opened since the server is started |
Connection_structures |
Number of connections allocated by the server |
Pai_get |
Total get command (get) Requests |
Performance_set |
Total number of SET command (SAVE) Requests |
Get_hits |
Total hits |
Get_misses |
Total number of missed hits |
Evictions |
Number of items deleted to get idle memory (the old items need to be deleted after the space allocated to memcache is full to get the space allocated to the new items) |
Bytes_read |
Total number of read bytes (number of request bytes) |
Bytes_written |
Total number of sent bytes (number of returned bytes) |
Limit_maxbytes |
Memory size (bytes) allocated to memcache) |
Threads |
Current thread count |
4. Start tips for memcache
A: Listener Intranet address
B: Modify the default port number.
C: set the maximum number of connections and the maximum memory usage.