Tag Archive for MySQL Utilities

MySQL Fabric/MySQL Utilities 1.4.4 released

MySQL Utilities & Fabric The binary and source versions of MySQL Utilities/MySQL Fabric have now been made available at http://dev.mysql.com/downloads/utilities/.

This release contains bug fixes and minor enhancements – full details can be found in the MySQL Fabric/MySQL Utilities release notes.





New replication & HA white papers

MySQLReplication and High Availability logoWith the General Availability of the standalone MySQL Utilities it now makes sense to use these to simplify (and optionally automate) your MySQL Replication and High Availability solutions. In light of that, 4 of our MySQL white papers have been updated to reflect the new opportunities:

MySQL Guide to High Availability Solutions. Data is the currency of today’s web, mobile, social, enterprise and cloud applications. Ensuring data is always available is a top priority for any organization – minutes of downtime will result in significant loss of revenue and reputation.

This Guide is designed to assist Developers, Architects and DBAs in navigating the complex waters of HA. It presents:

  • A methodology for selecting the right HA solution to meet Service Level Agreements
  • A tour of the leading certified HA solutions for MySQL
  • Operational best practices to implement and support HA

MySQL Replication: High Availability – Building a Self-Healing Replication Topology. Download the whitepaper to learn how to improve user-experience, reduce cost and innovate faster using MySQL replication.

Global Transaction Identifiers (GTIDs) are one of the core new features of MySQL 5.6 replication, providing a foundation to building self-healing, highly available data clusters.

By reading this whitepaper, you will be able to:

  • Illustrate use-cases and implementation of MySQL replication
  • Learn how High Availability (HA) with MySQL replication is achieved using GTIDs
  • Gain an overview of MySQL replication utilities
  • Discover resources for achieving HA with MySQL replication

The paper concludes with an overview of operational best practices.

MySQL Replication: An Introduction. Download the whitepaper to learn how MySQL replication enables the largest web, cloud, mobile and social applications to scale-out on commodity hardware, while reducing the risks of downtime.

The whitepaper discusses:

  • Replication concepts
  • Replication enhancements in MySQL 5.6
  • Replication use-cases
  • Replication topologies
  • Replication monitoring and management

The paper concludes with resources to get started with MySQL replication in building next generation services.

MySQL Replication Tutorial: Configuration, Provisioning and Management. Download the whitepaper for practical examples and best practices in building highly available services using MySQL replication as well as MySQL Utilities.

