I have two databases, one in London and one in Dublin. How can I have a complete view of the data in a cloud database? Assume that the database structure allows me to use multiple locations such that there will be no collisions.
EDIT: All the changes in the databases are done locally. For example: let's say I have a sensor in Dublin that dumps the data on the Dublin database and another sensor in London which dumps its collected data in the London database. How do I get a federated view of this data in my cloud database? From an admin interface I want to query the cloud database, not the other ones.
Have two webservices for each database location. The webservices queries the respective databases on a periodical interval and insert the data into cloud database.
Plan A: Galera cluster (as found in MariaDB) that includes the 3 servers.
Plan B: "Multi-source replication" wherein your two physical servers are Masters and the Cloud server is the Slave. Again, the requires MariaDB. (See DBHash's Answer.)
You can set up MariaDB in cloud server and have LONDON and DUBLIN servers as masters. Multi master replication is available in MariaDB. I assume that the masters have different database names.
https://mariadb.com/kb/en/mariadb/multi-source-replication/
Presto is useful here as well.
you can deploy presto on the cloud machine, using mysql connectors connect to different geo databases, create different catalog schemas.
write queries to combine result from both database. something like:
Some Random Links on this
You can define
FEDERATED
tables in your "cloud" database: any queries on these tables will be transmitted from the "cloud" server to the relevant London/Dublin server over the MySQL client protocol (note that data is not copied to the "cloud" server, so it does not provide any form of backup service):You could then define a
VIEW
that comprises theUNION
of those federated tables. Unfortunately however,UNION
views are neither insertable nor updateable—so if you need to commit any changes to the data you'd have to operate on the underlying (federated) table: