replication - lefred/mysqlshell-plugins GitHub Wiki

replication

NAME
      replication - Replication utilities.

DESCRIPTION
       A collection of tools and utilities to perform checks and fix  MySQL
      Replication Channel

methods

error

Get the eventual replication error

replication.error([session])
  • session: Object. The session to be used on the operation
 JS  replication.error()
replication_channel
 Applier error:
 2021-09-24 07:27:47.072324 : Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction 'b545b0e8-139e-11ec-b9ee-c8e0eb374015:133' at master log binlog.000015, end_log_pos 3362. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.
 2021-09-24 07:27:47.072328 : Worker 1 failed executing transaction 'b545b0e8-139e-11ec-b9ee-c8e0eb374015:133' at master log binlog.000015, end_log_pos 3362; Error 'Access denied; you need (at least one of) the RELOAD or FLUSH_STATUS privilege(s) for this operation' on query. Default database: 'test'. Query: 'flush status'

get_gtid_to_skip

Get the gtid that is breaking replication.

replication.get_gtid_to_skip([session])
  • session: Object. The session to be used on the operation
 JS  replication.get_gtid_to_skip()
+---------------------+------------------------------------------+
| channel_name        | gtid_to_skip                             |
+---------------------+------------------------------------------+
| replication_channel | b545b0e8-139e-11ec-b9ee-c8e0eb374015:133 |
+---------------------+------------------------------------------+

skip_error

Skip the current replication error.

replication.skip_error([session])
  • session: Object. The session to be used on the operation
 JS  replication.skip_error()
skiping b545b0e8-139e-11ec-b9ee-c8e0eb374015:133 for replication channel 'replication_channel'...

status

Get the replication status information

replication.status([extended][, format][, session])
  • extended: Bool - Use extended view. Default is False.
  • format: String - One of table, tabbed, vertical, json, ndjson, json/raw, json/array, json/pretty or flat. Flat is like an error log with colors. Default is table.
  • session: Object - The optional session object used to query the database. If omitted the MySQL Shell's current session will be used.
 JS  replication.status()
+---------------------+-----------+------------+------------+
| channel_name        | IO_thread | SQL_thread | lag_in_sec |
+---------------------+-----------+------------+------------+
| replication_channel | ON        | ON         | 0          |
+---------------------+-----------+------------+------------+
 
 JS  replication.status(true, "vertical")
*************************** 1. row ***************************
            channel_name: replication_channel
               IO_thread: ON
              SQL_thread: ON
 last_queued_transaction: b545b0e8-139e-11ec-b9ee-c8e0eb374015:140
last_applied_transaction: b545b0e8-139e-11ec-b9ee-c8e0eb374015:140
         rep delay (sec): 27297.936390
          transport time: 27297.886888
                 time RL: 0.000030
              apply time: 0.001145
              lag_in_sec: 0
*************************** 2. row ***************************
            channel_name: replication_channel
               IO_thread: ON
              SQL_thread: ON
 last_queued_transaction: b545b0e8-139e-11ec-b9ee-c8e0eb374015:140
last_applied_transaction: 
         rep delay (sec): 0
          transport time: 27297.886888
                 time RL: 0.000030
              apply time: 0.000000
              lag_in_sec: 0
*************************** 3. row ***************************
            channel_name: replication_channel
               IO_thread: ON
              SQL_thread: ON
 last_queued_transaction: b545b0e8-139e-11ec-b9ee-c8e0eb374015:140
last_applied_transaction: 
         rep delay (sec): 0
          transport time: 27297.886888
                 time RL: 0.000030
              apply time: 0.000000
              lag_in_sec: 0
*************************** 4. row ***************************
            channel_name: replication_channel
               IO_thread: ON
              SQL_thread: ON
 last_queued_transaction: b545b0e8-139e-11ec-b9ee-c8e0eb374015:140
last_applied_transaction: 
         rep delay (sec): 0
          transport time: 27297.886888
                 time RL: 0.000030
              apply time: 0.000000
              lag_in_sec: 0