1

I want to replicate neo4j data on two different neo4j instances installed on ec2. Is there anyway by which I can commit same data to two different neo4j instances?

I tried examples for committing on two different data sources as given here but they create separate repositories for each data source config which I don't want here. I have only one repository and when I commit, it should be written in both data sources. I cannot use enterprise edition of neo4j since it is costly. So I have to limit myself to community edition only.

In general, I would like to learn about this process irrespective of type of any database. It can be SQL or H2 or mongo, any db.

CodeHunter
  • 2,017
  • 2
  • 21
  • 47

1 Answers1

1

Essentially you are asking for a replication feature and as far as I remember replication is not available in free open source version of neo4j.

If you create two repositories, you will introduce the problems of a distributed system example: what if one write succeeds and the other one fails. If you really want this kind of architecture, you are better off using a RabbitMQ/Kafka and make is event driven system that works on publish/subscribe pattern. You will have multiple listeners that way that can update multiple ne04j instance, still not ideal by any way!!!!

I would suggest to look at neo4j alternatives like https://orientdb.com/ or buy commercial license of neo4j.

Chirdeep Tomar
  • 4,281
  • 8
  • 37
  • 66
  • publish/subscribe way looks an alternative, still not efficient, as you told. I found another way of doing it by using HTTP transactional endpoint for post, delete, rollback, commit etc. using neo4j. I am trying to make these calls using these api endpoints, but then I would need to intake a cypher query rather than using spring support for neo4j. Let me know drawbacks in this case if you feel like. – CodeHunter Oct 31 '18 at 15:03
  • I am not sure how transactional endpoint will help you with distributed transactions. According to the defintion, "The Neo4j transactional HTTP endpoint allows you to execute a series of Cypher statements within the scope of a transaction. The transaction may be kept open across multiple HTTP requests, until the client chooses to commit or roll back." which means you can pass in multiple queries over a single endpoint on a single neo4j node. How does that provide you data integrity over 2 nodes? – Chirdeep Tomar Oct 31 '18 at 15:57
  • I can create two different transactions with same cypher query pass them to two different neo4j nodes? – CodeHunter Oct 31 '18 at 16:19