By reading this paper, you will be able to:

  • Configure and provision MySQL replication (with or without MySQL Utilities)
  • Migrate to semi-synchronous replication
  • Administer and trouble-shoot MySQL replication (with or without MySQL Utilities)
  • Promote a slave to be the new master in the event of a failed Master (manual or automatic, with or without MySQL Utilities

The paper concludes with additional resources to tune and optimize MySQL replication for your environment.





Standalone MySQL Utilities Now GA! Includes running mysqlfailover as a daemon

MySQL Utilities are now GA - logoWith the release of MySQL Utilities 1.3.4, the standalone (not bundled with the MySQL WorkBench GUI) package is now Generally Available and fully supported. This post will focus on a very important change (the ability to run as a daemon rather than in a terminal) to the mysqlfailover utility which allows you to build a light-weight HA database solution using MySQL Replication.

For a general overview of MySQL Utilities, take a look at this recent webinar or for a deeper dive into using them to setup replication and adding auto-failover of the master function to slaves watch this video and worked example.

When we first released the mysqlfailover utility, the reaction was very positive but the feedback also told us that to really use this to provide High Availability in a production system two enhancements were critical:

  1. The ability to not have the database password visible when someone queries the status of the process (for example, using the ps command). This was addressed by allowing the connection string to be specified using a login-path (referring to an entry in .mylogin.cnf – see https://dev.mysql.com/doc/refman/5.6/en/mysql-config-editor.html) in place of <user>[:<passwd>]@<host>. This is a vital security enhancement added in MySQL Utilities 1.3.1.
  2. Allowing mysqlfailover to be run as a daemon rather than being tied to the terminal from where it had to be manually launched. This option is key to enabling the user to build a reslient HA system that doesn’t rely on mysqlfailover being launched from a terminal and that terminal then never going away.

The rest of this post focuses on how to run mysqlfailover as a daemon.

By default, mysqlfailover runs as an interactive program within the terminal it was run from; it constantly refreshes, providing a summary of the status of the replication topology as shown below.

mysql@mini servers]$ mysqlfailover --master=root@192.168.1.101:5001 
  --discover-slaves-login=root --rediscover

MySQL Replication Failover Utility
Failover Mode = auto     Next Interval = Thu Aug  1 23:34:56 2013

Master Information
------------------
Binary Log File   Position  Binlog_Do_DB  Binlog_Ignore_DB
mini1-bin.000001  581

GTID Executed Set
1aca3d80-faf9-11e2-a214-0800272b8804:1-2

WARNING: Errant transaction(s) found on slave(s).
Replication Health Status
+----------------+-------+---------+--------+------------+---------+
| host           | port  | role    | state  | gtid_mode  | health  |
+----------------+-------+---------+--------+------------+---------+
| 192.168.1.101  | 5001  | MASTER  | UP     | ON         | OK      |
| 192.168.1.101  | 5002  | SLAVE   | UP     | ON         | OK      |
| 192.168.1.101  | 5003  | SLAVE   | UP     | ON         | OK      |
| 192.168.1.101  | 5004  | SLAVE   | UP     | ON         | OK      |
+----------------+-------+---------+--------+------------+---------+

Q-quit R-refresh H-health G-GTID Lists U-UUIDs

To run mysqlfailover as a daemon, the first new command-line option you must provide is –daemon=start; as you’d expect this runs the process as a daemon. In this mode, you won’t get to see the output from mysqlfailover at your terminal and so you should make sure that you know what log file is being used – so it’s best to specify it with –log=<path-to-log-file>. You can also control what information is periodically written to the log file using –report-values=<list-of-attributes from health,gtid,uuid>.  As you’ll likely to want to be able to manage the daemon without having to be in the same directory (and also likely to manage it from scripts that are automatically run when the server starts and stops) it makes sense to specify where the process ID file should be stored using –pid=<path-to-pid-file>.

The final incantation might look something like the following:

mysqlfailover --master=root@192.168.1.101:5001 
  --discover-slaves-login=root 
  --rediscover 
  --log=/home/mysql/servers/mysqlfailover.log 
  --pidfile=/home/mysql/servers/mysqlfailover.pid 
  --daemon=start 
  --report-values=health,gtid,uuid

and the resulting log file could then contain information such as this:

2013-08-02 01:10:34 AM INFO Getting health for master: 192.168.1.101:5001.
2013-08-02 01:10:35 AM INFO Health Status:
2013-08-02 01:10:35 AM INFO host: 192.168.1.101, port: 5001, role: MASTER, state: UP, gtid_mode: ON, health: OK
2013-08-02 01:10:35 AM INFO host: 192.168.1.101, port: 5002, role: SLAVE, state: UP, gtid_mode: ON, health: OK
2013-08-02 01:10:35 AM INFO host: 192.168.1.101, port: 5003, role: SLAVE, state: UP, gtid_mode: ON, health: OK
2013-08-02 01:10:35 AM INFO host: 192.168.1.101, port: 5004, role: SLAVE, state: UP, gtid_mode: ON, health: OK
2013-08-02 01:10:35 AM INFO GTID Status - Transactions executed on the servers:
2013-08-02 01:10:35 AM INFO host: 192.168.1.101, port: 5001, role: MASTER, gtid: 1aca3d80-faf9-11e2-a214-0800272b8804:1-2
2013-08-02 01:10:35 AM INFO host: 192.168.1.101, port: 5002, role: SLAVE, gtid: 1aca3d80-faf9-11e2-a214-0800272b8804:1-2
2013-08-02 01:10:35 AM INFO host: 192.168.1.101, port: 5002, role: SLAVE, gtid: 1db19050-faf9-11e2-a214-0800272b8804:1
2013-08-02 01:10:35 AM INFO host: 192.168.1.101, port: 5003, role: SLAVE, gtid: 1aca3d80-faf9-11e2-a214-0800272b8804:1-2
2013-08-02 01:10:35 AM INFO host: 192.168.1.101, port: 5003, role: SLAVE, gtid: 200f8139-faf9-11e2-a214-0800272b8804:1
2013-08-02 01:10:35 AM INFO host: 192.168.1.101, port: 5004, role: SLAVE, gtid: 1aca3d80-faf9-11e2-a214-0800272b8804:1-2
2013-08-02 01:10:35 AM INFO host: 192.168.1.101, port: 5004, role: SLAVE, gtid: 22842441-faf9-11e2-a214-0800272b8804:1
2013-08-02 01:10:35 AM INFO UUID Status:
2013-08-02 01:10:35 AM INFO host: 192.168.1.101, port: 5001, role: MASTER, uuid: 1aca3d80-faf9-11e2-a214-0800272b8804
2013-08-02 01:10:35 AM INFO host: 192.168.1.101, port: 5002, role: SLAVE, uuid: 1db19050-faf9-11e2-a214-0800272b8804
2013-08-02 01:10:35 AM INFO host: 192.168.1.101, port: 5003, role: SLAVE, uuid: 200f8139-faf9-11e2-a214-0800272b8804
2013-08-02 01:10:35 AM INFO host: 192.168.1.101, port: 5004, role: SLAVE, uuid: 22842441-faf9-11e2-a214-0800272b8804

As you’d expect, you can also stop the daemon:

mysqlfailover 
    --log=/home/mysql/servers/mysqlfailover.log 
    --pidfile=/home/mysql/servers/mysqlfailover.pid 
    --daemon=stop

and restart it:

mysqlfailover 
    --log=/home/mysql/servers/mysqlfailover.log 
    --pidfile=/home/mysql/servers/mysqlfailover.pid 
    --daemon=restart

The final option for daemon= is daemon=nodetach which is like start but the terminal that it’s run from will continue to view the output from the daemon.

One thing to note is that when the server is restarted, mysqlfailover needs to be started again and this is not something that is automatically configured when you run it as a daemon – rather, it’s your responsibility to ensure that it’s restarted (for example, including it in an init script.

Please try it out and (as always) let us know how you get on – the addition of these extra options is a direct result of the user feedback received for the earlier versions.





MySQL Utilities Webinar – Q&A + replay now available

MySQL Utilities logoDr Charles Bell and I recently presented a webinar on MySQL Utilities; there was a heavy focus on what you can acheive with them and how you should use them. In case you couldn’t attend or want to listen to some of the details again, the replay from that webinar is available here.

Abstract:

MySQL Utilities provide a collection of command-line utilities that are used for maintaining and administering MySQL databases, including:

  • Admin Utilities (Clone, Copy, Compare, Diff, Export, Import)
  • Replication Utilities (Setup, Configuration, Automated Slave Promotion)
  • General Utilities (Disk Usage, Redundant Indexes, Search Meta Data)

Andrew Morgan and Chuck Bell will guide you through these utilities, and many more, explaining what you can gain from these tools and how to use them (for example how a single command repeatedly checks your master server and in the event it fails, automatically promotes one of the slaves to be the new master).

Question & Answer Summary:

  • Using these utilities, can we export/import routines’ source as well? Yes.
  • I generally run multi-master behind a proxy (haproxy). I was wondering if the replication check would work. But I guess mysql still does not support multi-master or ring replcation. It depends on want you intend to do exactly. There are some limitation, but we intend to improve the utilities over time. So, just test the utilities on your environment and your are welcome to share your feedback with us.
  • Do you need the python connector if you have the utilities on workbench? No, it is bundled as part of WB.
  • What does “mysqluserclone” do that “SHOW GRANTS FOR USER” doesn’t do? It actually creates the users, clone them and not simply show its privileges like SHOW GRANTS. You can find more details here.
  • With mysqlfailover can I set a sequence to swith specific order if a fail occurs with the master? Yes, you can. It will follow the sequence of the defined candidates.
  • Can I run mysqlfailover on a independent server that check the master and their slave servers or it can run on the master or slave servers (mandatory)? Running on an independent server is ideal. After all, you don’t want it to disappear when the master’s host fails.
  • How many MySQL instances can I manage with mysqlfailover, I mean there is possible to check more than one array with the same independent server? With one mysqlfailover instance you can monitor one topology, i.e. one master and all its slaves. If you have more than one topology (using a different master) you can use a mysqlfailover instance to monitor each one.
  • If a master goes down and replication failover is successful, how hard is it to bring that old master back into the fold, assuming it was just a network disruption? You can use mysqlreplicate to set the old master as a slave of the new master resulted by the failover, that will update the old master. then you can use mysqlrpladmin to switchover the just added slave, to make it a master again, that back your original replication setup.
  • Can mysqlprocgrep log what it kills? There is no option to log what it is done. But you can redirect the utility output if it contains the information you need.
  • How does mysqldbcompare handle auto-increment columns? It will find the difference between auto_increment values. So, currently if it is different it will identify the difference. You will get the difference, as: changed or missing rows are shown in a standard format of GRID, CSV, TAB, or VERTICAL. you can choose in which format you want to get the difference.
  • I use Pacemaker/Corosync to achieve failover. Is mysqlfailover suitable for use in that context? Do I need to add extra logic around it, some wrapper script? If so, does Oracle provide a ready-made scripts for Pacemaker/Corosync? mysqlfailover was designed to work independently, and provides some functionalities that may help with the integration with other systems (like the possibility to execute external pre- pos- failover scripts). We do not have a ready-made script for Pacemaker/Corosync. For more information check here.
  • How long are the frm files kept if the database is corrupt or was deleted. The .frm files are not removed in any way. So there is no deletion or removal of the .frm files. The .frm files are an integral part of the server and stored in the datadir.
  • Can mysqlserverclone clone instances between separate servers? Using SSH? mysqlserverclone, starts a new instance, that mimics a running server or a offline server by taking a look to his configuration, but to copy objects like tables, to another instance you need to use mysqldbcopy. We do not currently support SSH. If you see this as a much needed feature, please open a feature request via bugs.mysql.com. That will help us understand the need and urgency.

 





MySQL Utilities Webinar

MySQL Utilities logoOn Thursday, Dr Charles Bell and I will be presenting a webinar on MySQL Utilities; there will be a heavy focus on what you can acheive with them and how you should use them. As well as listening to the presentation, this is a great chance to get your questions answered by the experts (Israel Gomez from the engineering team will also be on-line to help with the questions). As always, the webinar is free but you should register in advance here. If the time isn’t convenient, register anyway and you’ll be sent a link to the replay when it’s available.

Abstract:

MySQL Utilities provide a collection of command-line utilities that are used for maintaining and administering MySQL databases, including:

  • Admin Utilities (Clone, Copy, Compare, Diff, Export, Import)
  • Replication Utilities (Setup, Configuration, Automated Slave Promotion)
  • General Utilities (Disk Usage, Redundant Indexes, Search Meta Data)

Andrew Morgan and Chuck Bell will guide you through these utilities, and many more, explaining what you can gain from these tools and how to use them (for example how a single command repeatedly checks your master server and in the event it fails, automatically promotes one of the slaves to be the new master). This is your opportunity to listen to the development lead describe what he and his team have created, and to get your questions answered by the experts.

WHO:
Andrew Morgan, Principal Product Manager
Chuck Bell, Software Development Manager

WHEN:
Thu, Jul 18: 09:00 Pacific time (America)
Thu, Jul 18: 10:00 Mountain time (America)
Thu, Jul 18: 11:00 Central time (America)
Thu, Jul 18: 12:00 Eastern time (America)
Thu, Jul 18: 16:00 UTC
Thu, Jul 18: 17:00 Western European time
Thu, Jul 18: 18:00 Central European time
Thu, Jul 18: 19:00 Eastern European time
Thu, Jul 18: 21:30 India, Sri Lanka
Fri, Jul 19: 00:00 Singapore/Malaysia/Philippines time
Fri, Jul 19: 00:00 China time
Fri, Jul 19: 01:00 日本
Fri, Jul 19: 02:00 NSW, ACT, Victoria, Tasmania (Australia)

The presentation will be approximately 60 minutes long followed by Q&A.