Memcached is a high-performance distributed memory object caching system that can be used to store data in a variety of formats, including images, videos, files, and database retrieval results, by maintaining a unified, huge hash table in memory. The simple thing is to call the data into memory and then read it from memory, which greatly improves the reading speed.
Yum Install libevent-devel-y libevent Library
Tar xvzf memcached-1.4. - -s/application/memcached-1.4. /usr/local/memcached. /configure--prefix=/application/memcached-1.4.20Makemake Install
/usr/local/memcached/bin/memcached-d-M 64-i 20m-u root-l 192.168.4.86-p 11211-c 1024-p/USR/LOCAL/MEMCACHED/MEMCAC Hed.pid
| Options |
Meaning description |
| -D |
Specifies that the memcached process is started as a daemon process |
| M <num> |
Specify the amount of memory allocated to memcached, in megabytes |
| -U <username> |
Users running the memcached |
| -L <ip_addr> |
The server IP address of the listener, if there are multiple addresses, separated by commas, the format can be "IP address: Port number", for example:-L to specify 192.168.0.184:19830,192.168.0.195:13542; Port number can also be specified by the-p option |
| -P <num> |
Memcached Listen on the port, to ensure that the port number is not occupied |
| -C <num> |
Set the maximum number of concurrent connections to run, default is 1024 |
| -R <num> |
To avoid client starvation (starvation), set a limit on the number of consecutive client requests to be reached, and if this setting is exceeded, another connection is selected to process the request, which defaults to 20 |
| -K |
Set the memory to lock all paging, and use this option sparingly for large cache scenarios |
| -P |
Save the PID file for the memcached process |
| -S <file> |
Specify the UNIX socket file that memcached uses for listening |
| -A <perms> |
Set the-S option to specify the permissions of the UNIX socket file |
| -U <num> |
Specifies the port on which UDP is listening, by default 11211,0 means shutdown |
| -M |
Disables automatic purging of data items in the cache when memory usage exceeds the configured value, at which point memcached is not allowed until memory is freed |
| -R |
Set the resulting core file size |
| -F <factor> |
Multiplier factor for calculating the memory block size of cached data items, default is 1.25 |
| -N |
Sets the minimum number of bytes allocated for the key, value, flag of the cached data item, which is 48 by default |
| -C |
Disable CAs |
| -H |
Display memcached version and summary information |
| -V |
Output warnings and error messages |
| -vv |
Print information more detailed than-V: not only output warnings and error messages, but also output client request and response information |
| -I. |
Print licenses information for libevent and memcached |
| -T <threads> |
Specifies the number of threads used to process the request, which defaults to 4 |
| -D <char> |
The delimiter between the key prefix and the ID in the statistics report, which is the colon ":" By default. |
| -L |
Try using large memory paging (pages) |
| b <proto> |
Specifies the protocol used, the default behavior is auto-negotiation (autonegotiate), and the options that may be used are auto, ASCII, binary. |
| -I <size> |
Overrides the default Stab page size, which is 1M by default |
| -F |
Disable the Flush_all command |
| -O <options> |
Specify comma-delimited options, typically used for extended or experimental properties |
Memcached can start multiple instances, specify different ports
Put the above command in the/etc/rc.local, set the boot start
telnet 127.0.0.1 11211 连接数据库
Stats command
This command is used to display server information, statistical data
Linux Learning notes Summary--memcached configuration