How do you install and configure memcached for Windows Server (2003 & 2008)?
a. Download memcached 1.2.6 from http://code.jellycan.com/memcached/, and unzip into c:\memcached
b. Open Command Prompt
c. Copy, Paste, and Run the following text into Command Prompt:
sc create "memcached_11211" binPath= "C:\memcached\memcached.exe -d runservice -p 11211 -m 800" start= auto DisplayName= "memcached Server 11211"
i. “memcached_11211” is the windows service internal name
ii. binPath is the path to the executable
iii. -p 11211: sets the memcached port
iv. –m 800: sets the allocated memory size in megabytes
v. start=auto: sets the windows service to start automatically
vi. DisplayName: the windows service displayname on services.msc
d. The above command creates a memcached instance running on port 11211 with a 800 mb allocation.
e. For 64-bit Windows 2008 Servers, download a copy of the MSVCR71.DLL file (obtainable from here: http://www.dll-files.com/dllindex/dll-files.shtml?msvcr71 or via Google search) and copy it into the C:\Windows\Sys64WOW\ directory. For Windows 2003 Servers, copy it into the \Systems32 directory instead.
f. The memcached service should now start successfully from the Services control panel upon launching it.
g. Stop both the website and – if on 2008 – the App Pool it belongs to, and then modify the website’s web.config file by adding the following:
<enyim.com>
<memcached>
<servers>
<add address="<your site’s IP here>" port="11211" />
<add address="<optional additional IPs if you have them>" port="11211" />
</servers>
<socketPool minPoolSize="10" maxPoolSize="100" connectionTimeout="00:10:00" deadTimeout="00:02:00" />
</memcached>
</enyim.com>
h. Finish by adding the following into the web.config’s <configSections> section:
<sectionGroup name="enyim.com">
<section name="memcached" type="Enyim.Caching.Configuration.MemcachedClientSection, Enyim.Caching" />
</sectionGroup>
i. Restart the App Pool and site services.