在Windows中创建memcached服务失败

时间:2012-11-13 09:18:34

标签: windows-services memcached

我正在使用Memcached-for-Windows,请参阅:

http://blog.elijaa.org/index.php?post/2010/08/25/Memcached-1.4.5-for-Windows&similar

我试过用:

sc create "memcached" binPath="C:/memcached/mem
cached.exe" start=auto

但我无法创建Windows服务,也没有警告或错误,只是:

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>

5 个答案:

答案 0 :(得分:6)

要实现这一点,您甚至可以执行命令行,该命令行将创建一个服务。 首先通过命令行转到.exe文件所在的路径。

C:\Users\sireesh.yarlagadda>memcached.exe -d install

执行此行后,您将看到为memcached创建的新服务

答案 1 :(得分:1)

您收到错误的原因是binPath =后必须有空格。这是sc的一个非常烦人的“特征”。在开始之后你也需要一个空格=。

sc create "memcached" binPath= "C:/memcached/memcached.exe" start= auto

上面的命令不会给你语法错误。但是,我怀疑memcached仍然无法成功运行。

答案 2 :(得分:0)

memcached不是本机Windows服务,因此您必须使用“服务包装”程序来添加缺少的功能。 Microsoft's free Srvany utility应该做到这一点,但也可以使用几种商业替代品。

(请注意,memcached的某些Windows端口支持“-d”标志,以自动安装和操作memcached作为本机Windows服务,但在NorthScale的版本中似乎不可用...)

答案 3 :(得分:0)

答案 4 :(得分:0)

根据此页面上的信息:

Installing Memcached on Windows

1.4.5或更高版本无法作为服务安装。它必须作为Windows任务安装。考虑到应用程序的两个实例,为所有用户执行此操作的说明:

创建成员任务

SCHTASKS /create /sc onstart /ru system /tn memcached1 /tr "C:\Xampp\memcached\memcached.exe -m80 -p11211"
SCHTASKS /create /sc onstart /ru system /tn memcached2 /tr "C:\Xampp\memcached\memcached.exe -m80 -p11212"

上述任务将在重启时运行,但如果您想在创建后立即运行它们,则可以执行以下命令:

RUN MEMCACHED TASKS

SCHTASKS /run /tn memcached1
SCHTASKS /run /tn memcached2

停止累计任务

SCHTASKS /end /tn memcached1
SCHTASKS /end /tn memcached2

要删除创建的任务,请执行以下操作:

删除已成功的任务

SCHTASKS /delete /tn memcached1 /f
SCHTASKS /delete /tn memcached2 /f