Tuesday, May 27, 2014

MySQL Fabric: The --update_only option because one size does not fit all

MySQL Fabric is a distributed framework that has high availability and sharding as targets. It organizes the servers in groups which use the standard MySQL Replication to providing fault-tolerance. Shards are assigned to different groups thus allowing applications to distribute both reads and writes and exploit resilience to failures as well.

Information on groups, servers and shards are stored in a MySQL Instance called state store or backing store. This instance is a repository for all this information and the engine used might be any supported by MySQL, although a transactional engine must be picked to truly provide fault-tolerance. Note though that we have been testing MySQL Fabric with Innodb and currently this the only official engine supported.

Built upon the repository there are several functions that, besides being used to retrieve information from and update the repository, are responsible for the execution of some administrative tasks. For example, adding a server into a group has two steps: creating an entry into the state store and making the server point to the current primary, if there is any.

Promoting a new primary requires to:

  • choose among a set of candidates which one will become the new primary when a candidate is not promptly specified;
  • stop accepting writes on the current primary;
  • synchronize the primary with the secondaries and reconfigure replication;
  • update the repository with the new information.

However, there might be users who want to use their own scripts to execute these administrative tasks and want to update MySQL Fabric to reflect the changes made to the servers. For these users, we have introduce the --update_only option into some commands so that they might continue using their own scripts and take advantage of MySQL Fabric at the same time as well.

Executing commands

MySQL Fabric's command might be invoked as a command-line script as follow:

mysqlfabric group add my_group localhost:13001 --update_only

Or using a MySQL Fabric-aware connector (e.g. Connector Python) through a direct call to a XML-RPC function as follows:

ERROR, SUCCESS = range(1, 3)

conn = mysql.connector.connect(
    fabric={"host" : "localhost",
            "username": "admin", "password" : "adminpass"
           },
    user="webuser", password="webpass"
)
proxy = conn._fabric.get_instance().proxy
status = proxy.group.add("my_group", "localhost:13001", 5, True)
if status[1][-1]["success"] == ERROR:
    raise Error("Something bad happened %s." % (str(status), ))

Note that the "mysqlfabric" script uses XML-RPC to call the appropriate functions and both examples try to add "localhost:13001" server into the "my_group" group. In the latter case, besides setting the group's name, server's address and the update only arguments, we also need to set the timeout argument as the XML-RPC does not support named/keyword arguments. For a complete list of commands available check the documentation or execute the following command:

mysqlfabric help commands

Currently the command-line solution has two issues:

We are working on fixing these as soon as possible.

Adding a server into a group

Users must set up replication on a new MySQL Server and inform MySQL Fabric about its existence as follows:

mysqlfabric group add group-name server-id --update_only

To avoid cluttering the post with unnecessary details, we are going to write examples using the command-line script. Note though that there are issues with this solution as aforementioned. The group-name and server-id must be replaced by the group which the server belongs to and its real UUID or address, respectively. The remove command does have the option --update_only as it only removes a reference to the server from the repository and does not try to access the server or reconfigure replication.

Promoting a new primary

If users want to promote a new primary, they must first demote the current one as follows:

mysqlfabric group demote group-name --update_only

After that, they should forbid any attempt to write to the old primary, make sure that the primary and secondaries are synchronized, elect a new primary and then reconfigure replication accordingly. How these is done depends on the particularities of their environments and scripts. Finally to inform the connectors that there is a new primary, they should execute the following:

mysqlfabric group promote group-name --slave_id=server-id --update_only

29 comments:

Unknown said...

Hey Alfranio, these My SQL codes were really useful. Thanks for the update.We have our own My SQL tutorials as well that may benefit your readers at https://www.linkedin.com/company/firebox-training

Jr. Williams said...

difference between sql server and mysql?
Unlimited MySQL Databases

Jr. Williams said...

Thanks for the update you have nicely covered this topic. keep it up
best domain name registrar

Haritha said...

