Problem
Sometimes we need to install a second memcached server instance in the same machine (e.g. a developer working in two projects locally and both use memcached).
If we need to install memcached as a service we execute something like this command:
c:/path/to/exe/memcached.exe -d install
The problem is that we can't run it twice because we will get the following error
So, we got a couple of options:
Solution 1: Initialize a second instance of memcached server in a different port using de command prompt
the issue whit this approach is if we close the cmd we will stop the new memcached instance..
Solution 2: Run the second memcached server instance as a windows service
sc create [service_name] binpath= "[path to .exe and its parameters]"
First, open de cmd with admin rights which can be done with one of this ways
So we will get something like:
sc create Second_Memached binpath= "C:\memcached-win32-1.4.4-14\memcached.exe -p 11212 -d runservice"
NOTE: binpath=[blank space here]"c:\path\to\exe\memcached.exe -p 11212 -d runservice"
NOTE: binpath= "c:\path\to\exe\memcached.exe -p 11212 -d runservice" the quotes surround the memcached command and its parameters
NOTE: you will need admin privileges to excecute this command
The result will be something like this message