This commit is contained in:
Jean-Marie Renouard 2022-07-09 19:34:27 +02:00
commit 07cfdafaa7
3 changed files with 388 additions and 176 deletions

View file

@ -1,6 +1,6 @@
# NAME # NAME
MySQLTuner 1.9.4 - MySQL High Performance Tuning Script MySQLTuner2.0.5 - MySQL High Performance Tuning Script
# IMPORTANT USAGE GUIDELINES # IMPORTANT USAGE GUIDELINES
@ -65,8 +65,8 @@ You must provide the remote server's total memory when connecting to other serve
--pfstat Print Performance schema --pfstat Print Performance schema
--nopfstat Don't Print Performance schema --nopfstat Don't Print Performance schema
--bannedports Ports banned separated by comma (,) --bannedports Ports banned separated by comma (,)
--server-log Define specifi error_log to analyze --server-log Define specific error_log to analyze
--maxportallowed Number of ports opened allowed on this hosts --maxportallowed Number of ports opened allowed on this host
--buffers Print global and per-thread buffer values --buffers Print global and per-thread buffer values
# PERLDOC # PERLDOC

View file

@ -1,5 +1,5 @@
#!/usr/bin/env perl #!/usr/bin/env perl
# mysqltuner.pl - Version 2.0.4 # mysqltuner.pl - Version2.0.5
# High Performance MySQL Tuning Script # High Performance MySQL Tuning Script
# Copyright (C) 2006-2022 Major Hayden - major@mhtx.net # Copyright (C) 2006-2022 Major Hayden - major@mhtx.net
# Copyright (C) 2015-2022 Jean-Marie Renouard - jmrenouard@gmail.com # Copyright (C) 2015-2022 Jean-Marie Renouard - jmrenouard@gmail.com
@ -655,7 +655,7 @@ sub update_tuner_version {
else { else {
badprint "Couldn't update MySQLTuner script"; badprint "Couldn't update MySQLTuner script";
} }
infoprint "Stopping program: MySQLTuner has be updated."; infoprint "Stopping program: MySQLTuner script must be updated first.";
exit 0; exit 0;
} }
@ -1174,7 +1174,7 @@ sub get_all_vars {
$dummyselect = select_one "SELECT VERSION()"; $dummyselect = select_one "SELECT VERSION()";
if ( not defined($dummyselect) or $dummyselect eq "" ) { if ( not defined($dummyselect) or $dummyselect eq "" ) {
badprint badprint
"You probably did not get enough privileges for running MySQLTuner ..."; "You probably do not have enough privileges to run MySQLTuner ...";
exit(256); exit(256);
} }
$dummyselect =~ s/(.*?)\-.*/$1/; $dummyselect =~ s/(.*?)\-.*/$1/;
@ -1359,7 +1359,8 @@ sub log_file_recommendations {
subheaderprint "Log file Recommendations"; subheaderprint "Log file Recommendations";
if ( "$myvar{'log_error'}" eq "stderr" ) { if ( "$myvar{'log_error'}" eq "stderr" ) {
badprint "log_error is set to $myvar{'log_error'}, but this script can't read stderr"; badprint
"log_error is set to $myvar{'log_error'}, but this script can't read stderr";
return; return;
} }
elsif ( $myvar{'log_error'} =~ /^(docker|podman|kubectl):(.*)/ ) { elsif ( $myvar{'log_error'} =~ /^(docker|podman|kubectl):(.*)/ ) {
@ -1513,7 +1514,7 @@ sub cve_recommendations {
if ( $mysqlvermajor eq 5 and $mysqlverminor eq 5 ) { if ( $mysqlvermajor eq 5 and $mysqlverminor eq 5 ) {
infoprint infoprint
"False positive CVE(s) for MySQL and MariaDB 5.5.x can be found."; "False positive CVE(s) for MySQL and MariaDB 5.5.x can be found.";
infoprint "Check careful each CVE for those particular versions"; infoprint "Check carefully each CVE for those particular versions";
} }
badprint $cvefound . " CVE(s) found for your MySQL release."; badprint $cvefound . " CVE(s) found for your MySQL release.";
push( @generalrec, push( @generalrec,
@ -1873,7 +1874,7 @@ sub system_recommendations {
. scalar @opened_ports . scalar @opened_ports
. " listening port(s) on this server."; . " listening port(s) on this server.";
if ( scalar(@opened_ports) > $opt{'maxportallowed'} ) { if ( scalar(@opened_ports) > $opt{'maxportallowed'} ) {
badprint "There is too many listening ports: " badprint "There are too many listening ports: "
. scalar(@opened_ports) . scalar(@opened_ports)
. " opened > " . " opened > "
. $opt{'maxportallowed'} . $opt{'maxportallowed'}
@ -1883,7 +1884,7 @@ sub system_recommendations {
); );
} }
else { else {
goodprint "There is less than " goodprint "There are less than "
. $opt{'maxportallowed'} . $opt{'maxportallowed'}
. " opened ports on this server."; . " opened ports on this server.";
} }
@ -1945,21 +1946,25 @@ sub security_recommendations {
debugprint "Password column = $PASS_COLUMN_NAME"; debugprint "Password column = $PASS_COLUMN_NAME";
# IS THERE A ROLE COLUMN # IS THERE A ROLE COLUMN
my $is_role_column = select_one "select count(*) from information_schema.columns where TABLE_NAME='user' AND TABLE_SCHEMA='mysql' and COLUMN_NAME='IS_ROLE'"; my $is_role_column = select_one
"select count(*) from information_schema.columns where TABLE_NAME='user' AND TABLE_SCHEMA='mysql' and COLUMN_NAME='IS_ROLE'";
my $extra_user_condition = ""; my $extra_user_condition = "";
$extra_user_condition = "IS_ROLE = 'N' AND" if $is_role_column > 0; $extra_user_condition = "IS_ROLE = 'N' AND" if $is_role_column > 0;
my @mysqlstatlist; my @mysqlstatlist;
if ( $is_role_column > 0 ) { if ( $is_role_column > 0 ) {
@mysqlstatlist= select_array "SELECT CONCAT(QUOTE(user), '\@', QUOTE(host)) FROM mysql.user WHERE IS_ROLE='Y'"; @mysqlstatlist = select_array
"SELECT CONCAT(QUOTE(user), '\@', QUOTE(host)) FROM mysql.user WHERE IS_ROLE='Y'";
foreach my $line ( sort @mysqlstatlist ) { foreach my $line ( sort @mysqlstatlist ) {
chomp($line); chomp($line);
infoprint "User $line is User Role"; infoprint "User $line is User Role";
} }
} else { }
else {
debugprint "No Role user detected"; debugprint "No Role user detected";
goodprint "No Role user detected"; goodprint "No Role user detected";
} }
# Looking for Anonymous users # Looking for Anonymous users
@mysqlstatlist = select_array @mysqlstatlist = select_array
"SELECT CONCAT(QUOTE(user), '\@', QUOTE(host)) FROM mysql.user WHERE $extra_user_condition (TRIM(USER) = '' OR USER IS NULL)"; "SELECT CONCAT(QUOTE(user), '\@', QUOTE(host)) FROM mysql.user WHERE $extra_user_condition (TRIM(USER) = '' OR USER IS NULL)";
@ -1985,7 +1990,7 @@ sub security_recommendations {
} }
if ( mysql_version_le( 5, 1 ) ) { if ( mysql_version_le( 5, 1 ) ) {
badprint "No more password checks for MySQL version <=5.1"; badprint "No more password checks for MySQL version <=5.1";
badprint "MySQL version <=5.1 are deprecated and end of support."; badprint "MySQL version <=5.1 is deprecated and end of support.";
return; return;
} }
@ -2093,7 +2098,7 @@ q{SELECT CONCAT(QUOTE(user), '@', QUOTE(host)) FROM mysql.global_priv WHERE
. $pass . $pass
. "', 2, LENGTH('" . "', 2, LENGTH('"
. $pass . "'))))"; . $pass . "'))))";
debugprint "There is " . scalar(@mysqlstatlist) . " items."; debugprint "There are " . scalar(@mysqlstatlist) . " items.";
if (@mysqlstatlist) { if (@mysqlstatlist) {
foreach my $line (@mysqlstatlist) { foreach my $line (@mysqlstatlist) {
chomp($line); chomp($line);
@ -2135,14 +2140,22 @@ sub get_replication_status {
infoprint "Semi synchronous replication Master: " infoprint "Semi synchronous replication Master: "
. ( . (
( defined( $myvar{'rpl_semi_sync_master_enabled'} ) or defined( $myvar{'rpl_semi_sync_source_enabled'} ) ) (
? ( $myvar{'rpl_semi_sync_master_enabled'} // $myvar{'rpl_semi_sync_source_enabled'} ) defined( $myvar{'rpl_semi_sync_master_enabled'} )
or defined( $myvar{'rpl_semi_sync_source_enabled'} )
)
? ( $myvar{'rpl_semi_sync_master_enabled'}
// $myvar{'rpl_semi_sync_source_enabled'} )
: 'Not Activated' : 'Not Activated'
); );
infoprint "Semi synchronous replication Slave: " infoprint "Semi synchronous replication Slave: "
. ( . (
( defined( $myvar{'rpl_semi_sync_slave_enabled'} ) or defined( $myvar{'rpl_semi_sync_replica_enabled'} ) ) (
? ( $myvar{'rpl_semi_sync_slave_enabled'} // $myvar{'rpl_semi_sync_replica_enabled'} ) defined( $myvar{'rpl_semi_sync_slave_enabled'} )
or defined( $myvar{'rpl_semi_sync_replica_enabled'} )
)
? ( $myvar{'rpl_semi_sync_slave_enabled'}
// $myvar{'rpl_semi_sync_replica_enabled'} )
: 'Not Activated' : 'Not Activated'
); );
if ( scalar( keys %myrepl ) == 0 and scalar( keys %myslaves ) == 0 ) { if ( scalar( keys %myrepl ) == 0 and scalar( keys %myslaves ) == 0 ) {
@ -2156,13 +2169,15 @@ sub get_replication_status {
} }
$result{'Replication'}{'status'} = \%myrepl; $result{'Replication'}{'status'} = \%myrepl;
my ($io_running) = $myrepl{'Slave_IO_Running'} // $myrepl{'Replica_IO_Running'}; my ($io_running) = $myrepl{'Slave_IO_Running'}
// $myrepl{'Replica_IO_Running'};
debugprint "IO RUNNING: $io_running "; debugprint "IO RUNNING: $io_running ";
my ($sql_running) = $myrepl{'Slave_SQL_Running'} // $myrepl{'Replica_SQL_Running'}; my ($sql_running) = $myrepl{'Slave_SQL_Running'}
// $myrepl{'Replica_SQL_Running'};
debugprint "SQL RUNNING: $sql_running "; debugprint "SQL RUNNING: $sql_running ";
my ($seconds_behind_master) = $myrepl{'Seconds_Behind_Master'}
my ($seconds_behind_master) = $myrepl{'Seconds_Behind_Master'} // $myrepl{'Seconds_Behind_Source'} ; // $myrepl{'Seconds_Behind_Source'};
$seconds_behind_master = 1000000 unless defined($seconds_behind_master); $seconds_behind_master = 1000000 unless defined($seconds_behind_master);
debugprint "SECONDS : $seconds_behind_master "; debugprint "SECONDS : $seconds_behind_master ";
@ -2209,18 +2224,20 @@ sub validate_mysql_version {
or mysql_version_eq( 10, 5 ) or mysql_version_eq( 10, 5 )
or mysql_version_eq( 10, 6 ) or mysql_version_eq( 10, 6 )
or mysql_version_eq( 10, 7 ) or mysql_version_eq( 10, 7 )
or mysql_version_eq( 10, 8 ) or mysql_version_eq( 10, 8 ) )
)
{ {
goodprint "Currently running supported MySQL version " goodprint "Currently running supported MySQL version "
. $myvar{'version'} . ""; . $myvar{'version'} . "";
return; return;
} else { }
else {
badprint "Your MySQL version " badprint "Your MySQL version "
. $myvar{'version'} . $myvar{'version'}
. " is EOL software! Upgrade soon!"; . " is EOL software. Upgrade soon!";
push ( @generalrec, "You are using n unsupported version for production environments"); push( @generalrec,
push ( @generalrec, "Upgrade as soon as possible to a supported version !"); "You are using an unsupported version for production environments" );
push( @generalrec,
"Upgrade as soon as possible to a supported version !" );
} }
} }
@ -2516,9 +2533,9 @@ sub check_storage_engines {
&& defined $myvar{'have_isam'} && defined $myvar{'have_isam'}
&& $myvar{'have_isam'} eq "YES" ) && $myvar{'have_isam'} eq "YES" )
{ {
badprint "MYISAM is enabled but isn't being used"; badprint "MyISAM is enabled but isn't being used";
push( @generalrec, push( @generalrec,
"Add skip-isam to MySQL configuration to disable ISAM (MySQL > 4.1.0)" "Add skip-isam to MySQL configuration to disable MyISAM (MySQL > 4.1.0)"
); );
} }
@ -2590,7 +2607,6 @@ sub check_storage_engines {
} }
} }
} }
} }
my %mycalc; my %mycalc;
@ -2860,7 +2876,6 @@ sub calculations {
) )
); );
} }
} }
else { else {
$mycalc{'table_cache_hit_rate'} = 100; $mycalc{'table_cache_hit_rate'} = 100;
@ -3188,6 +3203,7 @@ sub mysql_stats {
infoprint infoprint
"Skipped name resolution test due to missing skip_name_resolve in system variables."; "Skipped name resolution test due to missing skip_name_resolve in system variables.";
} }
#Cpanel and Skip name resolve #Cpanel and Skip name resolve
elsif ( -r "/usr/local/cpanel/cpanel" ) { elsif ( -r "/usr/local/cpanel/cpanel" ) {
if ( $result{'Variables'}{'skip_name_resolve'} ne 'OFF' ) { if ( $result{'Variables'}{'skip_name_resolve'} ne 'OFF' ) {
@ -3195,13 +3211,15 @@ sub mysql_stats {
} }
if ( $result{'Variables'}{'skip_name_resolve'} eq 'OFF' ) { if ( $result{'Variables'}{'skip_name_resolve'} eq 'OFF' ) {
badprint "CPanel and Flex system skip-name-resolve should be on"; badprint "CPanel and Flex system skip-name-resolve should be on";
push (@generalrec, "name resolution is enabled due to cPanel doesn't support this disabled."); push( @generalrec,
"name resolution is enabled due to cPanel doesn't support this disabled."
);
push( @adjvars, "skip-name-resolve=0" ); push( @adjvars, "skip-name-resolve=0" );
} }
} }
elsif ( $result{'Variables'}{'skip_name_resolve'} eq 'OFF' ) { elsif ( $result{'Variables'}{'skip_name_resolve'} eq 'OFF' ) {
badprint badprint
"Name resolution is active: a reverse name resolution is made for each new connection and can reduce performance"; "Name resolution is active: a reverse name resolution is made for each new connection which can reduce performance";
push( @generalrec, push( @generalrec,
"Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1" "Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1"
); );
@ -3470,7 +3488,7 @@ sub mysql_stats {
"This is MyISAM only table_cache scalability problem, InnoDB not affected." "This is MyISAM only table_cache scalability problem, InnoDB not affected."
); );
push( @generalrec, push( @generalrec,
"See more details here: https://bugs.mysql.com/bug.php?id=49177" "For more details see: https://bugs.mysql.com/bug.php?id=49177"
); );
push( @generalrec, push( @generalrec,
"This bug already fixed in MySQL 5.7.9 and newer MySQL versions." "This bug already fixed in MySQL 5.7.9 and newer MySQL versions."
@ -3619,16 +3637,16 @@ sub mysql_stats {
sub mysql_myisam { sub mysql_myisam {
subheaderprint "MyISAM Metrics"; subheaderprint "MyISAM Metrics";
if ( mysql_version_ge(8) and mysql_version_le(10) ) { if ( mysql_version_ge(8) and mysql_version_le(10) ) {
infoprint "MyISAM Metrics are disabled on last MySQL versions."; infoprint "MyISAM Metrics are disabled since MySQL 8.0.";
if ( $myvar{'key_buffer_size'} > 0 ) { if ( $myvar{'key_buffer_size'} > 0 ) {
push( @adjvars, "key_buffer_size=0" ); push( @adjvars, "key_buffer_size=0" );
push( @generalrec, "Buffer Key MyISAM set to 0, no MyISAM table detected" ); push( @generalrec,
"Buffer Key MyISAM set to 0, no MyISAM table detected" );
} }
return; return;
} }
my $nb_myisam_tables = select_one( my $nb_myisam_tables = select_one(
"SELECT COUNT(*) FROM information_schema.TABLES WHERE ENGINE='MyISAM'" "SELECT COUNT(*) FROM information_schema.TABLES WHERE ENGINE='MyISAM'");
);
if ( $nb_myisam_tables == 0 ) { if ( $nb_myisam_tables == 0 ) {
infoprint "No MyISAM table(s) detected ...."; infoprint "No MyISAM table(s) detected ....";
return; return;
@ -3823,13 +3841,13 @@ sub mariadb_threadpool {
if ( $myvar{'thread_pool_size'} < 4 or $myvar{'thread_pool_size'} > 8 ) if ( $myvar{'thread_pool_size'} < 4 or $myvar{'thread_pool_size'} > 8 )
{ {
badprint badprint
"thread_pool_size between 4 and 8 when using MyIsam storage engine."; "thread_pool_size between 4 and 8 when using MyISAM storage engine.";
push( @generalrec, push( @generalrec,
"Thread pool size for MyIsam usage (" "Thread pool size for MyISAM usage ("
. $myvar{'thread_pool_size'} . $myvar{'thread_pool_size'}
. ")" ); . ")" );
push( @adjvars, push( @adjvars,
"thread_pool_size between 4 and 8 for MyIsam usage" ); "thread_pool_size between 4 and 8 for MyISAM usage" );
} }
else { else {
goodprint goodprint
@ -3862,8 +3880,7 @@ sub mysqsl_pfs {
badprint "Performance_schema should be activated."; badprint "Performance_schema should be activated.";
push( @adjvars, "performance_schema=ON" ); push( @adjvars, "performance_schema=ON" );
push( @generalrec, push( @generalrec,
"Performance schema should be activated for better diagnostics" "Performance schema should be activated for better diagnostics" );
);
} }
if ( $myvar{'performance_schema'} eq 'ON' ) { if ( $myvar{'performance_schema'} eq 'ON' ) {
infoprint "Performance_schema is activated."; infoprint "Performance_schema is activated.";
@ -3872,7 +3889,7 @@ sub mysqsl_pfs {
} }
unless ( grep /^sys$/, select_array("SHOW DATABASES") ) { unless ( grep /^sys$/, select_array("SHOW DATABASES") ) {
infoprint "Sys schema isn't installed."; infoprint "Sys schema is not installed.";
push( @generalrec, push( @generalrec,
"Consider installing Sys schema from https://github.com/mysql/mysql-sys for MySQL" "Consider installing Sys schema from https://github.com/mysql/mysql-sys for MySQL"
) unless ( mysql_version_le( 5, 6 ) ); ) unless ( mysql_version_le( 5, 6 ) );
@ -4684,7 +4701,7 @@ sub mysqsl_pfs {
#schema_index_statistics #schema_index_statistics
# TOP 15 most read index # TOP 15 most read index
subheaderprint "Performance schema: TOP 15 most read indexes"; subheaderprint "Performance schema: Top 15 most read indexes";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -4774,7 +4791,7 @@ sub mysqsl_pfs {
if ( $nbL == 1 ); if ( $nbL == 1 );
# TOP 15 most read tables # TOP 15 most read tables
subheaderprint "Performance schema: TOP 15 most read tables"; subheaderprint "Performance schema: Top 15 most read tables";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -4974,7 +4991,7 @@ sub mysqsl_pfs {
infoprint "No information found or indicators deactivated." infoprint "No information found or indicators deactivated."
if ( $nbL == 1 ); if ( $nbL == 1 );
subheaderprint "Performance schema: TOP 15 reader queries (95% percentile)"; subheaderprint "Performance schema: Top 15 reader queries (95% percentile)";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -4989,7 +5006,7 @@ sub mysqsl_pfs {
if ( $nbL == 1 ); if ( $nbL == 1 );
subheaderprint subheaderprint
"Performance schema: TOP 15 most row look queries (95% percentile)"; "Performance schema: Top 15 most row look queries (95% percentile)";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -5004,7 +5021,7 @@ sub mysqsl_pfs {
if ( $nbL == 1 ); if ( $nbL == 1 );
subheaderprint subheaderprint
"Performance schema: TOP 15 total latency queries (95% percentile)"; "Performance schema: Top 15 total latency queries (95% percentile)";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -5019,7 +5036,7 @@ sub mysqsl_pfs {
if ( $nbL == 1 ); if ( $nbL == 1 );
subheaderprint subheaderprint
"Performance schema: TOP 15 max latency queries (95% percentile)"; "Performance schema: Top 15 max latency queries (95% percentile)";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -5034,7 +5051,7 @@ sub mysqsl_pfs {
if ( $nbL == 1 ); if ( $nbL == 1 );
subheaderprint subheaderprint
"Performance schema: TOP 15 average latency queries (95% percentile)"; "Performance schema: Top 15 average latency queries (95% percentile)";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -5076,7 +5093,7 @@ sub mysqsl_pfs {
infoprint "No information found or indicators deactivated." infoprint "No information found or indicators deactivated."
if ( $nbL == 1 ); if ( $nbL == 1 );
subheaderprint "Performance schema: TOP 15 row sorting queries with sort"; subheaderprint "Performance schema: Top 15 row sorting queries with sort";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -5090,7 +5107,7 @@ sub mysqsl_pfs {
infoprint "No information found or indicators deactivated." infoprint "No information found or indicators deactivated."
if ( $nbL == 1 ); if ( $nbL == 1 );
subheaderprint "Performance schema: TOP 15 total latency queries with sort"; subheaderprint "Performance schema: Top 15 total latency queries with sort";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -5104,7 +5121,7 @@ sub mysqsl_pfs {
infoprint "No information found or indicators deactivated." infoprint "No information found or indicators deactivated."
if ( $nbL == 1 ); if ( $nbL == 1 );
subheaderprint "Performance schema: TOP 15 merge queries with sort"; subheaderprint "Performance schema: Top 15 merge queries with sort";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -5119,7 +5136,7 @@ sub mysqsl_pfs {
if ( $nbL == 1 ); if ( $nbL == 1 );
subheaderprint subheaderprint
"Performance schema: TOP 15 average sort merges queries with sort"; "Performance schema: Top 15 average sort merges queries with sort";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -5133,7 +5150,7 @@ sub mysqsl_pfs {
infoprint "No information found or indicators deactivated." infoprint "No information found or indicators deactivated."
if ( $nbL == 1 ); if ( $nbL == 1 );
subheaderprint "Performance schema: TOP 15 scans queries with sort"; subheaderprint "Performance schema: Top 15 scans queries with sort";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -5147,7 +5164,7 @@ sub mysqsl_pfs {
infoprint "No information found or indicators deactivated." infoprint "No information found or indicators deactivated."
if ( $nbL == 1 ); if ( $nbL == 1 );
subheaderprint "Performance schema: TOP 15 range queries with sort"; subheaderprint "Performance schema: Top 15 range queries with sort";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -5212,7 +5229,7 @@ sub mysqsl_pfs {
if ( $nbL == 1 ); if ( $nbL == 1 );
subheaderprint subheaderprint
"Performance schema: TOP 15 total latency queries with temp table"; "Performance schema: Top 15 total latency queries with temp table";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -5226,7 +5243,7 @@ sub mysqsl_pfs {
infoprint "No information found or indicators deactivated." infoprint "No information found or indicators deactivated."
if ( $nbL == 1 ); if ( $nbL == 1 );
subheaderprint "Performance schema: TOP 15 queries with temp table to disk"; subheaderprint "Performance schema: Top 15 queries with temp table to disk";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -5243,7 +5260,7 @@ sub mysqsl_pfs {
################################################################################## ##################################################################################
#wait_classes_global_by_latency #wait_classes_global_by_latency
#ysql> select * from wait_classes_global_by_latency; #mysql> select * from wait_classes_global_by_latency;
#-----------------+-------+---------------+-------------+-------------+-------------+ #-----------------+-------+---------------+-------------+-------------+-------------+
# event_class | total | total_latency | min_latency | avg_latency | max_latency | # event_class | total | total_latency | min_latency | avg_latency | max_latency |
#-----------------+-------+---------------+-------------+-------------+-------------+ #-----------------+-------+---------------+-------------+-------------+-------------+
@ -5253,7 +5270,7 @@ sub mysqsl_pfs {
#-----------------+-------+---------------+-------------+-------------+-------------+ #-----------------+-------+---------------+-------------+-------------+-------------+
# rows in set (0,00 sec) # rows in set (0,00 sec)
subheaderprint "Performance schema: TOP 15 class events by number"; subheaderprint "Performance schema: Top 15 class events by number";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -5267,7 +5284,7 @@ sub mysqsl_pfs {
infoprint "No information found or indicators deactivated." infoprint "No information found or indicators deactivated."
if ( $nbL == 1 ); if ( $nbL == 1 );
subheaderprint "Performance schema: TOP 30 events by number"; subheaderprint "Performance schema: Top 30 events by number";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -5281,7 +5298,7 @@ sub mysqsl_pfs {
infoprint "No information found or indicators deactivated." infoprint "No information found or indicators deactivated."
if ( $nbL == 1 ); if ( $nbL == 1 );
subheaderprint "Performance schema: TOP 15 class events by total latency"; subheaderprint "Performance schema: Top 15 class events by total latency";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -5295,7 +5312,7 @@ sub mysqsl_pfs {
infoprint "No information found or indicators deactivated." infoprint "No information found or indicators deactivated."
if ( $nbL == 1 ); if ( $nbL == 1 );
subheaderprint "Performance schema: TOP 30 events by total latency"; subheaderprint "Performance schema: Top 30 events by total latency";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -5309,7 +5326,7 @@ sub mysqsl_pfs {
infoprint "No information found or indicators deactivated." infoprint "No information found or indicators deactivated."
if ( $nbL == 1 ); if ( $nbL == 1 );
subheaderprint "Performance schema: TOP 15 class events by max latency"; subheaderprint "Performance schema: Top 15 class events by max latency";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -5323,7 +5340,7 @@ sub mysqsl_pfs {
infoprint "No information found or indicators deactivated." infoprint "No information found or indicators deactivated."
if ( $nbL == 1 ); if ( $nbL == 1 );
subheaderprint "Performance schema: TOP 30 events by max latency"; subheaderprint "Performance schema: Top 30 events by max latency";
$nbL = 1; $nbL = 1;
for my $lQuery ( for my $lQuery (
select_array( select_array(
@ -5573,19 +5590,19 @@ group by c.table_schema,c.table_name
having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0" having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0"
); );
infoprint "CPU core detected : " . (cpu_cores); infoprint "CPU cores detected : " . (cpu_cores);
infoprint "wsrep_slave_threads: " . get_wsrep_option('wsrep_slave_threads'); infoprint "wsrep_slave_threads: " . get_wsrep_option('wsrep_slave_threads');
if ( get_wsrep_option('wsrep_slave_threads') > ( (cpu_cores) * 4 ) if ( get_wsrep_option('wsrep_slave_threads') > ( (cpu_cores) * 4 )
or get_wsrep_option('wsrep_slave_threads') < ( (cpu_cores) * 2 ) ) or get_wsrep_option('wsrep_slave_threads') < ( (cpu_cores) * 2 ) )
{ {
badprint badprint
"wsrep_slave_threads is not equal to 2, 3 or 4 times number of CPU(s)"; "wsrep_slave_threads is not equal to 2, 3 or 4 times the number of CPU(s)";
push @adjvars, "wsrep_slave_threads = " . ( (cpu_cores) * 4 ); push @adjvars, "wsrep_slave_threads = " . ( (cpu_cores) * 4 );
} }
else { else {
goodprint goodprint
"wsrep_slave_threads is equal to 2, 3 or 4 times number of CPU(s)"; "wsrep_slave_threads is equal to 2, 3 or 4 times the number of CPU(s)";
} }
if ( get_wsrep_option('wsrep_slave_threads') > 1 ) { if ( get_wsrep_option('wsrep_slave_threads') > 1 ) {
@ -5704,7 +5721,7 @@ having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0"
# wsrep_cluster_address doesn't include garbd nodes # wsrep_cluster_address doesn't include garbd nodes
if ( $nbNodes > $nbNodesSize ) { if ( $nbNodes > $nbNodesSize ) {
badprint badprint
"All cluster nodes are not detected. wsrep_cluster_size less then node count in wsrep_cluster_address"; "All cluster nodes are not detected. wsrep_cluster_size less than node count in wsrep_cluster_address";
} }
else { else {
goodprint "All cluster nodes detected."; goodprint "All cluster nodes detected.";
@ -5742,7 +5759,7 @@ having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0"
} }
else { else {
badprint "Galera Notify command is not defined."; badprint "Galera Notify command is not defined.";
push( @adjvars, "set up parameter wsrep_notify_cmd to be notify" ); push( @adjvars, "set up parameter wsrep_notify_cmd to be notified" );
} }
if ( trim( $myvar{'wsrep_sst_method'} ) !~ "^xtrabackup.*" if ( trim( $myvar{'wsrep_sst_method'} ) !~ "^xtrabackup.*"
and trim( $myvar{'wsrep_sst_method'} ) !~ "^mariabackup" ) and trim( $myvar{'wsrep_sst_method'} ) !~ "^mariabackup" )
@ -5966,7 +5983,7 @@ sub mysql_innodb {
); );
if ( mysql_version_le( 5, 6, 2 ) ) { if ( mysql_version_le( 5, 6, 2 ) ) {
push( @generalrec, push( @generalrec,
"For MySQL 5.6.2 and lower, Max combined innodb_log_file_size should have a ceiling of (4096MB / log files in group) - 1MB." "For MySQL 5.6.2 and lower, total innodb_log_file_size should have a ceiling of (4096MB / log files in group) - 1MB."
); );
} }
push( @generalrec, push( @generalrec,
@ -6178,7 +6195,7 @@ sub mysql_databases {
subheaderprint "Database Metrics"; subheaderprint "Database Metrics";
unless ( mysql_version_ge( 5, 5 ) ) { unless ( mysql_version_ge( 5, 5 ) ) {
infoprint infoprint
"Skip Database metrics from information schema missing in this version"; "Skip Database metrics from information schema are missing in this version";
return; return;
} }
@ -6409,12 +6426,12 @@ sub mysql_tables {
subheaderprint "Table Column Metrics"; subheaderprint "Table Column Metrics";
unless ( mysql_version_ge( 5, 5 ) ) { unless ( mysql_version_ge( 5, 5 ) ) {
infoprint infoprint
"Skip Database metrics from information schema missing in this version"; "Skip Database metrics from information schema are missing in this version";
return; return;
} }
if ( mysql_version_ge(8) and not mysql_version_eq(10) ) { if ( mysql_version_ge(8) and not mysql_version_eq(10) ) {
infoprint infoprint
"MySQL and Percona version 8 and greater have remove PROCEDURE ANALYSE feature"; "MySQL and Percona version 8.0 and greater have removed PROCEDURE ANALYSE feature";
$opt{colstat} = 0; $opt{colstat} = 0;
infoprint "Disabling colstat parameter"; infoprint "Disabling colstat parameter";
@ -6517,7 +6534,7 @@ sub mysql_indexes {
subheaderprint "Indexes Metrics"; subheaderprint "Indexes Metrics";
unless ( mysql_version_ge( 5, 5 ) ) { unless ( mysql_version_ge( 5, 5 ) ) {
infoprint infoprint
"Skip Index metrics from information schema missing in this version"; "Skip Index metrics from information schema are missing in this version";
return; return;
} }
@ -6644,7 +6661,7 @@ sub mysql_views() {
subheaderprint "Views Metrics"; subheaderprint "Views Metrics";
unless ( mysql_version_ge( 5, 5 ) ) { unless ( mysql_version_ge( 5, 5 ) ) {
infoprint infoprint
"Skip Index metrics from information schema missing in this version"; "Skip Index metrics from information schema are missing in this version";
return; return;
} }
} }
@ -6653,7 +6670,7 @@ sub mysql_routines() {
subheaderprint "Routines Metrics"; subheaderprint "Routines Metrics";
unless ( mysql_version_ge( 5, 5 ) ) { unless ( mysql_version_ge( 5, 5 ) ) {
infoprint infoprint
"Skip Index metrics from information schema missing in this version"; "Skip Index metrics from information schema are missing in this version";
return; return;
} }
} }
@ -6662,7 +6679,7 @@ sub mysql_triggers() {
subheaderprint "Triggers Metrics"; subheaderprint "Triggers Metrics";
unless ( mysql_version_ge( 5, 5 ) ) { unless ( mysql_version_ge( 5, 5 ) ) {
infoprint infoprint
"Skip Index metrics from information schema missing in this version"; "Skip Index metrics from information schema are missing in this version";
return; return;
} }
} }
@ -6695,8 +6712,7 @@ sub close_outputfile {
} }
sub headerprint { sub headerprint {
prettyprint prettyprint " >> MySQLTuner $tunerversion\n"
" >> MySQLTuner $tunerversion\n"
. "\t * Jean-Marie Renouard <jmrenouard\@gmail.com>\n" . "\t * Jean-Marie Renouard <jmrenouard\@gmail.com>\n"
. "\t * Major Hayden <major\@mhtx.net>\n" . "\t * Major Hayden <major\@mhtx.net>\n"
. " >> Bug reports, feature requests, and downloads at http://mysqltuner.pl/\n" . " >> Bug reports, feature requests, and downloads at http://mysqltuner.pl/\n"
@ -6889,7 +6905,7 @@ __END__
=head1 NAME =head1 NAME
MySQLTuner 2.0.4 - MySQL High Performance Tuning Script MySQLTuner2.0.5 - MySQL High Performance Tuning Script
=head1 IMPORTANT USAGE GUIDELINES =head1 IMPORTANT USAGE GUIDELINES
@ -6954,11 +6970,10 @@ You must provide the remote server's total memory when connecting to other serve
--pfstat Print Performance schema --pfstat Print Performance schema
--nopfstat Don't Print Performance schema --nopfstat Don't Print Performance schema
--bannedports Ports banned separated by comma (,) --bannedports Ports banned separated by comma (,)
--server-log Define specifi error_log to analyze --server-log Define specific error_log to analyze
--maxportallowed Number of ports opened allowed on this hosts --maxportallowed Number of ports opened allowed on this host
--buffers Print global and per-thread buffer values --buffers Print global and per-thread buffer values
=head1 PERLDOC =head1 PERLDOC
You can find documentation for this module with the perldoc command. You can find documentation for this module with the perldoc command.

File diff suppressed because one or more lines are too long