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

476 comments:

«Oldest   ‹Older   401 – 476 of 476
shashank verma said...

The blog you posted is quite helpful for us to learn about web design. We appreciate you sharing this information with us.
Career upskilling courses in mumbai

Jahan said...

This article on writing a fault-tolerant database is a must-read for any programmer interested in building reliable and resilient database systems. Thanks for sharing a great piece of work that is informative.
6 Best social media sites for digital marketing

kirthi said...

Thank you for sharing such an informative blog post. Your insights have been incredibly valuable!
Career in Digital marketing

Aperture2 said...

Great blog! Thank you for sharing! Digital marketing courses in Albania 

Onlinebiz2121 said...

Thank you for sharing an informative post.
Online businesses are booming and here are a few ideas that have proven to be successful.
 30 Online business ideas worth giving a shot 

Here Virat said...

This is a great article, it gave lots of information. It is extremely helpful for all.
Inbound marketing

Israt.j1044 said...

I found this article to be a great resource for understanding the complexities and challenges that come with designing a database that can withstand errors and failures.
Digital marketing courses in Jamaica

Shila Deshmukh said...

I liked your blog very much. Writing a fault-tolerant database application using MySQL Fabric ensures reliability and resilience, providing a robust solution for managing data efficiently. Healthcare Digital marketing

Aperture3 said...

Brilliant article!Thank you! Digital marketing funnel traditional to digital

Moumi said...

This article on developing fault-tolerant database applications using MySQL Fabric is incredibly informative and well-explained. The sample code and explanations provided make it easy to understand and implement in real-world scenarios. Thank you for sharing this valuable knowledge!
Top digital marketing modules for business

DMCottawa21 said...

Hi, thank you for sharing this valuable resource. It was very informative.
Are you ready to unlock the power of digital marketing and take your career to new heights? Look no further than our comprehensive Digital Marketing courses in Ottawa.
Digital marketing courses in Ottawa

dmpassion02 said...

I'm impressed with the Theme Rainbow Garden Blogger Templates. The templates are modern, visually appealing, and easy to use. Digital Marketing Courses In Randburg

dmpassion03 said...

This blog provide bloggers with a variety of options to showcase their content in a stylish and professional manner. Digital Marketing Courses In Bhutan

dmpassion04 said...

The Theme Rainbow Garden Blogger Templates are a fantastic choice for bloggers looking to add a touch of creativity and personality to their blogs. Benefits of Online digital marketing course

dmpassion05 said...

The templates offer a wide range of themes, from bright and colorful to elegant and minimalist, ensuring there's something for every blogging style. Social media marketing ideas

dmpassion06 said...

The templates offer a wide range of themes, from bright and colorful to elegant and minimalist, ensuring there's something for every blogging style.Top 12 free email-marketing tools for business

Mita said...

I found your article on writing a fault-tolerant database application using MySQL Fabric very informative and practical. Your explanations and code samples make it easier for readers to understand and implement the concepts. Thank you for sharing this valuable information!
Data Analytics Courses in Bangalore




shashank verma said...

excellent article, many interesting ideas throughout, looking forward to the next update...
Digital marketing courses in Jordan

iimskills said...

I am absolutely in awe of this blog post! The author's expertise and passion shine through in every carefully crafted word. The depth of research and the comprehensive coverage of the topic are commendable.

shashank verma said...

I'm excited to write this piece. Post is interesting! Regards for the article. What specifically is wrong with this kind of post? It adheres to your prior posting length and clarity standards.
Data Analytics Courses In Pune

Adwords21 said...

Nice article! Thanks for sharing.
Google Ads is one of the most cost-effective ways to promote online to get new consumers, generate profits, or establish a brand.
 Benefits of Google adwords 

Eshrat Amin said...

This blog post on writing fault-tolerant databases provides valuable insights into a crucial aspect of database management. It's an informative piece that explains the importance of fault tolerance and offers practical tips. If you are interested to learn about digital marketing course in Delhi click Digital Marketing Courses in Delhi

