Using Mysql Offline Internet

I use a makeshift PHP client system working with mySQL local database .

Now I have a second computer in a different place where this database should also be used. Therefore, I gave this mysql database to a server accessible over the Internet.

My problem is that in the first of them there are often problems with connecting to the Internet , and then the program does not work. But it should work every time!

Now I do not know how I should deal with this problem?

  • Local database and one on the Internet, but how to combine them?
  • Should I make a local database on the computer and match them together in one?
  • I also want to change the structure of this system to symfony2 , so there is a way to solve this problem with this structure (e.g. doctrine ?)

Thanks for your help!

Update: My limitation is the Internet connection on the first computer, which cannot be fixed.

+4
source share
2 answers

If you really have limitations (1) inability to move the database from a machine with a bad connection and (2) inability to fix a bad connection; you will have to store some local instance on the second machine.

I would try setting up master-master replication from the first machine with a poor connection to the second machine. I'm not sure how reliable it will be to consider that replication will often fail due to the first poor connection to the machine. This problem can be extrapolated if one or both machines use older versions of MySQL. For example, MySQL 5.5 can be configured to actively monitor replication connectivity .

If most of your application runs READS instead of WRITES, perhaps you could install Memcached (or something similar) on a second computer so that the application can retrieve data from local memory without having to connect to a MySQL server.

+2
source

There are several ways to achieve what you want (although it may not be exactly as you described), but the best way is, of course, to place the database on a server that does not have problems connecting to the Internet. Find a hosting service that allows remote MySQL connections.

0
source

Source: https://habr.com/ru/post/1400873/


All Articles