How to create new database and use the existing database in neo4j in ubuntu?

8,292 views
Skip to first unread message

Rio Eduardo

unread,
Dec 11, 2013, 8:48:17 AM12/11/13
to ne...@googlegroups.com
How to create new database in neo4j in ubuntu? and How to use the existing database in neo4j in ubuntu?

thank you.

Abhishek Gupta

unread,
Dec 13, 2013, 12:55:29 AM12/13/13
to ne...@googlegroups.com
On Wednesday, 11 December 2013 19:18:17 UTC+5:30, Rio Eduardo wrote:
How to create new database in neo4j in ubuntu?

 
and How to use the existing database in neo4j in ubuntu?

Rio Eduardo

unread,
Dec 17, 2013, 8:33:46 AM12/17/13
to ne...@googlegroups.com

No, not in Java Gupta, I meant the folder that named graph.db. Because in windows, we can simply make it, when we start the neo4j, before neo4j is started, neo4j asks us which database we will use, the existing or the new one. Nah, how can we make it in Ubuntu? :) Thank you

JDS

unread,
Dec 17, 2013, 8:54:34 AM12/17/13
to ne...@googlegroups.com
If I understand you correctly you're trying to run multiple instances of the standalone database using ./bin/neo4j start|console. IMHO it would be easier if you're planning to run multiple standalone databases that you just have multiple paths to neo4j with the entire root structure and just change the ports of the admin consoles (as well as jmx, remote console, ha, and online backup server if any of these are used).

However, you might be able to start another instance by tweaking the following properties.

See the properties:
# conf/neo4j-server.properties
org.neo4j.server.database.location=data/graph.db

# conf/neo4j-wrapper.conf
wrapper.pidfile=../data/neo4j-server.pid
wrapper.lockfile=../data/neo4j-server.lck

JDS

unread,
Dec 17, 2013, 8:56:11 AM12/17/13
to ne...@googlegroups.com
Alternatively if you're not using both db's at the same time, you can simply move the folder out of the way and run neo4j start again and it will create the db.

Rio Eduardo

unread,
Dec 17, 2013, 10:26:07 AM12/17/13
to ne...@googlegroups.com
do you mean just replace data/graph.db with data/another_graph.db?

David Przybilla

unread,
Dec 17, 2013, 10:42:29 AM12/17/13
to ne...@googlegroups.com
Hi Eduardo,

it is as simple as copying and pasting the graph.db folder.
Message has been deleted

Rio Eduardo

unread,
Dec 17, 2013, 10:56:59 AM12/17/13
to ne...@googlegroups.com
I already did it, but it says Neo4j Server may have failed to start, please check the logs. so any solutions?

Lasse Westh-Nielsen

unread,
Dec 17, 2013, 11:01:08 AM12/17/13
to ne...@googlegroups.com

> On 17/12/2013, at 16.56, Rio Eduardo <rioedu...@gmail.com> wrote:
>
> [...] it says Neo4j Server may have failed to start, please check the logs [...]

So, what does the log say? :)

Start with $NEO4J_HOME/data/log/console.log

Rio Eduardo

unread,
Dec 17, 2013, 11:14:48 AM12/17/13
to ne...@googlegroups.com
the log says:

