Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does DB clustering work?

Tags:

I have a question for the DBA's out there: If I scale from a single web/DB server setup to two web/two DB server setup with a load balancer in front of the web servers to route incoming queries evenly... how do solutions like MySQL Cluster work so that a change made to one DB server is immediately known to the other (otherwise, users routed to the other DB server won't see the data or will outdated data), or at least so that the other web server is made aware of the fact that it's reading "dirty data" and it should try again in X seconds so as to get up-to-date data?

Thank you.

like image 766
Gulbahar Avatar asked Jun 17 '09 07:06

Gulbahar


People also ask

How does database clustering work?

Database clustering refers to the ability of several servers or instances to connect to a single database. An instance is the collection of memory and processes that interacts with a database, which is the set of physical files that actually store data.

What is DB clustering?

Database Clustering is the process of combining more than one servers or instances connecting to a single database. Sometimes one server may not be adequate to manage the amount of data or the number of requests, that is when a Data Cluster is needed. SQL is the language used to manage the database information.

Why do we use database clustering?

The main reasons for database clustering are its advantages a server receives; Data redundancy, Load balancing, High availability, and lastly, Monitoring and automation.


2 Answers

TWO ways of doing this. Active/Active or Active/Passive. Active/Passive is most prevalent The data is kept in sync on the passive node. The cluster is useful configuration in as much as the active node goes down the passive is immediately switched hence no downtime. The clustering continuously synchronises the 2 nodes in the cluster.

I work with SQL server but I think the basic premise of clustering is the same for mySQL - that is no (or no noticeable) downtime on hardware failure.

EDIT: Additionally the clustering software handles the synchronisation. You don't need to worry. You view the cluster nodes as a virtual directory, which behaves like one server in windows.

here is document explaining this

http://www.sql-server-performance.com/articles/clustering/clustering_intro_p1.aspx

like image 108
Stuart Avatar answered Oct 02 '22 23:10

Stuart


In Windows server clustering (to be distinguished from High Performance Clustering), there is a shared external storage array. The active node takes ownership/control of the storage, and when that node fails, the storage 'fails over' to the previously passive node (which is now the active node). There are also different schemes that allow for independent storage at each node, vs. shared storage. However, these require the application to have enough intelligence to know that it is clustered, and keep the two storage sets in sync.

like image 29
Jay Avatar answered Oct 02 '22 22:10

Jay