Ankita said...

I'm impressed by your in-depth explanation of how to develop fault-tolerant database applications using MySQL Fabric. Your insights into Fabric's high availability features and the sample code provided demonstrate your expertise in databases and distributed systems. Great work!
Instagram courses in Chennai

iimskills said...

This blog post has broadened my understanding and left me inspired. It's truly an exceptional piece that deserves all the praise!"

Mitali said...

An excellent and informative guide on developing fault-tolerant database applications with MySQL Fabric! The sample code and explanations make it easy to understand and implement. Thank you for sharing this valuable knowledge!
Data Analytics Courses In Kochi

shashank verma said...

Hi, You've provided some quite useful news. We appreciate you sharing your fantastic experience. A very well-written post with detailed instructions.
Data Analytics Courses In Chennai

dmpassion08 said...

It covers essential concepts and provides guidance on designing robust and scalable applications that can handle failures effectively. https://iimskills.com/data-analytics-courses-in-chandigarh/

firoze said...

hey this is an amazing post looking forward to more post like this, Data Analytics Courses In Patna

PratyakshaSS said...

The author's depth of understanding and passion for data analytics shine through in every paragraph, making the read not only informative but also inspiring.
Data Analytics courses in thane

Books Made Easy said...

nice and informative content ... thanks for sharing
Data Analytics Courses in Surat

Rini said...

I found this article on developing "Fault-tolerant applications using Fabric" extremely useful. I appreciate the author for explaining a complex topic in such a simple manner.
Data Analytics Courses In Edmonton

Pamela said...

Your article on developing fault-tolerant database applications using MySQL Fabric is highly informative and well-presented. The sample Python code adds practicality and clarity to the concepts discussed. Great job on providing valuable insights into this topic!
Data Analytics courses in new york



Shakhi said...

This post provides a guide on developing fault-tolerant database applications using MySQL Fabric, which is a high availability sharding solution for MySQL.
I found this post very informative.
Data Analyst Interview Questions

shashank verma said...

This article's informatics-heavy material inspired all programmers and newcomers to pursue careers in big data technology. This article always updates us and truly impresses.
Digital Marketing Courses In Ireland

sancharini said...

Hi, this article offers a comprehensive introduction to utilizing MySQL Fabric for developing fault-tolerant database applications, catering to readers seeking to enhance their understanding of high availability solutions for MySQL servers.
Data Analytics Courses at XLRI

vermashashank407 said...

I appreciate the author's efforts to share their knowledge with the community because the post offers insightful information about the creation of a fault-tolerant database.
Career options after English Honours

shashank verma said...

This article offers instructions for using MySQL Fabric, a high availability sharding solution for MySQL, to create fault-tolerant database applications.
I learned a lot from this post.
Social media marketing plan

vermashashank344 said...

Excellent content. Keep posting this informative content; I really loved reading it.
Ways to get digital marketing job as a fresher

Srijita said...

The article is well-written and informative. The author does a good job of explaining the concepts in a clear and concise way. The sample code is also very helpful and provides a good starting point for developers who want to use Fabric. Thank you.
Business Analytics courses in Pune

Day Dreamer said...

The post discusses developing fault-tolerant applications using MySQL Fabric, focusing on its high availability aspects and how to build applications that interact with Fabric for redundancy and resilience in case of failures. It provides code examples in Python and emphasizes using Fabric to manage MySQL servers for high availability.
Data Analytics Courses At Coursera

Ashvin Kumar said...

This article gives a thorough overview of using MySQL Fabric to create fault-tolerant applications. It is instructive to look at the XML-RPC technique and real-world code examples. awaiting the project's advancement.

Data Analytics Courses in India

iteducationcentre said...

Nice post. Thanks for sharing such a useful post.
SQL Classes in Pune

Anonymous said...