2013-12-17 16:12:25.555+0000 DEBUG [API] You are using an unsupported version of the Java runtime. Please use Oracle(R) Java(TM) Runtime Environment 7.
2013-12-17 16:12:25.776+0000 INFO  [API] Setting startup timeout to: 120000ms based on -1
23:12:25.917 [main] WARN  o.neo4j.kernel.EmbeddedGraphDatabase - You are using an unsupported version of the Java runtime. Please use Oracle(R) Java(TM) Runtime Environment 7.
2013-12-17 16:12:27.006+0000 INFO  [API] Successfully started database
2013-12-17 16:12:27.453+0000 INFO  [API] Starting HTTP on port :7474 with 40 threads available
2013-12-17 16:12:27.707+0000 INFO  [API] Enabling HTTPS on port :7473
2013-12-17 16:12:27.833+0000 INFO  [API] Mounted discovery module at [/]
2013-12-17 16:12:27.849+0000 INFO  [API] Mounted REST API at [/db/data/]
2013-12-17 16:12:27.854+0000 INFO  [API] Mounted management API at [/db/manage/]
2013-12-17 16:12:27.855+0000 INFO  [API] Mounted webadmin at [/webadmin]
2013-12-17 16:12:27.856+0000 INFO  [API] Mounted Neo4j Browser at [/browser]
2013-12-17 16:12:27.934+0000 INFO  [API] Mounting static content at [/webadmin] from [webadmin-html]
2013-12-17 16:12:28.003+0000 INFO  [API] Mounting static content at [/browser] from [browser]
23:12:28.004 [main] WARN  o.e.j.server.handler.ContextHandler - o.e.j.s.ServletContextHandler@88b5c5{/,null,null} contextPath ends with /
23:12:28.005 [main] WARN  o.e.j.server.handler.ContextHandler - Empty contextPath
23:12:28.008 [main] INFO  org.eclipse.jetty.server.Server - jetty-9.0.5.v20130815
23:12:28.057 [main] INFO  o.e.j.server.handler.ContextHandler - Started o.e.j.s.h.MovedContextHandler@16e8f77{/,null,AVAILABLE}
23:12:28.206 [main] INFO  o.e.j.w.StandardDescriptorProcessor - NO JSP Support for /webadmin, did not find org.apache.jasper.servlet.JspServlet
23:12:28.233 [main] INFO  o.e.j.server.handler.ContextHandler - Started o.e.j.w.WebAppContext@5c13de{/webadmin,jar:file:/home/rioeduardo/Downloads/neo4j-community-2.0.0/system/lib/neo4j-server-2.0.0-static-web.jar!/webadmin-html,AVAILABLE}
23:12:28.796 [main] INFO  o.e.j.server.handler.ContextHandler - Started o.e.j.s.ServletContextHandler@16c548f{/db/manage,null,AVAILABLE}
23:12:29.056 [main] INFO  o.e.j.server.handler.ContextHandler - Started o.e.j.s.ServletContextHandler@1cc93{/db/data,null,AVAILABLE}
23:12:29.079 [main] INFO  o.e.j.w.StandardDescriptorProcessor - NO JSP Support for /browser, did not find org.apache.jasper.servlet.JspServlet
23:12:29.082 [main] INFO  o.e.j.server.handler.ContextHandler - Started o.e.j.w.WebAppContext@1bfbf84{/browser,jar:file:/home/rioeduardo/Downloads/neo4j-community-2.0.0/system/lib/neo4j-browser-2.0.0.jar!/browser,AVAILABLE}
23:12:29.241 [main] INFO  o.e.j.server.handler.ContextHandler - Started o.e.j.s.ServletContextHandler@88b5c5{/,null,AVAILABLE}
23:12:29.269 [main] INFO  o.e.jetty.server.ServerConnector - Started ServerConnector@fca387{HTTP/1.1}{localhost:7474}
23:12:29.492 [main] INFO  o.e.jetty.server.ServerConnector - Started ServerConnector@101f6af{SSL-HTTP/1.1}{localhost:7473}
2013-12-17 16:12:29.494+0000 INFO  [API] Remote interface ready and available at [http://localhost:7474/]
23:13:56.363 [Thread-17] INFO  o.e.jetty.server.ServerConnector - Stopped ServerConnector@fca387{HTTP/1.1}{localhost:7474}
23:13:56.365 [Thread-17] INFO  o.e.jetty.server.ServerConnector - Stopped ServerConnector@101f6af{SSL-HTTP/1.1}{localhost:7473}
23:13:56.367 [Thread-17] INFO  o.e.j.server.handler.ContextHandler - Stopped o.e.j.s.ServletContextHandler@88b5c5{/,null,UNAVAILABLE}
23:13:56.371 [Thread-17] INFO  o.e.j.server.handler.ContextHandler - Stopped o.e.j.w.WebAppContext@1bfbf84{/browser,jar:file:/home/rioeduardo/Downloads/neo4j-community-2.0.0/system/lib/neo4j-browser-2.0.0.jar!/browser,UNAVAILABLE}
23:13:56.372 [Thread-17] INFO  o.e.j.server.handler.ContextHandler - Stopped o.e.j.s.ServletContextHandler@1cc93{/db/data,null,UNAVAILABLE}
23:13:56.373 [Thread-17] INFO  o.e.j.server.handler.ContextHandler - Stopped o.e.j.s.ServletContextHandler@16c548f{/db/manage,null,UNAVAILABLE}
23:13:56.375 [Thread-17] INFO  o.e.j.server.handler.ContextHandler - Stopped o.e.j.w.WebAppContext@5c13de{/webadmin,jar:file:/home/rioeduardo/Downloads/neo4j-community-2.0.0/system/lib/neo4j-server-2.0.0-static-web.jar!/webadmin-html,UNAVAILABLE}
23:13:56.375 [Thread-17] INFO  o.e.j.server.handler.ContextHandler - Stopped o.e.j.s.h.MovedContextHandler@16e8f77{/,null,UNAVAILABLE}
2013-12-17 16:13:59.369+0000 DEBUG [API] You are using an unsupported version of the Java runtime. Please use Oracle(R) Java(TM) Runtime Environment 7.
2013-12-17 16:13:59.610+0000 INFO  [API] Setting startup timeout to: 120000ms based on -1
Detected incorrectly shut down database, performing recovery..
23:13:59.750 [main] WARN  o.neo4j.kernel.EmbeddedGraphDatabase - You are using an unsupported version of the Java runtime. Please use Oracle(R) Java(TM) Runtime Environment 7.
2013-12-17 16:14:00.328+0000 DEBUG [API]
org.neo4j.server.ServerStartupException: Starting Neo4j Server failed: Error starting org.neo4j.kernel.EmbeddedGraphDatabase, /home/rioeduardo/Downloads/neo4j-community-2.0.0/data/php.graphdb
    at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:209) ~[neo4j-server-2.0.0.jar:2.0.0]
    at org.neo4j.server.Bootstrapper.start(Bootstrapper.java:87) ~[neo4j-server-2.0.0.jar:2.0.0]
    at org.neo4j.server.Bootstrapper.main(Bootstrapper.java:50) ~[neo4j-server-2.0.0.jar:2.0.0]
