简体   繁体   中英

Is there any way in Spring Boot to commit same data to two different data sources without duplicating the repository?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM