I have system which is having java Desktop application with PostgreSQL which is installed on 5 machine each is having individual database and having databases into same database structure.
Now I want to move that all slave data to one master database periodically. Which way will be convenient ?
I found two approach:
- Create REST service which will post data each row from each table to master database.
- Create slave-master replication.
If there is any other technique then please update me.
Please explain how to apply best approach.
EDITED
Used same schema for all the desktop application and used sequences to generate primary keys.
I want to merge them all into single AMAZON RDS postgreSQL database.
Best Answer
Based on the replies you gave to my comments you must figure out how to resolve the duplicate keys issue. Also I do not think that master-slave replication is appropriate in this case.
I would, after making sure that there are no duplicate keys, use
pg_dump
to transfer your data into AmazonRDS one by one. Perform checks after every database that you do. If you have time and space then first do a test. During this test the 5 machines can remain active.For master-slave you should check the Replication page of PostgreSQL. The problem remains the duplicate keys as mentioned there as:
I do not think however that you can have 5 different 'versions' on the local desktops.