MySQL Fabric – Faulty to Secondary


MySQL Fabric is a great tool for managing a farm of MySQL servers. In the last two posts you can see how High Availability Fail over and Sharding work. When things are working right, the group lookup_servers will look something like this:
server_uuid address status mode weight
------------------------------------ ----------- --------- ---------- ------
09d13be1-cdd0-11e4-8643-0800273b9c80 10.10.13.10 SECONDARY READ_ONLY 1.0
0f611996-cdd0-11e4-8643-0800273b9c80 10.10.13.20 SECONDARY READ_ONLY 1.0
11aae7e7-cdd0-11e4-8643-0800273b9c80 10.10.13.30 PRIMARY READ_WRITE 1.0

This is a three node farm with a PRIMARY for READ-WRITE operations and two SECONDARY servers for READ_ONLY.

But that about the times when one of the servers is not doing do great and shows up as FAULTY on a group lookup_servers or group health report?

uuid is_alive status is_not_running is_not_configured io_not_running sql_not_running io_error sql_error
------------------------------------ -------- --------- -------------- ----------------- -------------- --------------- -------- ---------
09d13be1-cdd0-11e4-8643-0800273b9c80 1 FAULTY 0 0 0 0 False False
0f611996-cdd0-11e4-8643-0800273b9c80 1 SECONDARY 0 0 0 0 False False
11aae7e7-cdd0-11e4-8643-0800273b9c80 1 PRIMARY 0 0 0 0 False False

Possible values for status are FAULTY, SPARE, SECONDARY, PRIMARY, or CONFIGURING. So how is good old server ’09d13be1-cdd0-11e4-8643-0800273b9c80′ changed from FAULTY to SECONDARY?

The path is not as simple as just setting the status to to SECONDARY. First the server must be marked SPARE with mysqlfabric server set_status 09d13be1-cdd0-11e4-8643-0800273b9c80 spare. Use group lookup_servers to note the change of ’09d13be1-cdd0-11e4-8643-0800273b9c80′ to SPARE.

server_uuid address status mode weight
------------------------------------ ----------- --------- ---------- ------
09d13be1-cdd0-11e4-8643-0800273b9c80 10.10.13.10 SPARE OFFLINE 1.0
0f611996-cdd0-11e4-8643-0800273b9c80 10.10.13.20 SECONDARY READ_ONLY 1.0
11aae7e7-cdd0-11e4-8643-0800273b9c80 10.10.13.30 PRIMARY READ_WRITE 1.0

Nut now the mode is OFFLINE. Now the status can be changed to SECONDARY.
mysqlfabric server set_status 09d13be1-cdd0-11e4-8643-0800273b9c80 secondary

And good old ’09d13be1-cdd0-11e4-8643-0800273b9c80′ is back as a happy, productive member of the farm.

Fabric UUID: 5ca1ab1e-a007-feed-f00d-cab3fe13249e
Time-To-Live: 1

server_uuid address status mode weight
------------------------------------ ----------- --------- ---------- ------
09d13be1-cdd0-11e4-8643-0800273b9c80 10.10.13.10 SECONDARY READ_ONLY 1.0
0f611996-cdd0-11e4-8643-0800273b9c80 10.10.13.20 SECONDARY READ_ONLY 1.0
11aae7e7-cdd0-11e4-8643-0800273b9c80 10.10.13.30 PRIMARY READ_WRITE 1.0

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s