Caused by: java.lang.RuntimeException: Error starting org.neo4j.kernel.EmbeddedGraphDatabase, /home/rioeduardo/Downloads/neo4j-community-2.0.0/data/php.graphdb
    at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:333) ~[neo4j-kernel-2.0.0.jar:2.0.0]
    at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:63) ~[neo4j-kernel-2.0.0.jar:2.0.0]
    at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:92) ~[neo4j-kernel-2.0.0.jar:2.0.0]
    at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:198) ~[neo4j-kernel-2.0.0.jar:2.0.0]
    at org.neo4j.kernel.impl.recovery.StoreRecoverer.recover(StoreRecoverer.java:115) ~[neo4j-kernel-2.0.0.jar:2.0.0]
    at org.neo4j.server.preflight.PerformRecoveryIfNecessary.run(PerformRecoveryIfNecessary.java:59) ~[neo4j-server-2.0.0.jar:2.0.0]
    at org.neo4j.server.preflight.PreFlightTasks.run(PreFlightTasks.java:70) ~[neo4j-server-2.0.0.jar:2.0.0]
    at org.neo4j.server.AbstractNeoServer.runPreflightTasks(AbstractNeoServer.java:319) ~[neo4j-server-2.0.0.jar:2.0.0]
    at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:144) ~[neo4j-server-2.0.0.jar:2.0.0]
    ... 2 common frames omitted
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.StoreLockerLifecycleAdapter@2c3d18' was successfully initialized, but failed to start. Please see attached cause exception.
    at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:504) ~[neo4j-kernel-2.0.0.jar:2.0.0]
    at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:115) ~[neo4j-kernel-2.0.0.jar:2.0.0]
    at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:310) ~[neo4j-kernel-2.0.0.jar:2.0.0]
    ... 10 common frames omitted
Caused by: org.neo4j.kernel.StoreLockException: Unable to obtain lock on store lock file: /home/rioeduardo/Downloads/neo4j-community-2.0.0/data/php.graphdb/store_lock. Please ensure no other process is using this database, and that the directory is writable (required even for read-only access)
    at org.neo4j.kernel.StoreLocker.checkLock(StoreLocker.java:87) ~[neo4j-kernel-2.0.0.jar:2.0.0]
    at org.neo4j.kernel.StoreLockerLifecycleAdapter.start(StoreLockerLifecycleAdapter.java:44) ~[neo4j-kernel-2.0.0.jar:2.0.0]
    at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:498) ~[neo4j-kernel-2.0.0.jar:2.0.0]
    ... 12 common frames omitted
