neo4j版本:4
系统版本:winserver2012
起因是在运行neo4j代码时显示
Failed to invoke procedure apoc.periodic.iterate: Caused by: java.lang.IllegalStateException: Procedure was blocked since minimum estimated memory (22 GiB) exceeds current free memory (16292 MiB). Note: there are 1 graphs currently loaded into memory
很明显是内存不足的问题,然后修改neo4j.conf文件中的配置增加程序可用的内存
dbms.memory.heap.initial_size=24400m
dbms.memory.heap.max_size=24400m
但是发现重启数据库并没有解决问题,不管我怎么修改配置,报错信息里面显示的空闲内存一直是16292MiB,也就是修改配置文件没有生效,接着发现debug.log日志文件显示
The max heap memory has not been configured. It is recommended that it is always explicitly configured, to ensure the system has a balanced configuration. Until then, a JVM computed heuristic of 17083400192 bytes is used instead. If you are running neo4j server, you need to configure dbms.memory.heap.max_size in neo4j.conf. If you are running neo4j embedded, you have to launch the JVM with -Xmx set to a value. You can run neo4j-admin memrec for memory configuration suggestions. 2024-10-29 02:57:20.011+0000 WARN [o.n.k.i.JvmChecker]
The initial heap memory has not been configured. It is recommended that it is always explicitly configured, to ensure the system has a balanced configuration. Until then, a JVM computed heuristic of 1069547520 bytes is used instead. If you are running neo4j server, you need to configure dbms.memory.heap.initial_size in neo4j.conf. If you are running neo4j embedded, you have to launch the JVM with -Xms set to a value. You can run neo4j-admin memrec for memory configuration suggestions.
他说我的最大堆空间和初始堆空间都没有设置,(我明明在配置文件里配置了哇)找了几个小时没有发现问题在哪,这个时候感觉可能是版本问题,所以使用这个命令
Get-WmiObject -Class Win32_Service -Filter "Name='neo4j'" | ForEach-Object { $_.Delete() }
卸载掉neo4j服务,修改版本5的配置文件,安装版本5的服务
cd D:\neo4j\neo4j-community-5.24.2\bin
.\neo4j install-service
然后突然发现它显示
Use JVM Max Memory of 25G
Neo4j service installed.
也就是说之前修改内存配置重启数据库是没用的,它需要卸载服务,然后再重新安装 !
实测 ubuntu只需要重启数据库就行了,linux也没有service