if $self->show_slaves_via_processlist; $slave = 1 if ($self->instance->show_slave_status && $self->instance->show_slave_status->[0]); $cluster= 1 if defined($self->instance->i_am_group_replication_primary); ### Restore param $self->instance->{_ignore_unsupport_version}= $saved_ignore; ### SHOW SLAVE STATUS condition is advanced more than cluster. if ($slave) { ### Intermidiate-master in a cascaded replication toporogy. return "intermidiate" if $master; return "slave"; } elsif ($cluster) { return "group_replication"; } else { return "master"; } https://github.com/yoku0825/ytkit/blob/0.5.0/lib/Ytkit/ HealthCheck.pm#L217-L249 17/59
| Value | +-------------------+-------+ | Threads_connected | 3 | +-------------------+-------+ 1 row in set (0.03 sec) mysql> SHOW GLOBAL VARIABLES LIKE 'max_connections'; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | max_connections | 151 | +-----------------+-------+ 1 row in set (0.00 sec) 26/59
STATUS LIKE 'Uptime'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | Uptime | 72615 | +---------------+-------+ 1 row in set (0.08 sec) 34/59
「適用待ちトランザクションキューの数」と「最後にコミットされたトランザクションの時間 差」を計算 ‐ ### How many commits not yet applied. my $trx_lag= $self->instance->replication_group_member_stats->[0]->{count_transactions_re mote_in_applier_queue}; ### How many seconds between "STARTING APPLY" and "COMMITTED ORIGINAL" my $applier_time_lag= $self->instance->replication_applier_status->{group_replication_app lier}->{_diff} // 0; https://github.com/yoku0825/ytkit/blob/0.5.0/lib/Ytkit/ HealthCheck.pm#L773-L804 39/59
node is entering RECOVERING state, mysqlrouter is devide node from load-balancing, ### Group Replication lag is not matter. if ($self->instance->i_am_group_replication_recovering) { ### Change critical threshold to supernum to fall back as WARNING $self->{group_replication_lag_transactions}->{critical}= 2 ** 63 - 1; $self->{group_replication_lag_seconds}->{critical}= 2 ** 63 - 1; } https://github.com/yoku0825/ytkit/blob/0.5.0/lib/Ytkit/ HealthCheck.pm#L773-L804 40/59