install Memcached for Windows

While doing some web development, I needed to have Memcached (source code) installed on my local machine to closely simulate what was going on my server. I develop under windows, and realized that installing meme Memcached isn’t as straightforward as it is on Linux. There are actually quite a few people who ask about how to do it, so I’ll give you a couple of good options. Here’s how to install the caching system on Windows.

Solution 1 : install Memcached for Windows (v1.4.5)

 

cmd-memcached-startThis is the most obvious way to do it. It took me a tiny bit of time to locate the proper files, so I have included the links I used:

  • Download a stable version, in either 32-bit or 64-bit I have tested the 64-bit version.
  • Create a directory such as c:\memcached\ (or something else)
  • Copy the .zip content to that directory. There should be one memcached.exe file by itself (32-bit) or with a couple of .dll files (64-bit)
  • Open a command prompt (need to be opened as administrator). You can do this by going to Start>Search and type “cmd”
  • Type the command “c:\memcached\memcached.exe -d start” to start the service
  • Type the command “c:\memcached\memcached.exe -d stop” to stop the service
  • To change the memory pool size, type “c:\memcached\memcached.exe -m 512” for 512MB

Your Memcached service should now run and wait incoming key/value pairs.

IMPORTANT NOTES:

1– If you want to use this in a local web app, you have to make sure that your language has built-in support for Memcached. For example, PHP may require the installation of additional libraries and modifications of the php.ini configuration file. If there’s a demand for it, I’ll write an explanation for that too.

2– The default configuration is to create a 64MB memory pool and listening on port 11211

3– Type the command “c:\memcached\memcached.exe -d install” to have Memcached started after a reboot. You should now see Memcached as a Windows Service in the control panel. IMPORTANT: if you choose to install it as a service, you lose the ability to change the pool size via command line. You will need to edit a registry key as follows:

  • Launch regedit via Start>Search
  • Find “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\memcached”
  • Edit the “–m VALUE” to the number of desired megabytes “–m 512” = 512 MB
posted @ 2016-03-18 14:04  老款码农  阅读(81)  评论(0)    收藏  举报