我能让 Memcached 在 Windows (x64)64位环境下运行吗?

是否有人知道 如果什么时候怎么做我可以让 Memcached运行在 Windows 64位环境?

我正在设置一个新的托管解决方案,并且更喜欢运行一个64位操作系统,因为它是一个 ASP.Net MVC 解决方案和 SQL Server DB,所以这个操作系统要么是 Windows Server 2003,要么(希望如此!)二零零八年。

我知道这可能会引发一场关于服务器上32位和64位的争论,但是让我们只说我的偏好是64位,并且我有一些 非常 很好的原因。

到目前为止,我已经尝试了许多选项,并发现 帮助与在32位机器上安装这个相关(我可能会添加) ,但是由于原来的 窗口是特定于 Win32的,所以在 x64上作为服务安装时,这几乎没有帮助。它还依赖于 Libevent,对此我只能得到一个 Win32编译版本。

我怀疑简单地在 C + + 中加载所有这些,然后点击“编译”(64位)是不行的,尤其是因为32位和64位架构之间的复杂差异,但我想知道是否有人正在努力实现这一点?不幸的是,我的专业知识仅限于托管代码(C #) ,否则我会尝试自己解决这个问题,但我不敢相信我是唯一一个试图让 Memcached在64位 Windows 服务器上运行的人... ... 是吗?


更新

是的,恐怕我仍然在寻找这个问题的答案——我所有的努力(用我可怜的 C + + 技能)使一个稳定的构建失败了——我已经摧毁了一个服务器,而3 VM 只是在尝试它,所以现在我求助于真正的专家。 有人打算把这个移植到64位吗?或者你真的建议我用 MS Velocity 来代替?我一想到这个就不寒而栗。


更新: @ Lars-我确实使用了 Enyim-非常好,但你指的是客户端,而不是服务器部分。

@ DannySmurf-我只能在32位操作系统上安装这个服务。64位操作系统拒绝安装此 Win32服务。当然是的,很多 Win32代码可以在 x64架构上无缝地工作,因此你可以在 Vista/XP 64上运行32位应用程序(比如 Office)或者游戏等等,但是当涉及到服务时,这并不能直接翻译。我不是专家,我怀疑这与服务需要订阅的同步或事件有关,我怀疑64和32不能很好地发挥作用。我很高兴在这些问题上被纠正,但是回答你的问题——是的,我试过了。

@ OJ-非常感谢你直截了当的回复。我也这么想,但不确定是否还有其他人有建议或者已经这么做了。也许当 StackOverflow 是 LIVE 的时候,会有更多的人回应,让我知道这是否是正在研究的东西,尽管我可以尝试自己编译它——我不能简单地“相信”(以我的 C + + 经验水平)它会提供“企业级”的可靠性,在这样一个大型可扩展解决方案的关键组成部分。我认为这需要有教养的干预,而不是我未经净化的实验方法,我才能有信心。我一个小小的疏忽,就能让网站瘫痪。好吧,下次见。

60548 次浏览

Are you sure that the 32-bit version doesn't just run on 64-bit Windows, without modification? Most things do.

Failing that, have you actually tried just compiling it for 64-bit? A brief scan of a few Google Groups etc where people asked this same question suggests that that may be exactly the solution to this. I think you're probably overestimating the difference between 32-bit and 64-bit Windows (at least as far as compiling a native application goes).

I personally feel that you'd have to recompile the application using a 64-bit compiler (obviously on a 64-bit machine) to get the most of Memcached on a 64-bit platform. This may not be an easy task depending on the code. If it was written with 64-bit portability in mind then it could be a simple recompile. If it hasn't, then you could well be up for quite a bit of patching before getting it to build.. and then you'd have to verify that you haven't broken anything!

I don't think you're overestimating the differences between 32 and 64-bit at all. A common mistake is to assume that the job is a simple recompile when in fact it isn't. There are more portability issues than most people realise. Just because the application builds and you end up with a binary, it doesn't mean that the binary is going to behave as it should. Especially when it may interact with other 32-bit code.

Having said that, it might be worth giving it a spin!

Good luck. Cheers!


@Lars: I recommend reading the question before attempting an answer.

@John Sibly & @DannySmurf: given the nature of Memcached and what it aims to achieve, surely you wouldn't want to run a 32-bit version on a 64-bit machine? If you had a 64-bit capable machine it would make sense to run a 64-bit version to make the most of the features of the hardware.

I was just searching for memcached on a 64bit Windows system and found this. So far there isn't any Win64 memcached version. But I just started the memcached.exe with the appropriate commands via cmd and it's just running fine. I'm using Windows Vista 64bit, don't know if there are any differences between Vista and the server versions.

Kindest regards Fleshgrinder

The 32 bit version run on 64 bit via WOW64 but the process is still limited to 2GB,with a 64-bit version you can go beyond that to more than a single machine will have.

North Scale labs have released a build of memcached 1.4.4 for Windows x64:

http://blog.couchbase.com/memcached-windows-64-bit-pre-release-available

http://labs.northscale.com/memcached-packages/

UPDATE: they have recently released Memcached Server - still FREE but enhanced distro with clustering, web-based admin/stats UI etc. (I'm not related to them in any way) Check it out at http://northscale.com/products/memcached.html and download at: http://www.northscale.com/download.php?a=d

UPDATE 2: NorthScale Memcached is no longer available as a standalone download. Now they have made it part of their commercial No-SQL DB offering called Membase. It can be configured to run in Memcached-only mode (i.e. without persistence) and there's a 100% free version too. Check it out here: http://www.membase.org/downloads

UPDATE 3: MemBase has slept with CouchDB and produced a hybrid product offering, called CouchBase. They still do offer a free "Community" version at http://www.couchbase.com/download

FYI, I couldn't get the 64 bit version (from here http://labs.northscale.com/memcached-packages/) to install as a service until I ran memcached as administrator.

I just went to the executable's properties, then the Compatibility tab, and checked "Run this program as an administrator" (There a ton of other ways to do this, but it seemed simplest)

Then I was finally able to successfully run: memcached -d install

Don't forget to start the service after it is installed too :)

I have an memcached-1.2.1 for win32 originally downloaded from here: http://jehiah.cz/projects/memcached-win32/ (but now for some reason it is a broken link).

This is how I managed to run memcached for Win32 on Windows Server 2008 R2, 64 bit. memcached.exe -> properties -> Compatibility -> Run this program in compatibility mode for: Windows XP (SP 3). Notice that the user Uriel Katz mention in this discussion that this method restricted to 2GB memory of use.

You could always run multiple instances of 32-bit memcached processes on one box, allowing that machine to serve a total of > 2GB memcache space.

Just so people know, the 32-bit and 64-bit version as build by the good people from membase/couchbase/whatever is still available the blog URL has changed though:

32-bit binary of memcached 1.4.4 as Windows-service:

http://blog.couchbase.com/memcached-144-windows-32-bit-binary-now-available

http://s3.amazonaws.com/downloads.northscale.com/memcached-win32-1.4.4-14.zip

64-bit binary of memcached 1.4.4 as Windows-service:

http://blog.couchbase.com/memcached-windows-64-bit-pre-release-available

http://s3.amazonaws.com/downloads.northscale.com/memcached-win64-1.4.4-14.zip

The 64-bit version does have the wrong uptime.

So maybe you want this binary of 1.4.2 instead:

http://www.urielkatz.com/archive/detail/memcached-64-bit-windows/

The 32-bit version as included with MemCacheDManager also suppors running on Windows 2000 (no IPv6):

http://allegiance.chi-town.com/MemCacheDManager.aspx http://allegiance.chi-town.com/Download.aspx?dl=Releases/MemCacheDManager_1_0_3_0.msi&rurl=MemCacheDManager.aspx

To unpack the msi:

msiexec /a Releases_MemCacheDManager_1_0_3_0.msi /qb TARGETDIR=c:\memcached

Memcached 1.4.5 binary for win x64 can be found here: http://downloads.northscale.com/memcached-1.4.5-amd64.zip

Another option would be to install Couchbase Server 1.8.0 x64 from here: http://www.couchbase.com/download, the bundled memcached seems to be version 1.7.1.1 (sounds like an internal version, I can't tell which is the real one)

As for running memcached as a service, this tutorial might be enough:

http://www.richardnichols.net/2010/08/install-memcached-on-windows-server/

Up-to-date Binaries

NorthScale has really old versions (the newest is 1.4.5 which is from April 2010) but there's a guy who offers 64-bit Memcached binaries for Windows compiled using Cygwin (but they don't require it installed) in his GitHub repository github.com/nono303/memcached.

For example, the binaries of the most recently released version (as of writing this answer) 1.5.16 are here. There're both 32 and 64-bit versions.

Memcached as a Windows Service

If you want to install it as a Windows service, you can use for example the open-source Non-Sucking Service Manager:

nssm install memcached c:\path\to\memcached.exe
nssm start memcached

See the documentation for details.