Neo4j server in VirtualBox: Unable to create rrd s

2019-02-27 13:29发布

问题:

I'm trying to run a Neo4j server inside my Virtualbox which is running Ubuntu. The server files and the database are located within my Windows-Host and accessed via a shared folder (vboxsf). Unfortunately I can not easily transfer the data into the virtual machine and run it there directly (due to insufficient free space on the virtual disk. I tried to enlarge it but that didn't work out.)

The database was set up and used by my teammate. Now I want to access the prepared data on my system. (btw, I'm a complete newbie to neo4j) My overall setup (VM instead of a native system) is a bit different and we couldn't figure out, what the actual problem is.

When I try to start the server via the console, I get this:

don@VirtualHAL:~/Data/SharedFolder/DBs/neo4j-community-1.9$ bin/neo4j start
WARNING! You are using an unsupported Java runtime. Please use Oracle(R) Java(TM) Runtime Environment 7.
Starting Neo4j Server...WARNING: not changing user
process [7248]... waiting for server to be ready.............. Failed to start within 120 seconds.
Neo4j Server may have failed to start, please check the logs.

The warning about the java version is propably caused by the fact that I installed Java OpenJDK 7. (My teammate uses the same, without any further problems).

It does not actually take 2 minutes until the 'Failed to start within 120 seconds' message appears.

Of course, I checked the logs:

8/21/13 8:37:12 PM org.neo4j.server.modules.RESTApiModule INFO: Mounted REST API at [/db/data/]
8/21/13 8:37:12 PM org.neo4j.server.modules.ManagementApiModule INFO: Mounted management API at [/db/manage/]
8/21/d13 8:37:12 PM org.neo4j.server.rrd.RrdFactory SEVERE: Unable to open rrd store, attempting to recreate it**
8/21/13 8:37:12 PM org.neo4j.server.rrd.RrdFactory SEVERE: current RRDB is invalid, renamed it to /home/don/Data/SharedFolder/DBs/neo4j-community-1.9/data/rrd-invalid-1377110232712
8/21/13 8:37:12 PM org.neo4j.server.rrd.RrdFactory SEVERE: Unable to create new rrd store
8/21/13 8:37:12 PM org.neo4j.server.CommunityBootstrapper SEVERE: 
java.lang.RuntimeException: java.io.IOException: Invalid argument
    at org.neo4j.server.rrd.RrdFactory.createRrdb(RrdFactory.java:176)
    at org.neo4j.server.rrd.RrdFactory.recreateArchive(RrdFactory.java:204)
    at org.neo4j.server.rrd.RrdFactory.createRrdb(RrdFactory.java:159)

This is the (seemingly) relevant part of the log. Unable to create new rrd store - What could be the cause for this? Searching for any parts of the error message didn't get me any new information so far.

回答1:

Ran into this as well. Neo4j uses an external lib for RRDs - rrd4j. If you look at the source code for it, you'll see that it uses a memory mapped file.

https://github.com/fusesource/rrd4j/blob/rrd4j-2.0.7/src/main/java/org/rrd4j/core/RrdNioBackend.java

I can't find anything on this online, but I'm guessing that the Guest Additions for Virtualbox for mounting shared folders doesn't support memory mapping. I don't think it's an OS thing, but a kernel implementation thing. I'd love to find out if that's the case. My C-fu is not strong, but I'd really like to support this if at all possible.

[edit]

Yep, it's Guest Additions. This ticket: https://www.virtualbox.org/ticket/819 - is 7 years old. There's activity on it for OSX from 2 weeks ago.



回答2:

While writing down the question, I figured out the fairly easy solution:

There is not enough space to get the database (of several GB) into the virtual machine but it was enough to run the neo4j server itself and only access the data via the shared folder.

So, now the server starts as expected when I run it from within Ubuntu:

dustin@VirtualHAL:~/Software/neo4j-community-1.9$ bin/neo4j start
WARNING! You are using an unsupported Java runtime. Please use Oracle(R) Java(TM) Runtime Environment 7.
Starting Neo4j Server...WARNING: not changing user
process [7676]... waiting for server to be ready............. OK.
Go to http://localhost:7474/webadmin/ for administration interface.

Nevertheless, this is maybe not the definite answer to the above question. Can somebody add information about why the server will not start correctly (or cannot setup the rrd store) when it is itself placed in a shared folder?