Your article on "Writing a Fault-tolerant Database Application using MySQL Fabric" is an insightful guide for developers navigating the intricacies of building robust and reliable database applications. The step-by-step approach you've taken to explain concepts like sharding, high availability, and failover in the context of MySQL Fabric is commendable. It's evident that you're well-versed in the subject matter and have a knack for breaking down complex concepts into manageable components. This article serves as a valuable resource for those looking to create fault-tolerant database applications, and I appreciate the real-world examples that make the concepts even more tangible. Great work!
Data Analytics courses in new york

Avinash said...

Hi,
This writeup serves as a valuable guide for developers interested in building fault-tolerant applications using MySQL Fabric's high availability features, offering both theoretical insights and practical code examples. Thanks a lot for sharing this.
Data Analytics Courses in Pune

Ajay Prasad said...

We greatly value your valuable insights.
Data analytics is playing a transformative role in India's various sectors, harnessing the nation's abundant tech expertise and flourishing digital environment. Indian businesses are progressively turning to data analytics to make more informed choices and enhance their customer engagements.
Data Analytics Courses in India

Data Analytics Courses in Agra said...

Fantastic article! I'm grateful. I'm delighted to read your educational blog. Please continue to update.
Data Analytics Courses in Agra

Advisor Uncle said...

"Exciting to observe the development of MySQL Fabric for high availability! I'm interested in learning more about its sharding potential as well. I appreciate you giving this information.
Data Analytics Courses In Bangalore

Divya Sharma said...

The use of MySQL Fabric to create fault-tolerant database applications is an exciting development. This article provides a clear and informative guide to understanding its implementation, offering a glimpse into the future of database management. Outstanding innovation.
Is iim skills fake?

Anonymous said...

Writing a fault-tolerant database application using MySQL Fabric is crucial for ensuring data reliability and availability. This blog provides valuable insights into achieving this goal, which is essential in today's data-driven world where downtime is not an option. The guidance offered here can be a valuable resource for developers and database administrators looking to enhance the robustness of their MySQL-based applications.
Data Analytics Courses in Delhi



Pratyaksha said...

The step-by-step instructions and clear explanations you've provided make it accessible to both beginners and experienced database administrators. Thanks for sharing this practical guide—I'll be referring to it as I explore MySQL Fabric further in my own projects.
Data Analytics Courses In Chennai

Surabhi said...

Notes on Writing a Fault-tolerant Database Application using MySQL Fabric provide essential guidance for building robust database applications. Understanding fault tolerance is crucial in database management, particularly for ensuring data reliability and availability. Please also read Data Analytics courses in Glasgow

Advisor Uncle said...

I really loved this blog. I am so glad to read about this information.
Visit - Data Analytics Courses in Delhi

Aishwarya said...

This blog post provides a comprehensive guide for creating fault-tolerant database applications using MySQL Fabric. The clear explanations and real-world examples are incredibly helpful."
Data analytics courses in new Jersey

Purohit said...

Thanks for sharing your expertise on building fault-tolerant database applications with MySQL Fabric.
Digital Marketing Courses in Hamburg

Tina pansari said...

"I like how your blog is easy to understand and has useful information. Keep up the good work!"
Data Analytics Courses In Jamshedpur

Digital marketing courses in woking said...

Thank you for providing a detailed and practical guide to writing fault-tolerant database applications using MySQL Fabric. Your focus on testing and monitoring, along with the implementation of robust failover handling mechanisms, highlights the importance of building resilient and reliable database infrastructures. This article serves as an invaluable reference for developers and database engineers seeking to optimize the performance and dependability of their database applications."
Digital marketing courses in woking

DMC in Italy said...

This post is a comprehensive guide for how to develop fault-tolerant applications using MySQL Fabric, or simply Fabric the step by step guidance is very helpful and informative.
Digital Marketing Courses in Italy

Abin said...
This comment has been removed by the author.
Meera Chopra said...

