Merge branch 'master' of https://github.com/major/MySQLTuner-perl
This commit is contained in:
commit
6284e95f18
6 changed files with 164 additions and 336 deletions
24
.gitignore
vendored
24
.gitignore
vendored
|
@ -1,15 +1,17 @@
|
|||
build/mysqltuner-*
|
||||
build/mysqltuner.spec
|
||||
build/build.log
|
||||
build/cve*
|
||||
build/vulnerabilities*
|
||||
*.bak
|
||||
Vagrant/Vagrantfile
|
||||
Vagrant/data
|
||||
Vagrant/.vagrant
|
||||
contents
|
||||
contents/*
|
||||
build/mysqltuner-*
|
||||
build/mysqltuner.spec
|
||||
build/build.log
|
||||
build/cve*
|
||||
build/vulnerabilities*
|
||||
*.bak
|
||||
Vagrant/Vagrantfile
|
||||
Vagrant/data
|
||||
Vagrant/.vagrant
|
||||
contents
|
||||
contents/*
|
||||
result_*
|
||||
result.html
|
||||
result.txt
|
||||
reports_*
|
||||
golang/prog-*
|
||||
.vscode
|
||||
|
|
|
@ -143,7 +143,9 @@ For previous MySQL 5.6 version, you can follow this command to create a new data
|
|||
Optional Performance schema and Sysschema installation for MariaDB 10.x
|
||||
--
|
||||
|
||||
Sysschema is not installed by default under MariaDB prior to 10.6
|
||||
Sysschema is not installed by default under MariaDB prior to 10.6 [MariaDB sys](https://mariadb.com/kb/en/sys-schema/)
|
||||
|
||||
|
||||
By default, on MariaDB, performance schema is disabled by default. consider activating performance schema across your my.cnf configuration file:
|
||||
|
||||
[mysqld]
|
||||
|
@ -445,4 +447,3 @@ Simple steps to create a pull request:
|
|||
- Push it back to your repo
|
||||
- Click the Compare & pull request button
|
||||
- Click Create pull request to open a new pull request
|
||||
|
||||
|
|
23
USAGE.md
23
USAGE.md
|
@ -1,6 +1,6 @@
|
|||
# NAME
|
||||
|
||||
MySQLTuner2.0.5 - MySQL High Performance Tuning Script
|
||||
MySQLTuner 2.0.10 - MySQL High Performance Tuning Script
|
||||
|
||||
# IMPORTANT USAGE GUIDELINES
|
||||
|
||||
|
@ -23,7 +23,8 @@ You must provide the remote server's total memory when connecting to other serve
|
|||
--mysqladmin <path> Path to a custom mysqladmin executable
|
||||
--mysqlcmd <path> Path to a custom mysql executable
|
||||
--defaults-file <path> Path to a custom .my.cnf
|
||||
--server-log <path> Path to explict log file (error_log)
|
||||
--defaults-extra-file <path> Path to a extra custom config file
|
||||
--server-log <path> Path to explicit log file (error_log)
|
||||
|
||||
# PERFORMANCE AND REPORTING OPTIONS
|
||||
|
||||
|
@ -36,7 +37,7 @@ You must provide the remote server's total memory when connecting to other serve
|
|||
--updateversion Check for updates to MySQLTuner and update when newer version is available (default: don't check)
|
||||
--forcemem <size> Amount of RAM installed in megabytes
|
||||
--forceswap <size> Amount of swap memory configured in megabytes
|
||||
--passwordfile <path> Path to a password file list(one password by line)
|
||||
--passwordfile <path> Path to a password file list (one password by line)
|
||||
--cvefile <path> CVE File for vulnerability checks
|
||||
--outputfile <path> Path to a output txt file
|
||||
--reportfile <path> Path to a report txt file
|
||||
|
@ -45,7 +46,7 @@ You must provide the remote server's total memory when connecting to other serve
|
|||
# OUTPUT OPTIONS
|
||||
|
||||
--silent Don't output anything on screen
|
||||
--verbose Prints out all options (default: no verbose, dbstat, idxstat, sysstat, tbstat, pfstat)
|
||||
--verbose Print out all options (default: no verbose, dbstat, idxstat, sysstat, tbstat, pfstat)
|
||||
--nocolor Don't print output in color
|
||||
--nogood Remove OK responses
|
||||
--nobad Remove negative/suggestion responses
|
||||
|
@ -53,20 +54,20 @@ You must provide the remote server's total memory when connecting to other serve
|
|||
--debug Print debug information
|
||||
--noprocess Consider no other process is running
|
||||
--dbstat Print database information
|
||||
--nodbstat Don't Print database information
|
||||
--nodbstat Don't print database information
|
||||
--tbstat Print table information
|
||||
--notbstat Don't Print table information
|
||||
--notbstat Don't print table information
|
||||
--colstat Print column information
|
||||
--nocolstat Don't Print column information
|
||||
--nocolstat Don't print column information
|
||||
--idxstat Print index information
|
||||
--noidxstat Don't Print index information
|
||||
--noidxstat Don't print index information
|
||||
--sysstat Print system information
|
||||
--nosysstat Don't Print system information
|
||||
--nosysstat Don't print system information
|
||||
--pfstat Print Performance schema
|
||||
--nopfstat Don't Print Performance schema
|
||||
--nopfstat Don't print Performance schema
|
||||
--bannedports Ports banned separated by comma (,)
|
||||
--server-log Define specific error_log to analyze
|
||||
--maxportallowed Number of ports opened allowed on this host
|
||||
--maxportallowed Number of open ports allowable on this host
|
||||
--buffers Print global and per-thread buffer values
|
||||
|
||||
# PERLDOC
|
||||
|
|
5
build/installStaff.sh
Normal file
5
build/installStaff.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
apt install -y cpanminus libpod-markdown-perl libwww-mechanize-gzip-perl perltidy dos2unix
|
||||
|
||||
cpanm File::Util
|
240
mysqltuner.pl
240
mysqltuner.pl
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env perl
|
||||
# mysqltuner.pl - Version 2.0.7
|
||||
# mysqltuner.pl - Version 2.0.10
|
||||
# High Performance MySQL Tuning Script
|
||||
# Copyright (C) 2006-2022 Major Hayden - major@mhtx.net
|
||||
# Copyright (C) 2015-2022 Jean-Marie Renouard - jmrenouard@gmail.com
|
||||
|
@ -57,59 +57,59 @@ use Cwd 'abs_path';
|
|||
#use Env;
|
||||
|
||||
# Set up a few variables for use in the script
|
||||
my $tunerversion = "2.0.7";
|
||||
my $tunerversion = "2.0.10";
|
||||
my ( @adjvars, @generalrec );
|
||||
|
||||
# Set defaults
|
||||
my %opt = (
|
||||
"silent" => 0,
|
||||
"nobad" => 0,
|
||||
"nogood" => 0,
|
||||
"noinfo" => 0,
|
||||
"debug" => 0,
|
||||
"nocolor" => ( !-t STDOUT ),
|
||||
"color" => 0,
|
||||
"forcemem" => 0,
|
||||
"forceswap" => 0,
|
||||
"host" => 0,
|
||||
"socket" => 0,
|
||||
"port" => 0,
|
||||
"user" => 0,
|
||||
"pass" => 0,
|
||||
"password" => 0,
|
||||
"ssl-ca" => 0,
|
||||
"skipsize" => 0,
|
||||
"checkversion" => 0,
|
||||
"updateversion" => 0,
|
||||
"buffers" => 0,
|
||||
"passwordfile" => 0,
|
||||
"bannedports" => '',
|
||||
"maxportallowed" => 0,
|
||||
"outputfile" => 0,
|
||||
"noprocess" => 0,
|
||||
"dbstat" => 0,
|
||||
"nodbstat" => 0,
|
||||
"server-log" => '',
|
||||
"tbstat" => 0,
|
||||
"notbstat" => 0,
|
||||
"colstat" => 0,
|
||||
"nocolstat" => 0,
|
||||
"idxstat" => 0,
|
||||
"noidxstat" => 0,
|
||||
"sysstat" => 0,
|
||||
"nosysstat" => 0,
|
||||
"pfstat" => 0,
|
||||
"nopfstat" => 0,
|
||||
"skippassword" => 0,
|
||||
"noask" => 0,
|
||||
"template" => 0,
|
||||
"json" => 0,
|
||||
"prettyjson" => 0,
|
||||
"reportfile" => 0,
|
||||
"verbose" => 0,
|
||||
"defaults-file" => '',
|
||||
"defaults-extra-file" => '',
|
||||
"protocol" => '',
|
||||
"silent" => 0,
|
||||
"nobad" => 0,
|
||||
"nogood" => 0,
|
||||
"noinfo" => 0,
|
||||
"debug" => 0,
|
||||
"nocolor" => ( !-t STDOUT ),
|
||||
"color" => 0,
|
||||
"forcemem" => 0,
|
||||
"forceswap" => 0,
|
||||
"host" => 0,
|
||||
"socket" => 0,
|
||||
"port" => 0,
|
||||
"user" => 0,
|
||||
"pass" => 0,
|
||||
"password" => 0,
|
||||
"ssl-ca" => 0,
|
||||
"skipsize" => 0,
|
||||
"checkversion" => 0,
|
||||
"updateversion" => 0,
|
||||
"buffers" => 0,
|
||||
"passwordfile" => 0,
|
||||
"bannedports" => '',
|
||||
"maxportallowed" => 0,
|
||||
"outputfile" => 0,
|
||||
"noprocess" => 0,
|
||||
"dbstat" => 0,
|
||||
"nodbstat" => 0,
|
||||
"server-log" => '',
|
||||
"tbstat" => 0,
|
||||
"notbstat" => 0,
|
||||
"colstat" => 0,
|
||||
"nocolstat" => 0,
|
||||
"idxstat" => 0,
|
||||
"noidxstat" => 0,
|
||||
"sysstat" => 0,
|
||||
"nosysstat" => 0,
|
||||
"pfstat" => 0,
|
||||
"nopfstat" => 0,
|
||||
"skippassword" => 0,
|
||||
"noask" => 0,
|
||||
"template" => 0,
|
||||
"json" => 0,
|
||||
"prettyjson" => 0,
|
||||
"reportfile" => 0,
|
||||
"verbose" => 0,
|
||||
"defaults-file" => '',
|
||||
"defaults-extra-file" => '',
|
||||
"protocol" => '',
|
||||
);
|
||||
|
||||
# Gather the options from the command line
|
||||
|
@ -204,7 +204,7 @@ if ( $opt{verbose} ) {
|
|||
$opt{nocolor} = 1 if defined( $opt{outputfile} );
|
||||
$opt{tbstat} = 0 if ( $opt{notbstat} == 1 ); # Don't print table information
|
||||
$opt{colstat} = 0 if ( $opt{nocolstat} == 1 ); # Don't print column information
|
||||
$opt{dbstat} = 0 if ( $opt{nodbstat} == 1 ); # Don't print database information
|
||||
$opt{dbstat} = 0 if ( $opt{nodbstat} == 1 ); # Don't print database information
|
||||
$opt{noprocess} = 0
|
||||
if ( $opt{noprocess} == 1 ); # Don't print process information
|
||||
$opt{sysstat} = 0 if ( $opt{nosysstat} == 1 ); # Don't print sysstat information
|
||||
|
@ -326,7 +326,7 @@ sub hr_bytes {
|
|||
return "0B" unless defined($num);
|
||||
return "0B" if $num eq "NULL";
|
||||
|
||||
if ( $num >= ( 1024**3 ) ) { # GB
|
||||
if ( $num >= ( 1024**3 ) ) { # GB
|
||||
return sprintf( "%.1f", ( $num / ( 1024**3 ) ) ) . "G";
|
||||
}
|
||||
elsif ( $num >= ( 1024**2 ) ) { # MB
|
||||
|
@ -365,7 +365,7 @@ sub hr_bytes_rnd {
|
|||
return "0B" unless defined($num);
|
||||
return "0B" if $num eq "NULL";
|
||||
|
||||
if ( $num >= ( 1024**3 ) ) { # GB
|
||||
if ( $num >= ( 1024**3 ) ) { # GB
|
||||
return int( ( $num / ( 1024**3 ) ) ) . "G";
|
||||
}
|
||||
elsif ( $num >= ( 1024**2 ) ) { # MB
|
||||
|
@ -917,17 +917,21 @@ sub mysql_setup {
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
elsif ( $opt{'defaults-extra-file'} ne '' and -r "$opt{'defaults-extra-file'}" ) {
|
||||
elsif ( $opt{'defaults-extra-file'} ne ''
|
||||
and -r "$opt{'defaults-extra-file'}" )
|
||||
{
|
||||
|
||||
# defaults-extra-file
|
||||
debugprint "defaults extra file detected: $opt{'defaults-extra-file'}";
|
||||
my $mysqlclidefaults = `$mysqlcmd --print-defaults`;
|
||||
debugprint "MySQL Client Extra Default File: $opt{'defaults-extra-file'}";
|
||||
debugprint
|
||||
"MySQL Client Extra Default File: $opt{'defaults-extra-file'}";
|
||||
|
||||
$mysqllogin = "--defaults-extra-file=" . $opt{'defaults-extra-file'};
|
||||
my $loginstatus = `$mysqladmincmd $mysqllogin ping 2>&1`;
|
||||
if ( $loginstatus =~ /mysqld is alive/ ) {
|
||||
goodprint "Logged in using credentials from extra defaults file account.";
|
||||
goodprint
|
||||
"Logged in using credentials from extra defaults file account.";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -1190,7 +1194,7 @@ sub get_all_vars {
|
|||
$dummyselect = select_one "SELECT VERSION()";
|
||||
if ( not defined($dummyselect) or $dummyselect eq "" ) {
|
||||
badprint
|
||||
"You probably do not have enough privileges to run MySQLTuner ...";
|
||||
"You probably do not have enough privileges to run MySQLTuner ...";
|
||||
exit(256);
|
||||
}
|
||||
$dummyselect =~ s/(.*?)\-.*/$1/;
|
||||
|
@ -1288,8 +1292,8 @@ sub get_all_vars {
|
|||
my @lineitems = ();
|
||||
foreach my $line (@mysqlslaves) {
|
||||
debugprint "L: $line ";
|
||||
@lineitems = split /\s+/, $line;
|
||||
$myslaves{ $lineitems[0] } = $line;
|
||||
@lineitems = split /\s+/, $line;
|
||||
$myslaves{ $lineitems[0] } = $line;
|
||||
$result{'Replication'}{'Slaves'}{ $lineitems[0] } = $lineitems[4];
|
||||
}
|
||||
}
|
||||
|
@ -1440,7 +1444,7 @@ sub log_file_recommendations {
|
|||
$numLi++;
|
||||
debugprint "$numLi: $logLi"
|
||||
if $logLi =~ /warning|error/i and $logLi !~ /Logging to/;
|
||||
$nbErrLog++ if $logLi =~ /error/i and $logLi !~ /Logging to/;
|
||||
$nbErrLog++ if $logLi =~ /error/i and $logLi !~ /Logging to/;
|
||||
$nbWarnLog++ if $logLi =~ /warning/i;
|
||||
push @lastShutdowns, $logLi
|
||||
if $logLi =~ /Shutdown complete/ and $logLi !~ /Innodb/i;
|
||||
|
@ -2204,7 +2208,7 @@ sub get_replication_status {
|
|||
"This replication slave is not running but seems to be configured.";
|
||||
}
|
||||
if ( defined($io_running)
|
||||
&& $io_running =~ /yes/i
|
||||
&& $io_running =~ /yes/i
|
||||
&& $sql_running =~ /yes/i )
|
||||
{
|
||||
if ( $myvar{'read_only'} eq 'OFF' ) {
|
||||
|
@ -2240,7 +2244,10 @@ sub validate_mysql_version {
|
|||
or mysql_version_eq( 10, 5 )
|
||||
or mysql_version_eq( 10, 6 )
|
||||
or mysql_version_eq( 10, 7 )
|
||||
or mysql_version_eq( 10, 8 ) )
|
||||
or mysql_version_eq( 10, 8 )
|
||||
or mysql_version_eq( 10, 9 )
|
||||
or mysql_version_eq( 10, 10 )
|
||||
or mysql_version_eq( 10, 11 ) )
|
||||
{
|
||||
goodprint "Currently running supported MySQL version "
|
||||
. $myvar{'version'} . "";
|
||||
|
@ -2251,7 +2258,8 @@ sub validate_mysql_version {
|
|||
. $myvar{'version'}
|
||||
. " is EOL software. Upgrade soon!";
|
||||
push( @generalrec,
|
||||
"You are using an unsupported version for production environments" );
|
||||
"You are using an unsupported version for production environments"
|
||||
);
|
||||
push( @generalrec,
|
||||
"Upgrade as soon as possible to a supported version !" );
|
||||
|
||||
|
@ -2468,7 +2476,7 @@ sub check_storage_engines {
|
|||
}
|
||||
$result{'Tables'}{'Fragmented tables'} =
|
||||
[ select_array
|
||||
"SELECT CONCAT(CONCAT(TABLE_SCHEMA, '.'), TABLE_NAME),cast(DATA_FREE as signed) FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ('information_schema', 'performance_schema', 'mysql') AND DATA_LENGTH/1024/1024>100 AND cast(DATA_FREE as signed)*100/(DATA_LENGTH+INDEX_LENGTH+cast(DATA_FREE as signed)) > 10 AND NOT ENGINE='MEMORY' $not_innodb"
|
||||
"SELECT TABLE_SCHEMA, TABLE_NAME, ENGINE, CAST(DATA_FREE AS SIGNED) FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ('information_schema', 'performance_schema', 'mysql') AND DATA_LENGTH/1024/1024>100 AND cast(DATA_FREE as signed)*100/(DATA_LENGTH+INDEX_LENGTH+cast(DATA_FREE as signed)) > 10 AND NOT ENGINE='MEMORY' $not_innodb"
|
||||
];
|
||||
$fragtables = scalar @{ $result{'Tables'}{'Fragmented tables'} };
|
||||
|
||||
|
@ -2551,28 +2559,34 @@ sub check_storage_engines {
|
|||
{
|
||||
badprint "MyISAM is enabled but isn't being used";
|
||||
push( @generalrec,
|
||||
"Add skip-isam to MySQL configuration to disable MyISAM (MySQL > 4.1.0)"
|
||||
"Add skip-isam to MySQL configuration to disable MyISAM (MySQL > 4.1.0)"
|
||||
);
|
||||
}
|
||||
|
||||
# Fragmented tables
|
||||
if ( $fragtables > 0 ) {
|
||||
badprint "Total fragmented tables: $fragtables";
|
||||
push( @generalrec,
|
||||
"Run OPTIMIZE TABLE to defragment tables for better performance" );
|
||||
push @generalrec,
|
||||
'Run ALTER TABLE ... FORCE or OPTIMIZE TABLE to defragment tables for better performance';
|
||||
my $total_free = 0;
|
||||
foreach my $table_line ( @{ $result{'Tables'}{'Fragmented tables'} } ) {
|
||||
my ( $full_table_name, $data_free ) = split( /\s+/, $table_line );
|
||||
$data_free = 0 if ( !defined($data_free) or $data_free eq '' );
|
||||
my ( $table_schema, $table_name, $engine, $data_free ) =
|
||||
split /\t/msx, $table_line;
|
||||
$data_free = $data_free / 1024 / 1024;
|
||||
$total_free += $data_free;
|
||||
my ( $table_schema, $table_name ) = split( /\./, $full_table_name );
|
||||
push( @generalrec,
|
||||
" OPTIMIZE TABLE `$table_schema`.`$table_name`; -- can free $data_free MB"
|
||||
);
|
||||
my $generalrec;
|
||||
if ( $engine eq 'InnoDB' ) {
|
||||
$generalrec =
|
||||
" ALTER TABLE `$table_schema`.`$table_name` FORCE;";
|
||||
}
|
||||
else {
|
||||
$generalrec = " OPTIMIZE TABLE `$table_schema`.`$table_name`;";
|
||||
}
|
||||
$generalrec .= " -- can free $data_free MiB";
|
||||
push @generalrec, $generalrec;
|
||||
}
|
||||
push( @generalrec,
|
||||
"Total freed space after theses OPTIMIZE TABLE : $total_free Mb" );
|
||||
push @generalrec,
|
||||
"Total freed space after defragmentation : $total_free MiB";
|
||||
}
|
||||
else {
|
||||
goodprint "Total fragmented tables: $fragtables";
|
||||
|
@ -2629,8 +2643,7 @@ my %mycalc;
|
|||
|
||||
sub calculations {
|
||||
if ( $mystat{'Questions'} < 1 ) {
|
||||
badprint
|
||||
"Your server has not answered any queries: cannot continue...";
|
||||
badprint "Your server has not answered any queries: cannot continue...";
|
||||
exit 2;
|
||||
}
|
||||
|
||||
|
@ -3059,7 +3072,8 @@ sub mysql_stats {
|
|||
. " global + "
|
||||
. hr_bytes( $mycalc{'per_thread_buffers'} )
|
||||
. " per thread ($myvar{'max_connections'} max threads)";
|
||||
infoprint "Performance_schema Max memory usage: " . hr_bytes_rnd( get_pf_memory() );
|
||||
infoprint "Performance_schema Max memory usage: "
|
||||
. hr_bytes_rnd( get_pf_memory() );
|
||||
$result{'Performance_schema'}{'memory'} = get_pf_memory();
|
||||
$result{'Performance_schema'}{'pretty_memory'} =
|
||||
hr_bytes_rnd( get_pf_memory() );
|
||||
|
@ -3262,7 +3276,7 @@ sub mysql_stats {
|
|||
}
|
||||
elsif ( $mystat{'Com_select'} == 0 ) {
|
||||
badprint
|
||||
"Query cache cannot be analyzed - no SELECT statements executed";
|
||||
"Query cache cannot be analyzed: no SELECT statements executed";
|
||||
}
|
||||
else {
|
||||
badprint
|
||||
|
@ -3673,8 +3687,8 @@ sub mysql_myisam {
|
|||
if ( $mycalc{'pct_key_buffer_used'} < 90 ) {
|
||||
badprint "Key buffer used: $mycalc{'pct_key_buffer_used'}% ("
|
||||
. hr_bytes( $myvar{'key_buffer_size'} -
|
||||
$mystat{'Key_blocks_unused'} *
|
||||
$myvar{'key_cache_block_size'} )
|
||||
$mystat{'Key_blocks_unused'} * $myvar{'key_cache_block_size'}
|
||||
)
|
||||
. " used / "
|
||||
. hr_bytes( $myvar{'key_buffer_size'} )
|
||||
. " cache)";
|
||||
|
@ -3692,8 +3706,8 @@ sub mysql_myisam {
|
|||
else {
|
||||
goodprint "Key buffer used: $mycalc{'pct_key_buffer_used'}% ("
|
||||
. hr_bytes( $myvar{'key_buffer_size'} -
|
||||
$mystat{'Key_blocks_unused'} *
|
||||
$myvar{'key_cache_block_size'} )
|
||||
$mystat{'Key_blocks_unused'} * $myvar{'key_cache_block_size'}
|
||||
)
|
||||
. " used / "
|
||||
. hr_bytes( $myvar{'key_buffer_size'} )
|
||||
. " cache)";
|
||||
|
@ -3878,9 +3892,9 @@ sub get_pf_memory {
|
|||
return 0 unless defined $myvar{'performance_schema'};
|
||||
return 0 if $myvar{'performance_schema'} eq 'OFF';
|
||||
|
||||
my @infoPFSMemory = grep /performance_schema.memory/,
|
||||
my @infoPFSMemory = grep { /\tperformance_schema[.]memory\t/msx }
|
||||
select_array("SHOW ENGINE PERFORMANCE_SCHEMA STATUS");
|
||||
return 0 if scalar(@infoPFSMemory) == 0;
|
||||
@infoPFSMemory == 1 || return 0;
|
||||
$infoPFSMemory[0] =~ s/.*\s+(\d+)$/$1/g;
|
||||
return $infoPFSMemory[0];
|
||||
}
|
||||
|
@ -3901,16 +3915,17 @@ sub mysqsl_pfs {
|
|||
if ( $myvar{'performance_schema'} eq 'ON' ) {
|
||||
infoprint "Performance_schema is activated.";
|
||||
debugprint "Performance schema is " . $myvar{'performance_schema'};
|
||||
infoprint "Memory used by Performance_schema: " . hr_bytes( get_pf_memory() );
|
||||
infoprint "Memory used by Performance_schema: "
|
||||
. hr_bytes( get_pf_memory() );
|
||||
}
|
||||
|
||||
unless ( grep /^sys$/, select_array("SHOW DATABASES") ) {
|
||||
infoprint "Sys schema is not installed.";
|
||||
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 ) );
|
||||
push( @generalrec,
|
||||
"Consider installing Sys schema from https://github.com/FromDual/mariadb-sys for MariaDB"
|
||||
"Consider installing Sys schema from https://github.com/FromDual/mariadb-sys for MariaDB"
|
||||
) unless ( mysql_version_ge( 10, 0 ) );
|
||||
|
||||
return;
|
||||
|
@ -5448,7 +5463,7 @@ sub mariadb_tokudb {
|
|||
}
|
||||
infoprint "TokuDB is enabled.";
|
||||
|
||||
# All is to done here
|
||||
# Not implemented
|
||||
}
|
||||
|
||||
# Recommendations for XtraDB
|
||||
|
@ -5465,7 +5480,7 @@ sub mariadb_xtradb {
|
|||
infoprint "XtraDB is enabled.";
|
||||
infoprint "Note that MariaDB 10.2 makes use of InnoDB, not XtraDB."
|
||||
|
||||
# All is to done here
|
||||
# Not implemented
|
||||
}
|
||||
|
||||
# Recommendations for RocksDB
|
||||
|
@ -5481,7 +5496,7 @@ sub mariadb_rockdb {
|
|||
}
|
||||
infoprint "RocksDB is enabled.";
|
||||
|
||||
# All is to do here
|
||||
# Not implemented
|
||||
}
|
||||
|
||||
# Recommendations for Spider
|
||||
|
@ -5497,7 +5512,7 @@ sub mariadb_spider {
|
|||
}
|
||||
infoprint "Spider is enabled.";
|
||||
|
||||
# All is to do here
|
||||
# Not implemented
|
||||
}
|
||||
|
||||
# Recommendations for Connect
|
||||
|
@ -5513,7 +5528,7 @@ sub mariadb_connect {
|
|||
}
|
||||
infoprint "Connect is enabled.";
|
||||
|
||||
# All is to do here
|
||||
# Not implemented
|
||||
}
|
||||
|
||||
# Perl trim function to remove whitespace from the start and end of the string
|
||||
|
@ -5613,19 +5628,19 @@ having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0"
|
|||
or get_wsrep_option('wsrep_slave_threads') < ( (cpu_cores) * 2 ) )
|
||||
{
|
||||
badprint
|
||||
"wsrep_slave_threads is not equal to 2, 3 or 4 times the 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 );
|
||||
}
|
||||
else {
|
||||
goodprint
|
||||
"wsrep_slave_threads is equal to 2, 3 or 4 times the 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 ) {
|
||||
infoprint
|
||||
"wsrep parallel slave can cause frequent inconsistency crash.";
|
||||
push @adjvars,
|
||||
"Set wsrep_slave_threads to 1 in case of HA_ERR_FOUND_DUPP_KEY crash on slave";
|
||||
"Set wsrep_slave_threads to 1 in case of HA_ERR_FOUND_DUPP_KEY crash on slave";
|
||||
|
||||
# check options for parallel slave
|
||||
if ( get_wsrep_option('wsrep_slave_FK_checks') eq "OFF" ) {
|
||||
|
@ -5668,7 +5683,7 @@ having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0"
|
|||
}
|
||||
else {
|
||||
goodprint
|
||||
"Flow control fraction seems to be OK (wsrep_flow_control_paused <= 0.02)";
|
||||
"Flow control fraction seems to be OK (wsrep_flow_control_paused <= 0.02)";
|
||||
}
|
||||
|
||||
if ( scalar(@primaryKeysNbTables) > 0 ) {
|
||||
|
@ -5730,14 +5745,14 @@ having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0"
|
|||
}
|
||||
else {
|
||||
badprint
|
||||
"There are $nbNodesSize nodes in wsrep_cluster_size. Prefer 3 or 5 nodes architecture.";
|
||||
"There are $nbNodesSize nodes in wsrep_cluster_size. Prefer 3 or 5 nodes architecture.";
|
||||
push @generalrec, "Prefer 3 or 5 nodes architecture.";
|
||||
}
|
||||
|
||||
# wsrep_cluster_address doesn't include garbd nodes
|
||||
if ( $nbNodes > $nbNodesSize ) {
|
||||
badprint
|
||||
"All cluster nodes are not detected. wsrep_cluster_size less than node count in wsrep_cluster_address";
|
||||
"All cluster nodes are not detected. wsrep_cluster_size less than node count in wsrep_cluster_address";
|
||||
}
|
||||
else {
|
||||
goodprint "All cluster nodes detected.";
|
||||
|
@ -5775,14 +5790,15 @@ having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0"
|
|||
}
|
||||
else {
|
||||
badprint "Galera Notify command is not defined.";
|
||||
push( @adjvars, "set up parameter wsrep_notify_cmd to be notified" );
|
||||
push( @adjvars,
|
||||
"set up parameter wsrep_notify_cmd to be notified" );
|
||||
}
|
||||
if ( trim( $myvar{'wsrep_sst_method'} ) !~ "^xtrabackup.*"
|
||||
and trim( $myvar{'wsrep_sst_method'} ) !~ "^mariabackup" )
|
||||
{
|
||||
badprint "Galera SST method is not xtrabackup based.";
|
||||
push( @adjvars,
|
||||
"set up parameter wsrep_sst_method to xtrabackup based parameter"
|
||||
"set up parameter wsrep_sst_method to xtrabackup based parameter"
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
@ -5884,10 +5900,10 @@ sub mysql_innodb {
|
|||
$defengine = $myvar{'default_storage_engine'}
|
||||
if defined( $myvar{'default_storage_engine'} );
|
||||
badprint
|
||||
"InnoDB Storage engine is disabled. $defengine is the default storage engine"
|
||||
"InnoDB Storage engine is disabled. $defengine is the default storage engine"
|
||||
if $defengine eq 'InnoDB';
|
||||
infoprint
|
||||
"InnoDB Storage engine is disabled. $defengine is the default storage engine"
|
||||
"InnoDB Storage engine is disabled. $defengine is the default storage engine"
|
||||
if $defengine ne 'InnoDB';
|
||||
}
|
||||
return;
|
||||
|
@ -6112,7 +6128,7 @@ sub mysql_innodb {
|
|||
. $mycalc{'pct_read_efficiency'} . "% ("
|
||||
. ( $mystat{'Innodb_buffer_pool_read_requests'} -
|
||||
$mystat{'Innodb_buffer_pool_reads'} )
|
||||
. " hits/ "
|
||||
. " hits / "
|
||||
. $mystat{'Innodb_buffer_pool_read_requests'}
|
||||
. " total)";
|
||||
}
|
||||
|
@ -6121,7 +6137,7 @@ sub mysql_innodb {
|
|||
. $mycalc{'pct_read_efficiency'} . "% ("
|
||||
. ( $mystat{'Innodb_buffer_pool_read_requests'} -
|
||||
$mystat{'Innodb_buffer_pool_reads'} )
|
||||
. " hits/ "
|
||||
. " hits / "
|
||||
. $mystat{'Innodb_buffer_pool_read_requests'}
|
||||
. " total)";
|
||||
}
|
||||
|
@ -6134,7 +6150,7 @@ sub mysql_innodb {
|
|||
. abs( $mycalc{'pct_write_efficiency'} ) . "% ("
|
||||
. abs( $mystat{'Innodb_log_write_requests'} -
|
||||
$mystat{'Innodb_log_writes'} )
|
||||
. " hits/ "
|
||||
. " hits / "
|
||||
. $mystat{'Innodb_log_write_requests'}
|
||||
. " total)";
|
||||
}
|
||||
|
@ -6143,7 +6159,7 @@ sub mysql_innodb {
|
|||
. $mycalc{'pct_write_efficiency'} . "% ("
|
||||
. ( $mystat{'Innodb_log_write_requests'} -
|
||||
$mystat{'Innodb_log_writes'} )
|
||||
. " hits/ "
|
||||
. " hits / "
|
||||
. $mystat{'Innodb_log_write_requests'}
|
||||
. " total)";
|
||||
}
|
||||
|
@ -6554,7 +6570,7 @@ sub mysql_indexes {
|
|||
subheaderprint "Indexes Metrics";
|
||||
unless ( mysql_version_ge( 5, 5 ) ) {
|
||||
infoprint
|
||||
"Skip Index metrics from information schema are missing in this version";
|
||||
"Skip Index metrics from information schema are missing in this version";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -6681,7 +6697,7 @@ sub mysql_views() {
|
|||
subheaderprint "Views Metrics";
|
||||
unless ( mysql_version_ge( 5, 5 ) ) {
|
||||
infoprint
|
||||
"Skip Index metrics from information schema are missing in this version";
|
||||
"Skip Index metrics from information schema are missing in this version";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -6690,7 +6706,7 @@ sub mysql_routines() {
|
|||
subheaderprint "Routines Metrics";
|
||||
unless ( mysql_version_ge( 5, 5 ) ) {
|
||||
infoprint
|
||||
"Skip Index metrics from information schema are missing in this version";
|
||||
"Skip Index metrics from information schema are missing in this version";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -6699,7 +6715,7 @@ sub mysql_triggers() {
|
|||
subheaderprint "Triggers Metrics";
|
||||
unless ( mysql_version_ge( 5, 5 ) ) {
|
||||
infoprint
|
||||
"Skip Index metrics from information schema are missing in this version";
|
||||
"Skip Index metrics from information schema are missing in this version";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -6925,7 +6941,7 @@ __END__
|
|||
|
||||
=head1 NAME
|
||||
|
||||
MySQLTuner 2.0.7 - MySQL High Performance Tuning Script
|
||||
MySQLTuner 2.0.10 - MySQL High Performance Tuning Script
|
||||
|
||||
=head1 IMPORTANT USAGE GUIDELINES
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue