在Windows上作为服务运行Redis

14

我已经遵循了所有我能找到的建议。
我正在运行在Windows 2008上的Redis当前版本。 我可以在命令行中运行fin。 我可以安装服务,但它无法运行。

我执行以下命令以安装服务: redis-server --service-install redis.windows.conf 并且得到“redis成功安装为服务”。

然后我尝试启动服务: redis-server --service-start redis.windows.conf --loglevel verbose 并且得到“Redis服务启动失败”。

我已确保安装了.NET框架4.5.2,我已经关闭了防火墙,并尝试过调整文件夹的安全性。

大家有什么想法吗?

(祝大家圣诞快乐)

3个回答

15

从命令行启动redis服务器而不是作为服务,它会显示更有用的错误信息。如果您只是使用默认配置,则最可能是maxmemory / maxheap配置的问题。

C:\redis>redis-server.exe redis.windows.conf
[1576] 04 Feb 10:32:54.172 #
The Windows version of Redis allocates a memory mapped heap for sharing with
the forked process used for persistence operations. In order to share this
memory, Windows allocates from the system paging file a portion equal to the
size of the Redis heap. At this time there is insufficient contiguous free
space available in the system paging file for this operation (Windows error
0x5AF). To work around this you may either increase the size of the system
paging file, or decrease the size of the Redis heap with the --maxheap flag.
Sometimes a reboot will defragment the system paging file sufficiently for
this operation to complete successfully.

Please see the documentation included with the binary distributions for more
details on the --maxheap flag.

Redis can not continue. Exiting.

在我的情况下,Windows服务无法启动,我尝试了这个方法,它告诉我最大堆大小大于我驱动器上的可用空间,并建议我降低该值或将堆移到更多空间的驱动器。 - Rush Frisby
2
你是怎么做到的?在我的情况下,我已经将我的最大堆和最大内存大小更改为256 MB,但仍然遇到这个错误?请务必回复。 - Sudhanshu Gaur

9

在我的情况下,默认的命令行配置未启用日志记录,而服务配置已启用。但没有地方抱怨这一点。 尝试创建目录./Logs。


没错,就是这样! - Jamol

2

虽然这是一个旧问题,但我在尝试使用Redis-x64-2.8.2101的二进制文件安装Win7x64时遇到了它。虽然我尝试了各种选项,但仍无法启动它,使用配置文件运行时未给出有意义的错误,本地运行时只给出一个貌似无关的磁盘空间错误。

在Github上有相关问题,此处提供链接以供参考:https://github.com/MSOpenTech/redis/issues/267


1
我想我遇到了同样的问题。我将maxheap和maxmemory都设置为1024,但仍然出现了Neil答案中提到的错误。 :( - jinglesthula
@Daniel 有解决方案了吗?我刚刚也做了同样的事情,但仍然得到相同的错误信息。 - Sudhanshu Gaur
@SudhanshuGaur,看起来Daniel提到的问题在2.8.2103版本中已经修复了,所以如果你使用的是最新版本,就不应该有这个问题了。 在上面的问题中,有一个参考链接https://github.com/MSOpenTech/redis/issues/335,可能是你遇到的问题。如果你还没有这样做,请尝试从管理员命令提示符启动服务,看看是否可以解决问题。 - Neil
1
顺便说一句,非常感谢您的回复。我已经通过分配最大堆大小来解决我的问题。这是命令:redis-server redis.windows.conf --maxheap 1gb。 - Sudhanshu Gaur
很高兴你找到了解决方案 :) - Chaffelson

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接