开发者

Two mysql servers using same database

开发者 https://www.devze.com 2023-03-20 06:59 出处:网络
I have a MySQL database running on our server at this location. However, the internet connection at this location is slow (Especially when several users are connected remotely).

I have a MySQL database running on our server at this location. However, the internet connection at this location is slow (Especially when several users are connected remotely).

We also have a remote web server on a very fast internet connection.

Can I run another MySQL server on the remote server and still be able to run queries and updates on it?

I want to have two servers because - Users at this location can connect via lan (fast) - Users working remotely can connect to synced remote server (fast)

Is this possible? From what I understand replication does not work this way. What is replication used for then? Backups?

Thanks for your help!

[Edit]

After doing some more reading, I am a little worried about setting up multi-master replication due to the fact that I had not considered multi-master when designing the database and conflicts could be an issue.

The good news though is that most time consuming operations are queries not updates. And, I found out that there is a driver that handles master-slave connections.

http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-replication-connection.html

That way writes will be sent to the master and reads can come from the faster connection.

Has anyone tried doing this before? My one concern is that if I update to the master, then run a query expecting to see the update on the slave, will it be there right away? Or will the slow connection make this solution just as slow as using 开发者_Python百科the master for both read and write?


What you're asking, I believe, is called Multi-Master Replication, by which both servers serve as replication masters to each other. Changes on either server become replicated back to the other as soon as possible. MySQL can be configured to do it, however I'm not sure how the differences in speed would affect your performance and data integrity.

http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-replication-multi-master.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号