Keyword: memcached (Windows) installation and configuration
1. Download the Windows version of memcached:http://code.jellycan.com/memcached/
2. After decompression, put in the directory of the hard disk, such as: D:\memcached. Then enter cmd into the command line in the run, enter the directory where Memcached.exe is located, for example: D:\memcached, and then enter:
CMD Code Collection Code
To the memcached root directory
1. Installation
Memcached.exe–d Install
2. Start
memcached.exe-d start
At this point memcached is already registered as the boot service
Complete the installation.
After the experiment using the command to modify the port is invalid, the corresponding solution is to modify the registry:
The purpose of this modification port is achieved by modifying the registry.
Under Hkey_local_machine\system\currentcontrolset\services\memcached Server, find a ImagePath string entry that is exactly the string of the execution path of the service, double-click on that string, After adding-l 192.168.1.135-m 45-p 12345 (Access IP: 192.168.1.135 use 45M memory, 12345 is port), then start the service.
Now try to see if you can connect:
Use the "Telnet IP port number" and use the "stats" command after logging in
CMD under
Telnet 192.168.1.135 12345 (Note: This can only be used with IP not localhost or 127.0.0.1)
Then use the: Stats command to see the use of memcached as follows:
STAT Uptime 760
STAT Time 1311913149
STAT version 1.2.1
STAT Pointer_size 32
STAT Curr_items 0
STAT Total_items 0
STAT bytes 0
STAT Curr_connections 4
STAT Total_connections 6
STAT Connection_structures 5
STAT Cmd_get 0
STAT Cmd_set 0
STAT Get_hits 0
STAT get_misses 0
STAT Bytes_read 63
STAT Bytes_written 793
STAT limit_maxbytes 10485760
END
3, the basic settings of memcached:
-P Listening Port
-L connected IP address, default is native
-D Start memcached service
-D Restart Restart memcached service
-D Stop|shutdown Close the running memcached service
-D Install memcached service
-d Uninstall Uninstall memcached service
-U Run as (only valid when running as root)
-m maximum memory usage, in megabytes. Default 64MB
-M running out of memory and returning an error instead of deleting an item
-c Maximum number of simultaneous connections, default is 1024
-F Block size growth factor, default is 1.25
-N Minimum allocated space, key+value+flags default is 48
-H Display Help
4, the most important point, under Windows to install memcache through the command line to modify the parameters does not seem to have any effect, need to enter the registry to modify the startup key parameters to use, the following: Enter the registry, find Hkey_local_machine\system\ Currentcontrolset\services\memcached Server, in which there is a ImagePath entry with a value of "D:\memcached\memcached.exe"-D runservice, followed by the-l 127.0.0.1-m 3000-c 2048 The last ImagePath value should look like this:
Registry Value Code Collection code
1. D:\memcached\memcached.exe "-D runservice-l 127.0.0.1-m 3000-c 2048
D:\memcached\memcached.exe "-D runservice-l 127.0.0.1-m 3000-c 2048
5, Memcached–d start memcached service, this will memcached the maximum memory modification in order to 3000MB.
For the status query of the memcached cache service, you can telnet to the service on the connection: Telnet 127.0.0.1 11211, and then use the Stats command to view the status of the cache service and return the following data:
time:1255537291 Server Current UNIX timestamp
Total_items:54 The total number of items stored since the server was started
CONNECTION_STRUCTURES:19 number of connection constructs allocated by the server
version:1.2.6 memcache Version
limit_maxbytes:67108864 The amount of memory allocated to Memcache (bytes)
cmd_get:1645 get Command (GET) total number of requests
evictions:0 the number of items to delete for free memory (the space allocated to memcache is filled with the required
To delete the old items to get the space assigned to the new items)
TOTAL_CONNECTIONS:19 number of connections that have been opened since the server was started
bytes:248723 the number of bytes occupied by the current server storage items
Threads:1 Current number of threads
Total number of get_misses:82 misses
POINTER_SIZE:32 the current operating system pointer size (32-bit system is generally 32bit)
bytes_read:490982 Total Bytes read (request bytes)
uptime:161 number of seconds the server has been running
Curr_connections:18 the number of connections currently open
pid:2816 The process ID of the Memcache server
bytes_written:16517259 total number of bytes sent (result bytes)
get_hits:1563 Total Hit Count
cmd_set:54 set Command (SAVE) Total Request count
Curr_items:28 the number of items currently stored by the server
Questions about Memcache:
What is the maximum length of a key that memcached can accept?
The maximum length of a key is 250 characters. Note that 250 is a memcached server-side limitation, and if you use a client that supports "key prefixes" or similar features, the maximum length of key (prefix + original key) can be more than 250 characters. We recommend using shorter keys because you can save memory and bandwidth.
Memcached is there any limit on the expiration time of item?
The maximum expiration time can be up to 30 days. Memcached the passed-in expiration time (time period) is interpreted as a point in time, the memcached will put the item in a failed state once it has reached this point in time. This is a simple but obscure mechanism.
memcached how big a single item can be stored?
1MB. If your data is larger than 1MB, consider compressing or splitting the client into multiple keys.
Why is the size of a single item limited to 1M bytes?
Ah ... This is a question that you often ask!
Simple answer: Because the memory allocator algorithm is like this