简体   繁体   English

Redis 服务器不能运行超过 1024M 的 maxheap

[英]Redis server can't run more than 1024M maxheap

I am running Redis 2.8.19 on Windows Server 2008. I get an error saying that I have insufficient disc space for my Redis heap.我在 Windows Server 2008 上运行 Redis 2.8.19。我收到一条错误消息,说我的 Redis 堆的磁盘空间不足。 (The memory mapping file instead of fork()). (内存映射文件而不是 fork())。

I can only get Redis running, if I have 'maxheap 1024M' in the cfg, even though I have ~50GB of free space on the directory I have set 'heapdir' to.我只能让Redis运行,如果我在cfg中有'maxheap 1024M',即使我在'heapdir'设置的目录上有~50GB的可用空间。

If I try to run it with higher maxheap, or with no maxheap, I get this error (PowerShell):如果我尝试使用更高的 maxheap 或不使用 maxheap 运行它,我会收到此错误 (PowerShell):

PS C:\\Users\\admasgve> cd D:\\redis-2.8.19 PS C:\\Users\\admasgve> cd D:\\redis-2.8.19

PS D:\\redis-2.8.19> .\\redis-server.exe PS D:\\redis-2.8.19> .\\redis-server.exe

[7476] 25 Feb 09:32:38.419 # The Windows version of Redis allocates a large memory mapped file for sharing the heap with the forked process used in persistence operations. [7476] 2 月 25 日 09:32:38.419 # Redis 的 Windows 版本分配了一个大内存映射文件,用于与持久性操作中使用的分叉进程共享堆。 This file will be created in the current working directory or the directory specified by the 'heapdir' directive in the .conf file.该文件将在当前工作目录或 .conf 文件中的“heapdir”指令指定的目录中创建。 Windows is reporting that there is insufficient disk space available for this file (Windows error 0x70). Windows 报告此文件可用磁盘空间不足(Windows 错误 0x70)。

You may fix this problem by either reducing the size of the Redis heap with the --maxheap flag, or by moving the heap file to a local drive with sufficient space.您可以通过使用 --maxheap 标志减小 Redis 堆的大小或将堆文件移动到具有足够空间的本地驱动器来解决此问题。 Please see the documentation included with the binary distributions for more details on the --maxheap and --heapdir flags.有关 --maxheap 和 --heapdir 标志的更多详细信息,请参阅二进制发行版附带的文档。

Redis can not continue. Redis 无法继续。 Exiting.退出。

Screenshot: http://i.stack.imgur.com/Xae0f.jpg截图: http : //i.stack.imgur.com/Xae0f.jpg

  • Free space on D: 49,4 GB D 上的可用空间:49,4 GB
  • Free space on C: 2,71 GB C 上的可用空间:2,71 GB
  • Total RAM: 16 GB总内存:16 GB
  • Free RAM: ~9 GB可用内存:~9 GB

redis.windows.conf: redis.windows.conf:

# Generated by CONFIG REWRITE
loglevel verbose
logfile "stdout"
save 900 1
save 300 10
save 60 10000
dir "D:\\redis-2.8.19"
maxmemory 1024M
# maxheap 2048M
heapdir "D:\\redis-2.8.19"

Everything beside the last 3 lines are generated by redis with the 'CONFIG REWRITE' cmd.最后 3 行之外的所有内容都是由 redis 使用“CONFIG REWRITE”命令生成的。 I have tried various things, with maxmemory, maxheap and heapdir.我尝试了各种方法,包括 maxmemory、maxheap 和 heapdir。

From Redis documentation:从Redis文档:

maxmemory / maxheap - the maxheap flag controls the maximum size of this memory mapped file, as well as the total usable space for the Redis heap. maxmemory / maxheap - maxheap 标志控制此内存映射文件的最大大小,以及 Redis 堆的总可用空间。 Running Redis without either maxheap or maxmemory will result in a memory mapped file being created that is equal to the size of physical memory;在没有 maxheap 或 maxmemory 的情况下运行 Redis 将导致创建一个与物理内存大小相等的内存映射文件; The Redis heap must be larger than the value specified by the maxmemory Redis 堆必须大于 maxmemory 指定的值

Have anybody encountered this problem before?有没有人遇到过这个问题? What do I do wrong?我做错了什么?

Redis doesn't use the conf file in its home directory by default.默认情况下,Redis 不使用其主目录中的 conf 文件。 You have to pass the file in on the command line:您必须在命令行中传递文件:

.\redis-server.exe redis.windows.conf

This is what is in my conf file:这是我的 conf 文件中的内容:

maxheap 2048M
heapdir D:\\redisheap

These settings resolved my issue.这些设置解决了我的问题。

这是如何使用 maxheap 标志,这比使用配置文件更方便:

redis-server --maxheap 2gb

To back up Michael's response, I've had the same problem.为了支持迈克尔的回答,我遇到了同样的问题。

I had ~40GB of free space, and paging file set to 4G-8G.我有大约 40GB 的可用空间,并且分页文件设置为 4G-8G。 Redis did not want to start until I set paging file to the amount recommended by Windows themselves, which was 12GB. Redis不想启动,直到我将分页文件设置为Windows自己推荐的数量,即12GB。

Really odd beahaviour.真是奇怪的行为。

.\redis-server.exe redis.windows.conf

This is what is in my conf file:这是我的 conf 文件中的内容:

maxheap 2048M

heapdir D:\\redisheap

after passing the above parameters in redis-server.exe redis.windows.conf在 redis-server.exe 中传递以上参数后 redis.windows.conf

the service has started for me thanks for the solution.该服务已为我启动,感谢您的解决方案。

maxheap 2048M最大堆 ​​2048M

heapdir D:\\"location where your server is heapdir D:\\"您的服务器所在的位置

This Should Solve problem Please Ping me if you have Same Question这应该可以解决问题如果你有同样的问题请Ping我

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM