cancel
Showing results for 
Search instead for 
Did you mean: 

Neo4J on Raspberry Pi 4

octsim
Node

Hello,

I am trying to run Neo4J on a Raspberry Pi 4 (no Docker).
Specs: 8GB Raspberry Pi 4B, 8 GB swap file.
I am running Ubuntu Server 20.04.1 LTS, JDK 11 is correctly installed.

The installation went fine, but it appears as if the physical memory is not recognized – at least that is my assumption based on the results of

neo4j-admin memrec

The logs show the following error:

2020-12-03 19:33:15.439+0000 ERROR Invalid memory configuration - exceeds physical memory. Check the configured values for dbms.memory.p>
2020-12-03 19:33:15.465+0000 INFO  Neo4j Server shutdown initiated by request
2020-12-03 19:33:15.465+0000 INFO  Stopped.

Here is the relevant output of memrec:

# Assuming the system is dedicated to running Neo4j and has 0B of memory,
# we recommend a heap size of around -1024k, and a page cache of around 8m,
# and that about 0k is left for the operating system, and the native memory
# needed by Lucene and Netty.
...

# Based on the above, the following memory settings are recommended:
dbms.memory.heap.initial_size=-1024k
dbms.memory.heap.max_size=-1024k
dbms.memory.pagecache.size=8m

Questions: does anyone have experience with setting up Neo4J on a raspberry pi? Is it possible or just not supported?
Any ideas on why the available memory is not recognized (physical memory 8GB, swap file 8 GB)?

Best regards,

Octavio

13 REPLIES 13

Joel
Ninja
Ninja

There is a negative sign in front of the memory value, was that intentional?

octsim
Node

Yes, sorry – this is the output of

neo4j-admin memrec