Nice to see your blog post.. I really enjoyed by reading your blog post. Thanks a lot for sharing this with us.. Keep on sharing like this informative post.
Android Training in Chennai Velachery

deeksha said...

This is a great post! As a new blogger myself, I search for new ways to attract new people to read my blog.I know it takes time and dedication, and the most important thing is to do what you love no matter what!


salesforce Training instiute in Chennai

Maani kamili said...

I read a weblog, I hope that it doesn't sadden me as much as this one. I’m talking about, I know it was my selection to read, but I actually thought you'd have something interesting to say. Great work admin..

Web development company in Chennai

Unknown said...

I just see the post i am so happy the post of information's.So I have really enjoyed and reading your blogs for these posts.Any way I’ll be subscribing to your feed and I hope you post again soon.

aws training in chennai

smarther3 said...

Learning new technolgy would help oneself at hard part of their career. And staying updated is the only way to survive in current position. Your content tells the same. Thanks for sharing this information in here. Keep blogging like this. android Training in Chennai

Unknown said...

Hi I read your post very carefully and I think you are right that a well written post should be at least a 100 words and should capture the essence of your blog, book or article.

Digital Marketing Company in India

buyket said...



تتعدد الشركات التي تقدم خدمات ىالتنظيف لاكن لا يمكن ان تكون كلها في نفس مستوي الجوده فان كنت من الباحثين عن جودة الشركه قبل اي شئ اخر فانصحة بزيارة احدي تلك الصفحات
شركة تنظيف مساجد بالرياض
شركة تنظيف خزانات بالخرج
شركة تنظيف بالخرج
والتي تقدم افضل خدمات التنظيف بالمنزل باعلي مستوي من الكفائه

louis philip said...

These ways are very simple and very much useful, as a beginner level these helped me a lot thanks fore sharing these kinds of useful and knowledgeable information.
Texting API
Text message marketing
Digital Mobile Marketing
Mobile Marketing Services
Mobile marketing companies
Fitness SMS

Unknown said...

Here in I web technology we provide the best SEO and web development service in Faridabad. You can join us for the best and affordable Seo Service.

Seo Service Faridabad | Web Development Service Faridabad

Unknown said...

Ansha Khan is one of the hot and sizzling escorts in Bangalore offers exotic escorts services in Bangalore. Hire VIP escorts in Bangalore with hire profile background.
Bangalore escorts | Escorts in Bangalore

Unknown said...

Get the best escorts service in Bangalore from one of the top escort agency in Bangalore. We provide the Hot Bangalore Escorts, Independent Bangalore Escorts, VIP Bangalore Escorts, High Class Female escorts.
Bangalore Escorts Service

super hero said...

We at Strive 2 drive,driving school In Melbourne. Driving School in Melbourne!
is one of the best & safe driving school where you have an ease of access
to a wide array of special driving features. We are focused at your
comfort and so we have put together facilities within the site to ensure
that you get the very best. Driving School in Melbourne!

Desinelabs said...

Thanks for the information...
IoT Training in Bangalore | Internet of Things Course | IoT Course in Bangalore - Tecmax - Tecmax offers the Best IoT Training in Bangalore, We offer Real-Time Job Oriented IoT Training with Live Projects,
Our IoT (Internet of Things) Trainers are Working Professionals with 4+ years of Expertise in IoT, we also provide 100% Placement Assistance after IoT Course Completion.

Elegant IT Services said...

Thanks for sharing this informative post with us...
Python Course in Bangalore

sureshshetty said...

Thanks for this blog are more informative contents i n step by step. I here attached my site would you see this blog.

7 tips to start a career in digital marketing

“Digital marketing is the marketing of product or service using digital technologies, mainly on the Internet, but also including mobile phones, display advertising, and any other digital medium”. This is the definition that you would get when you search for the term “Digital marketing” in google. Let’s give out a simpler explanation by saying, “the form of marketing, using the internet and technologies like phones, computer etc”.

we have offered to the advanced syllabus course digital marketing for available

more details click the link now.

https://www.webdschool.com/digital-marketing-course-in-chennai.html

