[转]同一台Windows机器中启动多个Memcached服务

时间:2023-12-16 12:04:38

Memcached的安装后,如果手头上只有一台机器,又想做多节点测试咋办?

这就需要在一台机器上启动多个Memcached服务了。

假设Memcached在如下目录:C:\memcached\memcached.exe

在CMD中执行如下命令即可再安装一个Memcached服务(记得换个端口号啊!):

sc create "Memcached Server1" start= auto binPath= "C:\memcached\memcached.exe -d runservice -m 32 -p 11220 -l 127.0.0.1" DisplayName= "Memcached Server1"

下面是启动、停止、卸载该服务的命令:

sc start "Memcached Server1"  //启动
sc stop "Memcached Server1" //停止
sc delete "Memcached Server1" //卸载该服务

如果你在执行命令的时候,遇到如下提示信息:

Creates a service entry in the registry and Service Database.
SYNTAX:
sc create [service name] [binPath= ] <option1> <option2>...
CREATE OPTIONS:
NOTE: The option name includes the equal sign.
type= <own|share|interact|kernel|filesys|rec>
(default = own)
start= <boot|system|auto|demand|disabled>
(default = demand)
error= <normal|severe|critical|ignore>
(default = normal)
binPath= <BinaryPathName>
group= <LoadOrderGroup>
tag= <yes|no>
depend= <Dependencies(separated by / (forward slash))>
obj= <AccountName|ObjectName>
(default = LocalSystem)
DisplayName= <display name>
password= <password>

请好好check下你输入的命令。

Check Point:

sc cretate命令后面带的参数比如[binPath= ]的等号后面必须有个空格,
同样,后面的其它参数比如group= , displayname=的等号后面都需要空格,
否则,sc create命令都不能成功创建服务,只会返回给你帮助信息。