Re: [Neo4j] embedded database means it cannot be simultaneously used by multiple processes?
I think this raises an important point: so it looks like, HA is better than using neo4j server then , but I thought they were both using the same way to access data, via URI and weird messy stuff :) You can use HA whether you embed Neo4j in your process or whether it's embedded within the server process. That is, HA is a completely orthogonal issue to whether you run neo4j as a network daemon (server) or host it in your application. You can have HA either way. Jim ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
[Neo4j] embedded database means it cannot be simultaneously used by multiple processes?
When trying to use the same database (or path) from two different java programs, the second one cannot open it. Is this normal ? Can't two or more java programs work on the same (embedded)database ? I used BerkeleyDB (java edition) before, and this was possible, hence why I was expecting this with neo4j too. (me sad :P) Then if so, what would be the workaround? not using embedded db ? using neo4j server instead? (didn't read about that yet) Exception in thread main org.neo4j.graphdb.TransactionFailureException: Could not create data source [nioneodb], see nested exception for cause of error at org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:153) at org.neo4j.kernel.GraphDbInstance.start(GraphDbInstance.java:111) at org.neo4j.kernel.EmbeddedGraphDbImpl.init(EmbeddedGraphDbImpl.java:189) at org.neo4j.kernel.EmbeddedGraphDatabase.init(EmbeddedGraphDatabase.java:86) at org.neo4j.kernel.EmbeddedGraphDatabase.init(EmbeddedGraphDatabase.java:63) at org.neo4j.examples.CalculateShortestPath.main(CalculateShortestPath.java:53) Caused by: java.lang.IllegalStateException: Unable to lock store [neo4j-shortest-path\neostore], this is usually a result of some other Neo4j kernel running usi ng the same store. at org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore.checkStorage(CommonAbstractStore.java:266) at org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore.init(CommonAbstractStore.java:169) at org.neo4j.kernel.impl.nioneo.store.AbstractStore.init(AbstractStore.java:120) at org.neo4j.kernel.impl.nioneo.store.NeoStore.init(NeoStore.java:65) at org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource.init(NeoStoreXaDataSource.java:134) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at org.neo4j.kernel.impl.transaction.XaDataSourceManager.create(XaDataSourceManager.java:76) at org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:147) ... 5 more ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] embedded database means it cannot be simultaneously used by multiple processes?
Hi Cyuczi, You can't open the same database twice in two programs. If you want data to be replicated between Neo4j instances, look into HA: http://docs.neo4j.org/chunked/stable/ha-how.html http://wiki.neo4j.org/content/High_Availability_Cluster Jim ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] embedded database means it cannot be simultaneously used by multiple processes?
I took a quick glance, though it seems they are duplicating(replicating?) the database, but I was hoping I could use only one database (instead of having multiple copies of it, though this would be good in the future of course). With this in mind, what should I look for? maybe neo4j server ? that is only one server using only one database, and have my clients be the different processes (java programs) that would talk to the server via (as I understand it) REST api ? I will look at this for now: http://wiki.neo4j.org/content/Getting_Started_With_Neo4j_Server Thank you, I will come back to HA later when I read/understand more about neo4j and stuff :) On Thu, Jul 21, 2011 at 5:31 AM, Jim Webber j...@neotechnology.com wrote: Hi Cyuczi, You can't open the same database twice in two programs. If you want data to be replicated between Neo4j instances, look into HA: http://docs.neo4j.org/chunked/stable/ha-how.html http://wiki.neo4j.org/content/High_Availability_Cluster Jim ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] embedded database means it cannot be simultaneously used by multiple processes?
I you want to have a read-only-snapshot view of the database you can also use new EmbeddedReadOnlyGraphDatabase(path); Cheers Michael Am 21.07.2011 um 05:31 schrieb Jim Webber: Hi Cyuczi, You can't open the same database twice in two programs. If you want data to be replicated between Neo4j instances, look into HA: http://docs.neo4j.org/chunked/stable/ha-how.html http://wiki.neo4j.org/content/High_Availability_Cluster Jim ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] embedded database means it cannot be simultaneously used by multiple processes?
Thanks Michael, that is good to know... I would've tried that right now, for tests, but unfortunately I get that silly error No index provider 'lucene' found, but only when using EmbeddedReadOnlyGraphDatabase, not EmbeddedGraphDatabase. Perhaps it would be worth mentioning that in order to not get the error for EmbeddedGraphDatabase, I had to add the folder .\lucene-index\src\main\resources\ to classpath, since I am not using any .jars, instead I'm using the source files directly from github (in eclipse) regarding my topic, I am reading this currently: http://wiki.neo4j.org/content/Using_the_Neo4j_Server_with_Java but it seems a bit messy, so I will probably limit myself to using embedded database for now :) On Thu, Jul 21, 2011 at 5:44 AM, Michael Hunger michael.hun...@neotechnology.com wrote: If you want to have a read-only-snapshot view of the database you can also use new EmbeddedReadOnlyGraphDatabase(path); Cheers Michael Am 21.07.2011 um 05:31 schrieb Jim Webber: Hi Cyuczi, You can't open the same database twice in two programs. If you want data to be replicated between Neo4j instances, look into HA: http://docs.neo4j.org/chunked/stable/ha-how.html http://wiki.neo4j.org/content/High_Availability_Cluster Jim ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] embedded database means it cannot be simultaneously used by multiple processes?
Probably you have to add that for the other project too ? Am 21.07.2011 um 05:57 schrieb cyuczi eekc: Thanks Michael, that is good to know... I would've tried that right now, for tests, but unfortunately I get that silly error No index provider 'lucene' found, but only when using EmbeddedReadOnlyGraphDatabase, not EmbeddedGraphDatabase. Perhaps it would be worth mentioning that in order to not get the error for EmbeddedGraphDatabase, I had to add the folder .\lucene-index\src\main\resources\ to classpath, since I am not using any .jars, instead I'm using the source files directly from github (in eclipse) regarding my topic, I am reading this currently: http://wiki.neo4j.org/content/Using_the_Neo4j_Server_with_Java but it seems a bit messy, so I will probably limit myself to using embedded database for now :) On Thu, Jul 21, 2011 at 5:44 AM, Michael Hunger michael.hun...@neotechnology.com wrote: If you want to have a read-only-snapshot view of the database you can also use new EmbeddedReadOnlyGraphDatabase(path); Cheers Michael Am 21.07.2011 um 05:31 schrieb Jim Webber: Hi Cyuczi, You can't open the same database twice in two programs. If you want data to be replicated between Neo4j instances, look into HA: http://docs.neo4j.org/chunked/stable/ha-how.html http://wiki.neo4j.org/content/High_Availability_Cluster Jim ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] embedded database means it cannot be simultaneously used by multiple processes?
It is not necessary however your reply made me retest, and it works as it were, but it only shows that error, if, I run the program with EmbeddedGraphDatabase and put it in an 100 second sleep(so that it keeps the database open), and then I change it to EmbeddedReadOnlyGraphDatabase and run it again as second program (while first is already running as EmbeddedGraphDatabase). In this case, this second program shows that error. If I run both programs with EmbeddedReadOnlyGraphDatabase, the exact thing happens :) I guess it's the way the second program complains that the index (and/or the database, since it's in the same path) is already in use by the first program. On Thu, Jul 21, 2011 at 6:03 AM, Michael Hunger michael.hun...@neotechnology.com wrote: Probably you have to add that for the other project too ? Am 21.07.2011 um 05:57 schrieb cyuczi eekc: Thanks Michael, that is good to know... I would've tried that right now, for tests, but unfortunately I get that silly error No index provider 'lucene' found, but only when using EmbeddedReadOnlyGraphDatabase, not EmbeddedGraphDatabase. Perhaps it would be worth mentioning that in order to not get the error for EmbeddedGraphDatabase, I had to add the folder .\lucene-index\src\main\resources\ to classpath, since I am not using any .jars, instead I'm using the source files directly from github (in eclipse) regarding my topic, I am reading this currently: http://wiki.neo4j.org/content/Using_the_Neo4j_Server_with_Java but it seems a bit messy, so I will probably limit myself to using embedded database for now :) On Thu, Jul 21, 2011 at 5:44 AM, Michael Hunger michael.hun...@neotechnology.com wrote: If you want to have a read-only-snapshot view of the database you can also use new EmbeddedReadOnlyGraphDatabase(path); Cheers Michael Am 21.07.2011 um 05:31 schrieb Jim Webber: Hi Cyuczi, You can't open the same database twice in two programs. If you want data to be replicated between Neo4j instances, look into HA: http://docs.neo4j.org/chunked/stable/ha-how.html http://wiki.neo4j.org/content/High_Availability_Cluster Jim ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] embedded database means it cannot be simultaneously used by multiple processes?
If you run into errors, please make sure to include the exceptions in the e-mail. Verbal descriptions are sometimes hard to follow without having the code and the environment. You mean you take the same program and exchange the code line to use EmbeddedReadOnlyGraphDb ? Why do you do that? Why don't you create a second program that uses EmbeddedReadOnlyGraphDb, you can't do modifying operations anyway. Cheers Michael Am 21.07.2011 um 06:12 schrieb cyuczi eekc: It is not necessary however your reply made me retest, and it works as it were, but it only shows that error, if, I run the program with EmbeddedGraphDatabase and put it in an 100 second sleep(so that it keeps the database open), and then I change it to EmbeddedReadOnlyGraphDatabase and run it again as second program (while first is already running as EmbeddedGraphDatabase). In this case, this second program shows that error. If I run both programs with EmbeddedReadOnlyGraphDatabase, the exact thing happens :) I guess it's the way the second program complains that the index (and/or the database, since it's in the same path) is already in use by the first program. On Thu, Jul 21, 2011 at 6:03 AM, Michael Hunger michael.hun...@neotechnology.com wrote: Probably you have to add that for the other project too ? Am 21.07.2011 um 05:57 schrieb cyuczi eekc: Thanks Michael, that is good to know... I would've tried that right now, for tests, but unfortunately I get that silly error No index provider 'lucene' found, but only when using EmbeddedReadOnlyGraphDatabase, not EmbeddedGraphDatabase. Perhaps it would be worth mentioning that in order to not get the error for EmbeddedGraphDatabase, I had to add the folder .\lucene-index\src\main\resources\ to classpath, since I am not using any .jars, instead I'm using the source files directly from github (in eclipse) regarding my topic, I am reading this currently: http://wiki.neo4j.org/content/Using_the_Neo4j_Server_with_Java but it seems a bit messy, so I will probably limit myself to using embedded database for now :) On Thu, Jul 21, 2011 at 5:44 AM, Michael Hunger michael.hun...@neotechnology.com wrote: If you want to have a read-only-snapshot view of the database you can also use new EmbeddedReadOnlyGraphDatabase(path); Cheers Michael Am 21.07.2011 um 05:31 schrieb Jim Webber: Hi Cyuczi, You can't open the same database twice in two programs. If you want data to be replicated between Neo4j instances, look into HA: http://docs.neo4j.org/chunked/stable/ha-how.html http://wiki.neo4j.org/content/High_Availability_Cluster Jim ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] embedded database means it cannot be simultaneously used by multiple processes?
Yeah sorry about that :) Bottom line is, EmbeddedReadOnlyGraphDb works. It only displays the `lucene index not found error` when the database(path) is already in use by another program. Otherwise it just works. I should've said this, it's simpler to understand. To answer your question, I was trying to see if it worked to use the same database(path) when using EmbeddedReadOnlyGraphDb, while I understood it doesn't work when using EmbeddedGraphDatabase. Result: it doesn't work. But the noticed difference is, when using EmbeddedGraphDatabase the exception is this: Exception in thread main org.neo4j.graphdb.TransactionFailureException: Could not create data source [nioneodb], see nested exception for cause of error at org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:153) at org.neo4j.kernel.GraphDbInstance.start(GraphDbInstance.java:111) at org.neo4j.kernel.EmbeddedGraphDbImpl.init(EmbeddedGraphDbImpl.java:189) at org.neo4j.kernel.EmbeddedGraphDatabase.init(EmbeddedGraphDatabase.java:86) at org.neo4j.kernel.EmbeddedGraphDatabase.init(EmbeddedGraphDatabase.java:63) at org.neo4j.examples.CalculateShortestPath.main(CalculateShortestPath.java:53) Caused by: java.lang.IllegalStateException: Unable to lock store [neo4j-shortest-path\neostore], this is usually a result of some other Neo4j kernel running usi ng the same store. at org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore.checkStorage(CommonAbstractStore.java:266) at org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore.init(CommonAbstractStore.java:169) at org.neo4j.kernel.impl.nioneo.store.AbstractStore.init(AbstractStore.java:120) at org.neo4j.kernel.impl.nioneo.store.NeoStore.init(NeoStore.java:65) at org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource.init(NeoStoreXaDataSource.java:134) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at org.neo4j.kernel.impl.transaction.XaDataSourceManager.create(XaDataSourceManager.java:76) at org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:147) ... 5 more but when using EmbeddedReadOnlyGraphDatabase, the exception is this instead: Exception in thread main java.lang.IllegalArgumentException: No index provider 'lucene' found at org.neo4j.kernel.IndexManagerImpl.getIndexProvider(IndexManagerImpl.java:76) at org.neo4j.kernel.IndexManagerImpl.getOrCreateNodeIndex(IndexManagerImpl.java:269) at org.neo4j.kernel.IndexManagerImpl.forNodes(IndexManagerImpl.java:255) at org.neo4j.kernel.IndexManagerImpl.forNodes(IndexManagerImpl.java:249) at org.neo4j.examples.CalculateShortestPath.main(CalculateShortestPath.java:54) that is what I was attempting to say in the previous xD Regards ;) On Thu, Jul 21, 2011 at 6:16 AM, Michael Hunger michael.hun...@neotechnology.com wrote: If you run into errors, please make sure to include the exceptions in the e-mail. Verbal descriptions are sometimes hard to follow without having the code and the environment. You mean you take the same program and exchange the code line to use EmbeddedReadOnlyGraphDb ? Why do you do that? Why don't you create a second program that uses EmbeddedReadOnlyGraphDb, you can't do modifying operations anyway. Cheers Michael Am 21.07.2011 um 06:12 schrieb cyuczi eekc: It is not necessary however your reply made me retest, and it works as it were, but it only shows that error, if, I run the program with EmbeddedGraphDatabase and put it in an 100 second sleep(so that it keeps the database open), and then I change it to EmbeddedReadOnlyGraphDatabase and run it again as second program (while first is already running as EmbeddedGraphDatabase). In this case, this second program shows that error. If I run both programs with EmbeddedReadOnlyGraphDatabase, the exact thing happens :) I guess it's the way the second program complains that the index (and/or the database, since it's in the same path) is already in use by the first program. On Thu, Jul 21, 2011 at 6:03 AM, Michael Hunger michael.hun...@neotechnology.com wrote: Probably you have to add that for the other project too ? Am 21.07.2011 um 05:57 schrieb cyuczi eekc: Thanks Michael, that is good to know... I would've tried that right now, for tests, but unfortunately I get that silly error No index provider 'lucene' found, but only when using EmbeddedReadOnlyGraphDatabase, not EmbeddedGraphDatabase. Perhaps it would be worth mentioning that in order to not get the error for EmbeddedGraphDatabase, I had to add the folder .\lucene-index\src\main\resources\ to classpath, since I am not using any .jars,
Re: [Neo4j] embedded database means it cannot be simultaneously used by multiple processes?
now looking back at HA, I see here: Porting your application to run on Neo4j-HA As mentioned earlier the only thing that needs to change is the creation of the graph database service. In single machine operations the EmbeddedGraphDatabase class should be used while in multi machine HA environment the HighlyAvailableGraphDatabase class should be used. Depending on application type this either means modifying the code or the configuration of the container running the application. so it looks like, HA is better than using neo4j server then , but I thought they were both using the same way to access data, via URI and weird messy stuff :) I'll then begin reading, many thanks Jim! On Thu, Jul 21, 2011 at 6:45 AM, cyuczi eekc cyuczie...@gmail.com wrote: Yeah sorry about that :) Bottom line is, EmbeddedReadOnlyGraphDb works. It only displays the `lucene index not found error` when the database(path) is already in use by another program. Otherwise it just works. I should've said this, it's simpler to understand. To answer your question, I was trying to see if it worked to use the same database(path) when using EmbeddedReadOnlyGraphDb, while I understood it doesn't work when using EmbeddedGraphDatabase. Result: it doesn't work. But the noticed difference is, when using EmbeddedGraphDatabase the exception is this: Exception in thread main org.neo4j.graphdb.TransactionFailureException: Could not create data source [nioneodb], see nested exception for cause of error at org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:153) at org.neo4j.kernel.GraphDbInstance.start(GraphDbInstance.java:111) at org.neo4j.kernel.EmbeddedGraphDbImpl.init(EmbeddedGraphDbImpl.java:189) at org.neo4j.kernel.EmbeddedGraphDatabase.init(EmbeddedGraphDatabase.java:86) at org.neo4j.kernel.EmbeddedGraphDatabase.init(EmbeddedGraphDatabase.java:63) at org.neo4j.examples.CalculateShortestPath.main(CalculateShortestPath.java:53) Caused by: java.lang.IllegalStateException: Unable to lock store [neo4j-shortest-path\neostore], this is usually a result of some other Neo4j kernel running usi ng the same store. at org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore.checkStorage(CommonAbstractStore.java:266) at org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore.init(CommonAbstractStore.java:169) at org.neo4j.kernel.impl.nioneo.store.AbstractStore.init(AbstractStore.java:120) at org.neo4j.kernel.impl.nioneo.store.NeoStore.init(NeoStore.java:65) at org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource.init(NeoStoreXaDataSource.java:134) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at org.neo4j.kernel.impl.transaction.XaDataSourceManager.create(XaDataSourceManager.java:76) at org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:147) ... 5 more but when using EmbeddedReadOnlyGraphDatabase, the exception is this instead: Exception in thread main java.lang.IllegalArgumentException: No index provider 'lucene' found at org.neo4j.kernel.IndexManagerImpl.getIndexProvider(IndexManagerImpl.java:76) at org.neo4j.kernel.IndexManagerImpl.getOrCreateNodeIndex(IndexManagerImpl.java:269) at org.neo4j.kernel.IndexManagerImpl.forNodes(IndexManagerImpl.java:255) at org.neo4j.kernel.IndexManagerImpl.forNodes(IndexManagerImpl.java:249) at org.neo4j.examples.CalculateShortestPath.main(CalculateShortestPath.java:54) that is what I was attempting to say in the previous xD Regards ;) On Thu, Jul 21, 2011 at 6:16 AM, Michael Hunger michael.hun...@neotechnology.com wrote: If you run into errors, please make sure to include the exceptions in the e-mail. Verbal descriptions are sometimes hard to follow without having the code and the environment. You mean you take the same program and exchange the code line to use EmbeddedReadOnlyGraphDb ? Why do you do that? Why don't you create a second program that uses EmbeddedReadOnlyGraphDb, you can't do modifying operations anyway. Cheers Michael Am 21.07.2011 um 06:12 schrieb cyuczi eekc: It is not necessary however your reply made me retest, and it works as it were, but it only shows that error, if, I run the program with EmbeddedGraphDatabase and put it in an 100 second sleep(so that it keeps the database open), and then I change it to EmbeddedReadOnlyGraphDatabase and run it again as second program (while first is already running as EmbeddedGraphDatabase). In this case, this second program shows that error. If I run both programs with EmbeddedReadOnlyGraphDatabase, the exact thing happens