Using the new MySQL Shell Reporting Framework to monitor InnoDB Cluster

With MySQL Shell 8.0.16, a new very interesting feature was released: the Reporting Framework.

Jesper already blogged about it and I recommend you to read his articles if you are interested in writing your own report:

  • https://mysql.wisborg.dk/2019/04/26/mysql-shell-8-0-16-built-in-reports/
  • https://mysql.wisborg.dk/2019/04/27/mysql-shell-8-0-16-user-defined-reports/

I this post, I will show you one user-defined report that can be used to monitor your MySQL InnoDB Cluster / Group Replication.

Preparation

Before being able to use the report, you need to download 2 files. The first one is the addition in systhat I often use to monitor MySQL InnoDB Cluster:

And the second one is the report:

Once downloaded, you can unzip them and install them:

On your Primary-Master run:

mysqlsh --sql clusteradmin@mysql1 < addition_to_sys_GR.sql

Now install the report on your MySQL Shell client’s machine:

$ mdkir -p ~/.mysqlsh/init.d
mv gr_info.py ~/.mysqlsh/init.d

Usage

Once installed, you just need to relaunch the Shell and you are ready to call the new report using the \show command:

Now let’s see the report in action when I block all writes on mysql2 with a FTWRL and call the report with \watch:

Conclusion

Yet another nice addition to MySQL Shell. With this report you can see which member still has quorum, how many transactions each nodes have to apply, …

Don’t hesitate to also share your reports too !

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

8 Comments

  1. using mysql shell 8.0.16

    try to use the report but getting below error

    IndexError: unknown attribute: sql

  2. JS > \show gr_info
    reports.gr_info: User-defined function threw an exception:
    Traceback (most recent call last):
    File “gr_info.py”, line 2, in gr_info
    query = session.sql(“select concat(member_host,’:’,member_port) as server, member_role as ‘role’, member_version as ‘version’, sys.gr_member_in_primary_partition() as ‘quorum’, Count_Transactions_Remote_In_Applier_Queue as ‘tx behind’, Count_Transactions_in_queue as ‘tx to cert’, count_transactions_remote_applied as ‘remote tx’, count_transactions_local_proposed as ‘local tx’ from performance_schema.replication_group_member_stats t1 join performance_schema.replication_group_members t2 on t2.member_id = t1.member_id”)
    AttributeError: unknown attribute: sql

    Please check

    • This error is because you are connected using the classic protocol and not MySQL X protocol (port 33060 by default). I should add a check.

Leave a Reply to MohsinCancel Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

As MySQL Community Manager, I am an employee of Oracle and the views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

You can find articles I wrote on Oracle’s blog.