Ahmad Nur said...

SSC Result 2020 Published Date & Time by ssc result 2020
ssc result 2020
Education Board of Bangladesh.
Many of You Search For SSC Result Kobe Dibe on Internet
as Well as Facebook. The results of Secondary School Certificate
(SSC)—and its equivalent examinations—for 2020 have been published.
SSC & Dakhil Result 2020 Published Date is Very Important For T
he Students Who Attend The SSC Exam 2020.

abid said...

A good blog always comes-up with new and exciting information and while reading I have feel that this blog is really have all those quality that qualify a blog to be a one
machine learning course training in Guwahti

Unknown said...

Bayzat is redefining the work life experience,
health insurance dubai
medical insurance dubai
making automated HR, payroll, employee benefits and insurance a possibility for all businesses

Anurag Mohapatra said...

Python training in bangalore
Machine learning course in bangalore
Data Science Online Course in Bangalore
Learn Storage Automation (Using Python) in Bangalore BTM
Cloud Computing Training in Bangalore BTM

unknown said...

HVAC & Plumbing Services
Air Star Heating guarantees reliability and quality for all equipment and services.

Air Star Heating specialists always try to deliver the most excellent quality of services to our customers at an affordable price. It is understood that every client has different needs and different problems. We try to accomplish the needs of every client according to their requests. We are having considerable experience in this field. Our specialists understand very well how things work. It doesn’t matter in which field of industry you are looking for services.
Plumbing & HVAC Services in San Diego. Call now (858) 900-9977 ✓Licensed & Insured ✓Certified Experts ✓Same Day Appointment ✓Original Parts Only ✓Warranty On Every Job.
Visit:- https://airstarheating.com

All Education Result said...


National University is published the nu honours 4th year exam result 2021 on online. Students now can check the result from nu.ac.bd/results as well as examresulthub.com

linlin123 said...

nike huarache kobe bryant
camara digital olympus fe 340
Supeme Hoodie
welke scooter moet ik kopen
nike huarache og colorways
bimba y lola zapatos
adidas adizero ace boost 7
juguete avalancha apache
zapatillas de agua niña
tapie adidas credit lyonnais
sandalias rosa palo tacon ancho giro
sims 4 nike shoes kids
adidas real valladolid portero niño
nike metal swoosh cap white
sellerie moto strasbourg
robe voile manche longue une analyse
valentine gauthier chaussures
sacoche lv district
sfera vestido flecos mostaza
vestido de niña rosa palo
sandalias agua cerradas
eugenio campos pulseiras anjos
sandalia rafaela melo
scatola protezione stagna
scarpe nike air force modelli nuovi
cartera levis hombre
gucci handbags uk
nike air force alte zalando bianche bambini
zapatillas bimba y lola outlet
bolsos el potro segunda mano
nike free run 5.0 new
chaqueta adidas trefoil delantero
nike metcon 5 rojas
giacca da prestigiatore
triciclo usato milano
risparmiare batteria iphone ios 12
maglia termica nuoto bambina
shein camicie donna cameriera
venta de bicicletas para ejercicio

Cyberz Pc said...

I cant taking office on focusing long adequate to research; lots less write this rosy of article. Youve outdone your self as quickly as this cloth truely. it's miles one of the greatest contents. Game Maker Studio Download Free Full

Cyberz Pc said...

I go to your blog frequently and counsel it to the complete of folks who desired to feature-on happening their understanding subsequent to ease. The style of writing is exquisite and plus the content material is summit-notch. thanks for that perception you provide the readers! AVG Driver Updater Registration Key Free

Cyberz Pc said...

i'm incapable of reading articles online particularly frequently, however Im happy I did nowadays. it is selected adroitly written, and your points are adeptly-expressed. I demand you harmoniously, entertain, dont ever lower writing. X BF Birthday Wishes

softkeybox said...

I think it was the only site which can provide us a great and very informative stuff.
Freemake Video Convertor Serial

Vsdc Video Editor License Key

Nitro Pro Torrent