Caused by: java.io.FileNotFoundException: /home/rioeduardo/Downloads/neo4j-community-2.0.0/data/php.graphdb/store_lock (Permission denied)
    at java.io.RandomAccessFile.open(Native Method) ~[na:1.8.0-ea]
    at java.io.RandomAccessFile.<init>(RandomAccessFile.java:236) ~[na:1.8.0-ea]
    at org.neo4j.kernel.DefaultFileSystemAbstraction.open(DefaultFileSystemAbstraction.java:59) ~[neo4j-kernel-2.0.0.jar:2.0.0]
    at org.neo4j.kernel.StoreLocker.checkLock(StoreLocker.java:73) ~[neo4j-kernel-2.0.0.jar:2.0.0]
    ... 14 common frames omitted
2013-12-17 16:14:00.330+0000 DEBUG [API] Failed to start Neo Server on port [7474]

Lasse Westh-Nielsen

unread,
Dec 17, 2013, 11:27:50 AM12/17/13
to ne...@googlegroups.com


> On 17/12/2013, at 17.14, Rio Eduardo <rioedu...@gmail.com> wrote:
>
> the log says:
>
> [...] Caused by: java.io.FileNotFoundException: /home/rioeduardo/Downloads/neo4j-community-2.0.0/data/php.graphdb/store_lock (Permission denied) [...]

I think that is your culprit right there.

Rio Eduardo

unread,
Dec 17, 2013, 12:27:45 PM12/17/13
to ne...@googlegroups.com
so what should I do? I have no ideas. Thank you.

Michael Hunger

unread,
Dec 17, 2013, 4:13:28 PM12/17/13
to ne...@googlegroups.com
You have probably several users, at least one for root and one for neo

change the permissions on the graphd.db directory so that it belongs to the neo user

chown -R neo:neo ..../data/graph.db

Michael

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Rio Eduardo

unread,
Dec 18, 2013, 7:40:54 PM12/18/13
to ne...@googlegroups.com
isn't chown for a permission? why should i give the graph.db folder a permission? the folder I want to use is not graph.db but my other db such as my.graphdb and php.graphdb.
and it's weird because of the name of the db. the name is my.graphdb, why not my.db, is it because extension graphdb for windows and db for linux?

actually the problem is how to use my neo4j db(my.graphdb and php.graphdb) that i made in windows in linux?

Thank you.

Michael Hunger

unread,
Dec 19, 2013, 3:04:51 AM12/19/13
to ne...@googlegroups.com
Please read up about unix permissions at an appropriate place.

Yes chown is for access permissions and "graph.db" was just an example name.

You have to configure your neo4j server in conf/neo4j-server.properties to point to the correct directory containing your graph database store files.
And that directory and all files and folders below it have to be readable and writable for the user running neo4j. Whichever that is on your system, by default the user is called "neo4j"

HTH

Mcihael

Rio Eduardo

unread,
Dec 27, 2013, 9:26:54 AM12/27/13
to ne...@googlegroups.com
I already followed your instruction -> chown -R neo:neo ..../data/my.graphdb
but it said chown: invalid user: ‘neo:neo’

so what should I do? please help.

Thanks.

Michael Hunger

unread,
Dec 27, 2013, 11:16:50 AM12/27/13
to ne...@googlegroups.com
Try the default user:group that gets created

And as I said read about unix file permissions or get someone local who can explain it to you and help you directly

chown -R neo4j:neo4j ..../data/my.graphdb

Sent from mobile device

Rio Eduardo

unread,
Dec 27, 2013, 11:29:50 PM12/27/13
to ne...@googlegroups.com
Thank you so much Michael Hunger, it works! :)

Rio Eduardo

unread,
Dec 28, 2013, 9:57:00 AM12/28/13
to ne...@googlegroups.com
Hey Michael, after I use my old graph db(my.graphdb), why I can't see my graph that I already made before? when I run "match n return n", it displays nothing.

do you know why?

thank you.
Reply all
Reply to author
Forward
0 new messages