Saturday, September 21, 2013

Writing a Fault-tolerant Database Application using MySQL Fabric

In this post, we are going to show how to develop fault-tolerant applications using MySQL Fabric, or simply Fabric, which is an approach to building high availability sharding solutions for MySQL and that has recently become available for download as a labs release (http://labs.mysql.com/). We are going to focus on Fabric's high availability aspects but to find out more on sharding readers may check out the following blog post:
Servers managed by Fabric are registered in a MySQL Server instance, called backing store, and are organized into high availability groups which deploy some sort of redundancy to increase resilience to failures. Currently, only the traditional MySQL Asynchronous Replication is supported but we will consider other solutions in future such as MySQL Cluster, Windows Server Failover Clustering and Distributed Replicated Block Device. For a great analysis of alternatives for MySQL High Availability Solutions certified and supported by Oracle readers should check out the following white paper:
Different from a traditional MySQL Client Application, a Fabric-aware Client Application does not specify what server it wants to connect to but the Fabric instance from where it will fetch information on the available servers in a group. So a fabric-aware connector is required for this task. Currently, only the connectors PHP, Java and Python have extensions to access Fabric. In the future, we aim to add Fabric support to other connectors as we are fortunate to have a strong influence over many of the key connectors in the MySQL ecosystem.

class Application(object): 
    def __init__(self): 
        fabric_params = { 
            "fabric" : {"host" : "localhost", "port" : 8080}, 
            "user"   : "oracle", "passwd" : "oracle" 
        } 
        self.__cnx = MySQLFabricConnection(**fabric_params) 

    def start(self): 
        self.__cnx.set_property(group="YYZ") 
        cursor = self.__cnx.cursor() 
        cursor.execute("...")

In this sample code, written in Python, the connector sends a request to a Fabric instance located at address "localhost", port "8080" in order to retrieve information on all servers registered in the "YYZ" group and then creates a connection to the master in the group. The communication between the connector and Fabric is done through the XML-RPC protocol which has been chosen for being a "quick and easy way to make procedure calls over the Internet". However the XML-RPC protocol is not well-known for its performance, and to reduce the overhead of contacting Fabric every time a connector needs information on a group, data is stored in a local cache.

If the current master fails though, the "InterfaceError" exception is raised and the application is responsible for catching the exception and getting a new connection to a new elected master if it wants to carry on its regular operations. See a sample code in what follows: 
 
class Application(object): 
    def __init__(self): 
        fabric_params = { 
            "fabric" : {"host" : "localhost", "port" : 8080}, 
            "user"   : "oracle", "passwd" : "oracle" 
        } 
        self.__cnx = MySQLFabricConnection(**fabric_params) 
        self.__cnx.set_property(group="YYZ") 

    def start(self): 
        while self.__run: 
            try: 
                self.__cnx.start_transaction() 
                cur.execute("...") 
                self.__cnx.commit() 
            except InterfaceError as error: 
                cur = self._get_cursor() 
            time.sleep(1) 

    def _get_cursor(self): 
        return self.__cnx.cursor()

Readers will find a full-fledged application, which shows how all the concepts introduced in this post are used together here. The application creates a simple database, a high availability group, registers the MySQL Servers into Fabric and runs a thread that mimics a client and another one that periodically executes a switchover.

To run the application, we need:
  • Python 2.6 or 2.7
  • Three or more MySQL Servers:
    • One backing store (5.6 or later preferable)
    • Two managed servers (5.6 or later necessary)
  • Fabric running
  • Connector Python (Fabric-aware Version) installed 
After configuring the environment appropriately, we can run the application as follows: 

python switchover_application.py --user=root --passwd="" --group="YYZ" \ 
--fabric-addresses="localhost:8080" \ 
--servers-addresses="localhost:13002 localhost:13003"

Please, note that Fabric and the MySQL instances may be running in different addresses and ports in our environment. So change this information accordingly.

Note that Fabric is in it early development stages and there is a long way ahead of us. However we have decided to make it public available through a labs release so that you could contribute to the project with comments, feedback or patches. Any feedback or comment is highly appreciated. Leave messages at this blog or contact us through the following forum:

http://forums.mysql.com/list.php?144

644 comments:

«Oldest   ‹Older   601 – 644 of 644
tanishqa921 said...

Great post! It offers clear guidance on building fault-tolerant applications with MySQL Fabric, especially with the Python example for handling failover. The tips on caching to reduce XML-RPC overhead are really useful. Thanks for sharing such a practical and insightful guide!
Medical Coding Courses in Delhi

Arpita ah said...

Impressive guide on building fault-tolerant database systems—your explanation of redundancy, failover strategies, and recovery mechanisms is both detailed and practical. It’s an invaluable resource for architects aiming to enhance reliability.
Medical Coding Courses in Delhi

Saloni said...

Short, sharp, and full of value.Medical Coding Courses in Delhi

IIM Skills(Neha Tiwari) said...

Great walkthrough! The explanation of MySQL Fabric’s high availability and fault-tolerance features was really helpful, especially with the sample Python code. Looking forward to seeing Fabric evolve further.

Medical Coding Courses in Delhi

GAUTAM0 said...

This guide provides a clear overview of building fault-tolerant MySQL applications using Fabric. The Python integration example effectively demonstrates automatic failover handling. It's insightful for understanding HA group configuration and Fabric-aware connectors. However, the reliance on XML-RPC and early-stage nature of Fabric warrant cautious adoption.
Medical Coding Courses in Delhi

Arpita ah said...

I found your explanation of writing fault‑tolerant database systems really insightful—those practical strategies are exactly what production setups need! Medical Coding Courses in Delhi

kirti said...

"Very informative post! MySQL Fabric seems like a promising step toward building fault-tolerant applications. Looking forward to broader connector support and future integration with more HA technologies."
Medical Coding Courses in Delhi

Meghna said...

This is a great walkthrough for anyone building resilient MySQL-based applications using Fabric. The step-by-step examples make high availability concepts easier to grasp. For those looking to expand their tech career, consider exploring healthcare tech through Medical Coding Courses in Delhi – a booming domain alongside distributed systems.

Tushar gautam said...

Databases and distributed systems form the backbone of modern computing. Their integration enables scalable, resilient, and high-performance applications—critical for everything from cloud services to real-time data processing.
Medical Coding Courses in Delhi

IIM Skills(Neha Tiwari) said...

Great and informative post! Loved learning about fault-tolerant applications using MySQL Fabric. Thanks for sharing!
Medical Coding Courses in Delhi

kirti said...

Great walkthrough on using MySQL Fabric for building fault-tolerant applications. The example with Python clearly demonstrates how Fabric-aware clients interact with HA groups, and I appreciate the explanation of how the Fabric connector leverages XML-RPC with local caching to reduce overhead.
Medical Coding Courses in Delhi

Asif said...

Very informative and no fluff. Appreciate the direct approach.
Medical Coding Courses in Delhi

iimskillsdelhinsp said...

Excellent post! Fault tolerance is a critical yet often overlooked aspect of modern database applications, and MySQL Fabric provides a robust foundation for managing high availability and scalability.

Medical Coding Courses in Delhi

Tushar gautam said...

Excellent guide! Building fault-tolerant applications with MySQL Fabric is key to ensuring high availability and reliability. This post makes the complex topic accessible and practical.

Medical Coding Courses in Delhi

Anonymous said...

The presentation of your article is out of the box.Medical Coding Courses in Delhi

Anonymous said...

svrtechnologies
I am inspired with your post writing style & how continuously you describe this topic.
Medical Coding Courses in Delhi

Medical coding courses in Delhi said...

This was a fascinating read—thank you for breaking down such a complex topic in a clear and structured way. Building fault-tolerant databases is no small feat, and your insights into replication, consensus, and failure handling really highlight the challenges and trade-offs involved. It's always inspiring to see real-world approaches to making systems more resilient. Looking forward to exploring more of your content!
Medical Coding Courses in Delhi

tanishqa921 said...

Thanks for the great overview of MySQL Fabric! The Python examples make it easier to understand how to handle failover. I’m curious about the performance of XML-RPC and if there are plans for faster communication methods. Looking forward to seeing how Fabric develops!
Medical Coding Courses in Delhi

iimskill priya said...

Excellent insights into building fault-tolerant database systems—critical knowledge for scaling and resilience. If you're interested in applying similar principles to healthcare data systems, check out these Medical Coding Courses in Delhi for a practical path into the field

Meghna said...

Interesting read! MySQL Fabric’s high availability features offer real value for building robust applications. For those interested in combining tech and healthcare data management, explore this guide on Medical Coding Courses in Delhi—where precision and reliability are essential.

Hima Rasheed said...

Excellent article on writing fault-tolerant distributed databases! The focus on techniques like data replication, automated failover, consensus algorithms, and sharding highlights how reliability and high availability are achieved even when a node or component fails. These approaches are essential for ensuring that distributed databases can operate smoothly, recover quickly, and avoid data loss in real-world environments. Thanks for making these complex concepts clear and practical!
Medical Coding Courses in Delhi

Medical coding courses in Delhi said...

Nice Post thanks for the information, good information & very helpful for others,Thanks for Fantasctic blog and its to much informatic which i never think ..Keep writing and grwoing your self
Medical Coding Courses in Delhi

Dimple said...

Nice and usefull contents. thanks for sharing. expecting much in the future.
Medical Coding Courses in Delhi

princy jain said...

financial modeling courses in delhi

This post offers a solid exploration of patterns for building fault-tolerant databases—especially the approaches using replication and consensus mechanisms. The coverage of quorum-based writes and synchronous replication stood out. It’s a thoughtful resource for systems designers seeking reliability in distributed data stores.”

Anu said...

Really enjoyed reading this—clear, informative, and well‑structured!
Appreciate the effort that went into explaining everything so simply.
It definitely added value and gave me a fresh perspective on the topic.
Looking forward to exploring more content like this from you!
financial modeling courses in delhi

IIM Skills said...

Your insights into transaction logs, replication, and failover mechanisms are advanced yet accessible. This deep-dive helped me rethink resilience design in real systems.
financial modeling courses in delhi

Sohail Digi said...

This is a well-crafted and practical introduction to building fault-tolerant database applications using MySQL Fabric. I like how you clearly explain the role of Fabric in managing high availability groups and its use of asynchronous replication for redundancy. The focus on how Fabric-aware clients dynamically discover and connect to the current master is especially valuable — it highlights a key architectural difference from traditional MySQL clients.

https://iimskills.com/financial-modelling-course-in-delhi/

Bhavika said...

financial modeling courses in delhi
Great post! Building fault-tolerant applications is essential for modern systems, and this guide on using MySQL Fabric covers some really important concepts. The explanation of high availability, sharding, and failover handling is especially useful. It’s nice to see practical steps alongside the architecture overview. Looking forward to more content on scaling and managing distributed databases!


Priti Saha said...

Nice and useful contents. thanks for sharing. expecting much in the future.
financial modelling courses in delhi

princy jain said...

Really appreciate the effort you put into this post! The insights are clear, helpful, and genuinely made me think. It’s always refreshing to come across content that’s both informative and engaging. Looking forward to exploring more from you!
financial modeling courses in delhi

akashiimskill said...

Great

financial modeling courses in delhi to apply these logical principles to business and finance problems.

Thanks for a great, timeless explanation!

Nilabh said...

Excellent deep dive into building fault tolerance with MySQL Fabric!
The practical examples make resilience in distributed setups feel achievable.
Clarifying how auto-failover and high availability interact was particularly helpful.
Would love to see a follow-up exploring how this integrates with Kubernetes or orchestration tools.

financial modeling courses in delhi

Nilabh said...

Excellent deep dive into building fault tolerance with MySQL Fabric!
The explanations of auto-failover and high availability are especially practical.
Appreciated how you showcased clustering logic and node replication clearly.
Would love to see a follow-up explore integration with containerized environments or orchestration tools.
financial modeling courses in delhi

Bhavika said...

financial modeling courses in delhi
Great read! Building fault-tolerant applications is critical in today’s always-on environments, and this post does a fantastic job explaining how MySQL Fabric can help manage high availability and scalability.

I especially appreciated the breakdown of automatic failover and sharding—two features that can really enhance resilience and performance. The practical examples make it easier to visualize how to implement these concepts in real-world systems.

iim.skills said...

This piece explains fault tolerance in a way that helps readers grasp its direct impact on database stability. You used each part to break down how failure points get handled and how systems stay active under stress. The flow supports quick understanding, and the real-world use cases add strength to the ideas. Anyone building data tools can learn from this without needing extra background. You kept the focus sharp and the message useful.
financial modeling courses in delhi

akashiimskill said...

very nice article keep posting
href="https://iimskills.com/financial-modelling-course-in-delhi/">financial modeling courses in delhi

IIM Skills said...

This is a fantastic explanation of building fault-tolerant systems in distributed databases. With data availability and system resilience becoming key aspects of cloud infrastructure, this post is very timely. The strategies you outlined, including redundancy and replication, are vital for modern DevOps and database architects. Your technical depth is commendable and really helps readers dive into practical implementation.
financial modeling courses in delhi

Sohail Digi said...

This is well-written and very informative. Thanks for sharing your knowledge
https://iimskills.com/financial-modelling-course-in-delhi/

Nilabh said...

Outstanding guide on building fault-tolerant applications with MySQL Fabric! Your step-by-step coverage of HA groups, caching, and exception handling in Python is crystal clear and practical. Thanks for the insights!

financial modeling courses in delhi

Priti Saha said...

Its really helpful for the users of this site. I am also searching about these type of sites now a days. So your site really helps me for searching the new and great stuff.
financial modeling courses in delhi

Monika Khatnani said...

Excellent guide! The explanation of MySQL Fabric’s features and the step-by-step approach to building a fault-tolerant application make this a valuable resource for developers aiming for high availability and reliability.
financial modeling courses in delhi

IIM Skills(Shreya Saha) said...

ChatGPT said:

This is a well-structured and informative post that clearly explains the role of MySQL Fabric in creating fault-tolerant, high-availability database applications. I appreciate how it not only introduces the core concept but also points readers toward additional resources for deeper learning, such as the sharding introduction and the Oracle white paper. The focus on practical implementation details, combined with future considerations for alternative HA solutions, makes it especially valuable for developers and system architects exploring resilient MySQL deployments.
financial modeling courses in delhi

IIM Skills(Shreya Saha) said...

This is a very detailed and practical guide to building fault-tolerant applications with MySQL Fabric. I appreciate how you included Python sample code along with explanations of handling master failovers—it makes the concepts much easier to understand. Thank you for sharing such a thorough walkthrough!
financial modeling courses in delhi

indu said...

The interplay between databases and distributed systems is fundamental to building scalable and reliable applications today. Distributed systems help databases overcome limitations of single-node storage, but they also introduce complex challenges like data consistency and fault tolerance.
financial modeling courses in delhi

«Oldest ‹Older   601 – 644 of 644   Newer› Newest»