It appears I should have passed an additional argument (--memory=..) to get a reasonable result from memrec.
I did run it now passing 2g as a parameter (which should be realistic considering there's 8GB physical memory) but the settings lead to the error described above.

I cannot find any reasonable values – this is my current setup (based on memrec for 2g):

dbms.memory.heap.initial_size=512m
dbms.memory.heap.max_size=512m
dbms.memory.pagecache.size=512m

Essentially, what I am looking for is a hint to configure above mentioned dbms memory values.
Starting neo4j with

sudo neo4j start

will always lead to the errors in /var/log/neo4j/neo4j.log as described ("Invalid memory configuration").

Were you able to find settings that work? I have same problem after upgrade of Rasberry Pi OS from kernel 4.19.97 to 5.4.79, neo4j was also upgraded to 4.2.1 and now will not start. I have Raspberry Pi v4 with 8G RAM that ran fine without any special memory settings in /etc/neo4j/neo4j.conf. neo4j-admin memrec also recommended heap.initial_size and heap.max_size=-1024m (yes, negative sign). I have tried lots of options for:
dbms.memory.heap.initial_size=512m
dbms.memory.heap.max_size=512m
dbms.memory.pagecache.size=1g
buy tail -f /var/log/neo4j/neo4j.log always fails with:
ERROR Invalid memory configuration - exceeds physical memory. Check the configured values for dbms.memory.pagecache.size and dbms.memory.heap.max_size

Any help would be appreciated if you figured out how to get Raspberry Pi to work again.

Thanks
--Ken

omerule
Graph Buddy

Good afternoon,
When entering $neo4j-admin memrec on my Intel with Fedora it gives a overview off the available RAM Memory - So I don't have the specify -. As with the Rapsberry Pi 4 8GB Rasberry OS 32bit The Outcome of $neo4j-admin memrec = " # Assuming the system is dedicated to running Neo4j and has 0B of memory etc..."
Neo4j has run on my Raspberry Pi.

So it looks like Neo4j-admin cannot determine the RAM available of the Rasberry Pi 4 (anymore).

On github i created this bugreport:

Yours Kindly ,
Omer

octsim
Node

No, unfortunately I haven't found a way yet to get Neo4J up and running on the Raspberry Pi 4.
I tried using a Docker image (experimental, as ARM64 is not officially supported) but unfortunately cannot get that to work either.
I will update the thread if I find a solution for this.

Thanks, hopefully a solution can be found. A little more information while troubleshooting is that when dbms.memory.heap.initial_size=10m and dbms.memory.heap.max_size=10m are 10m or less, the error from /var/log/neo4j/neo4j.log is "java.lang.OutOfMemoryError thrown from UncaughtExceptionHandler". When over heap is over 10m, the error is "ERROR Invalid memory configuration - exceeds physical memory. Check the configured values for dbms.memory.pagecache.size and dbms.memory.heap.max_size". The heap setting needs to be much greater than 10m, but fails.

I can get past out of physical memory error by purging v4.2.1 and falling back to v4.1.5 or v4.1.1, but now get: "ERROR Failed to start Neo4j on dbms.connector.http.listen_address, a socket address." Changing and disabling dbms.connector settings does not seem to do anything. Still not able to get a version of Neo4j to launch on recent Raspberry Pi kernel 5.4.79. I will next try to see any work arounds for dbms.connector.http.

octsim
Node

I have tried the following approaches to get past this:

  • downgrade to Ubuntu 18.04
  • change to CentOS 7 rpm based installation
  • downgrade to 4.0 and 3.5 Neo4J version

In all, I always receive the same result from neo4j-admin memrec
Unfortunately I am out of ideas on this, the hardware used apparently is incompatible in several constellations.

I also tried a new installation of the latest Raspbian OS (release 2020-12-02) (Kernel 5.4.79) on Raspberry Pi 4 Model B with fresh installation of Neo4j (4.2.1) and still get the same problem. This same Raspberry Pi 4 Model B worked fine with Neo4j on prior Raspbian OS (probably 2020-05-27) (Kernel 4.19) and stopped working after the upgrade, so it looks like something is not compatible with Neo4j memory allocation with newer Kernel.

Neo4j did come up after downgrading both Kernel to 4.19 (Raspian 20-02-13 release) and installing Neo4j v4.1.1. Neo4j v4.1.5 did not work on new Kernel either. I am back up with an older variant Kernel and older variant Neo4j. Something is not compatible between Kernel, Java 11, and Neo4j. One other interesting observation is the need to add (dbms.jvm.additional=-Duser.country=EN -Duser.language=EN -Duser.variant=Traditional_WIN) to neo4j.conf in v4.1.1 and v4.1.5.

SOLVED: Installing Neo4j via tarball (Linux tarball installation - Operations Manual) worked. The Neo4j Debian/Ubuntu instructions recommend tarball installation for recent OS version. Since Raspian/Raspberry Pi OS is based on Debian 10 (Buster), latest Raspberry Pi needs to be installed via tarball. I untarred in /opt with sudo and Neo4j 4.2.2 came up.

omerule
Graph Buddy

Good evening,
There seem to be some regression with OpenJDK determen RAM and when cgroup memory is disabled: 8257746: Regression introduced with JDK-8250984 - memory might be null in some machines by poonampar...
When looking at $ cat /proc/cgroups Memory is not enabled.
In Duckduckgo found this thread: raspberrypi - Raspberry Pi 4 Ubuntu 19.10 cannot enable cgroup memory at boostrap - Ask Ubuntu
After editing /boot/cmdline.txt add at the end of the line:
cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory

Then did a reboot and cat /proc/cgroups memory is enabled. And run the command neo4j-admin memrec gives the available Memory and when I run $ sudo systemctl start neo4j Neo4j starts again.

Hopefully this will help.

Yours kindly Omer

Neo4j database runs fine with Raspberry Pi OS on model 4 8GB, but neo4j-admin memrec and import were failing. memrec reported 8TB RAM and import was failing randomly with large import files (same file importing would fail CharSeeker in different lines). I tried Ubuntu SVR 20.04 LTS 64-bit with cgroup enabled in /boot/cmdline.txt and seems to work great (installed via apt-get, neo4j came right up, neo4j-admin memrec reports correct memory, neo4j-admin import worked for large csv file, and so far, so good). Running on 64-bit Ubuntu OS seems more stable than 32-bit Raspberry Pi OS.

This was exactly what I needed for Ubuntu 20.04, Neo4j 4.2 on a raspberry pi 4. Thanks Omer!