This blog post introduces MySQL Fabric, a tool for building high-availability sharding solutions for MySQL. It focuses on fault tolerance and its usage in developing applications. The post discusses Fabric-aware client applications and their communication with the Fabric instance using XML-RPC protocol. The provided Python code samples demonstrate handling failures and the necessity to catch "InterfaceError" exceptions. The blog also offers a complete application that showcases the concepts explained, making it a practical resource for developers interested in MySQL Fabric.
Digital Marketing Courses In cape town

DA in limerick said...

Thanks for sharing Incredible and fantastic explanation on how to develop fault-tolerant applications using MySQL.
data analyst courses in limerick

sayaniimskillseo said...

was looking for this for few days, thanks for posting.
financial modelling course in melbourne

digitalmarketing bahamas said...

Nice. Great content. Digital Marketing Courses In Bahamas

VISWA Technologies said...

I am actually happy to glance at this website posts which consists of plenty of helpful information, thanks for providing such statistics.Manual Testing Training
<a href="https://viswaonlinetrainings.com/courses/tibco-bw-online-training/>Tibco BW Training</a>

Prachi Kochhar said...

The use of MySQL Fabric for fault-tolerant applications is a compelling approach, and your detailed explanation provides a clear understanding of its implementation. The sample Python code and the emphasis on exception handling demonstrate the robustness of the application in high-availability scenarios. Making Fabric available through a lab release for community feedback is a positive step, fostering collaboration and improvement. Well-explained and informative post on MySQL development.
Digital Marketing Courses In Springs

digital marketing course in norwich said...

The detailed breakdown of concepts, from data distribution to scalability challenges, is both enlightening and thought-provoking. Your blog post is not just a presentation of facts; it's a guide for professionals and enthusiasts alike seeking to navigate the intricate landscape where databases and distributed systems converge.
Digital Marketing Courses In Norwich

Adwords said...

Thank you for sharing fantastic tutorial on how to develop fault-tolerant applications using MySQL Fabric.
Adwords marketing

How Digital marketing is changing business said...

Thanks for sharing insights into developing fault-tolerant apps using MySQL Fabric! Invaluable guide for developers.

How Digital marketing is changing business

Investment banking said...

The blog post is incredible tutorial for how to develop fault-tolerant applications using MySQL Fabric, or simply Fabric, thank you for sharing valuable tutorial.
Investment banking training Programs

nawin said...


"This blog serves as a guiding light for developers venturing into fault-tolerant database applications with MySQL Fabric. It's a treasure trove of insights, unraveling the complexities of ensuring resilience in database systems. A must-read roadmap that empowers developers to architect robust, fault-tolerant applications, harnessing the potential of MySQL Fabric for seamless data management and reliability."

Investment banking jobs in Mumbai

Gogou Misao said...

Excellent information. Thank you so much, I was stuck and just found this blog post and my problem is now solved. Thanks for sharing again.

Investment banking courses in Germany

Sayaniimskillsseo said...

such a great blog post, really well curated
Investment banking courses in Jabalpur

nandni said...

Hi buddies, it is great written piece entirely defined, continue the good work constantly.
Investor banker manager profile

nandni said...

Investor banker manager profile
shared an excellent article. Excellent information.Thanks.

Santosh said...

The article is fantastic, showcasing commendable work. Please continue sharing such valuable content. Your efforts are appreciated, and I look forward to more insightful posts. Investment banking vs transaction services


aaravgupta said...

Hey there! Just read your blog post on 'Writing a Fault-tolerant Database Application using MySQL Fabric' and it's incredibly informative! Your step-by-step guide and insights into building a fault-tolerant database application using MySQL Fabric are really valuable. Thanks for sharing this knowledge with us!
Data analytics courses in Rohini

Altar Runner said...

Thank you for consistently providing such valuable content that engages, educates, and sparks curiosity.
Investment banking skills and responsibilities

«Oldest ‹Older   401 – 476 of 476   Newer› Newest»