Menu

Setting Up Memcached As A Windows Service

Memcached is an in-memory, distributed key-value store for random pieces of application data. It is useful for clustering and distributed caching and it (and similar tools) are becoming an increasingly common feature of large Web-based apps.

I don’t like Windows any more than the next guy when it comes to using it as a Server OS, but sometimes you’ve got no choice – maybe you work in an environment where Windows Server is the only option. *sigh*

Memcached is not something that you would generally install on Windows, (not for production anyhow), but it is possible to have it running happily as a native Windows service.

Here’s how –

  1. Download either the 32-bit or 64-bit Windows builds of Memcached from NorthScale
  2. Unzip the memcached build into a server folder, say “C:memcached”
  3. Run memcached.exe and ensure it starts. You should get a blank console window. Ctrl+C will close it, assuming all is well.
  4. To set it up as a native service we will download the Windows Server 2003 Resource Kit
  5. Install the Windows Resource Kit.
    For clarity I’ll refer to the install location as “C:Program FilesWindows Resource KitsTools”, in reality it may be different. Substitute your install location as needed.
  6. Open a command prompt and change to your resource kit folder e.g. C:Program FilesWindows Resource KitsTools
  7. At the prompt:
    instsrv Memcached "C:Program FilesWindows Resource KitsToolsSRVANY.EXE"
  8. Open Notepad and paste the following into it –
    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesMemcachedParameters]
    "Application"="c:\memcached\memcached.exe"
    "AppParameters"="-m 1024"

    Adjust the path as necessary. You can add (or remove) memcached command line options with the “AppParameters” option.

    The “-m 1024″ creates 1024MB (1 GB) memcache. You can get a list of other options with“memcached -h” or on memcached.org

  9. Save the file as “c:memcachedconfigservice.reg” today24h, thiết kế web nhanh, website giá rẻ, dịch vụ website nhanh, blog, linux, apache, mysql, php, wordpress, drupal, cai dat apache, cài đặt apache, memche, install memcache, install apache, website, thiet ke, thiết kế, theme ,plugin, tao website nhanh, tạo website nhanh, css, html, design, đồ hoa, do hoa, coder, wordpress development
  10. Double click the file in Windows Explorer and merge the settings into the Registry.
    today24h, thiết kế web nhanh, website giá rẻ, dịch vụ website nhanh, blog, linux, apache, mysql, php, wordpress, drupal, cai dat apache, cài đặt apache, memche, install memcache, install apache, website, thiet ke, thiết kế, theme ,plugin, tao website nhanh, tạo website nhanh, css, html, design, đồ hoa, do hoa, coder, wordpress development
  11. Start the service, e.g. “net start Memcached” at the command prompttoday24h, thiết kế web nhanh, website giá rẻ, dịch vụ website nhanh, blog, linux, apache, mysql, php, wordpress, drupal, cai dat apache, cài đặt apache, memche, install memcache, install apache, website, thiet ke, thiết kế, theme ,plugin, tao website nhanh, tạo website nhanh, css, html, design, đồ hoa, do hoa, coder, wordpress development
  12. You’re done!

Also, there is an alternative option – you can use the Java based clone of memcached, (the intuitively/unimaginatively) named jmemcached.

This can be used in conjunction with Java Service Wrapper to create Java-based Windows service which operates like the native memcached.

Facebook Comments