Generate 2.5.2 sub version at 2024-02-06T17:58:35+01:00
This commit is contained in:
parent
b3a776576e
commit
30d1d9ecc6
2 changed files with 62 additions and 44 deletions
2
USAGE.md
2
USAGE.md
|
@ -1,6 +1,6 @@
|
||||||
# NAME
|
# NAME
|
||||||
|
|
||||||
MySQLTuner 2.5.1 - MySQL High Performance Tuning Script
|
MySQLTuner 2.5.2 - MySQL High Performance Tuning Script
|
||||||
|
|
||||||
# IMPORTANT USAGE GUIDELINES
|
# IMPORTANT USAGE GUIDELINES
|
||||||
|
|
||||||
|
|
104
mysqltuner.pl
104
mysqltuner.pl
|
@ -1,5 +1,4 @@
|
||||||
#!/usr/bin/env perl
|
# mysqltuner.pl - Version 2.5.2
|
||||||
# mysqltuner.pl - Version 2.5.1
|
|
||||||
# High Performance MySQL Tuning Script
|
# High Performance MySQL Tuning Script
|
||||||
# Copyright (C) 2015-2023 Jean-Marie Renouard - jmrenouard@gmail.com
|
# Copyright (C) 2015-2023 Jean-Marie Renouard - jmrenouard@gmail.com
|
||||||
# Copyright (C) 2006-2023 Major Hayden - major@mhtx.net
|
# Copyright (C) 2006-2023 Major Hayden - major@mhtx.net
|
||||||
|
@ -57,7 +56,7 @@ use Cwd 'abs_path';
|
||||||
#use Env;
|
#use Env;
|
||||||
|
|
||||||
# Set up a few variables for use in the script
|
# Set up a few variables for use in the script
|
||||||
my $tunerversion = "2.5.1";
|
my $tunerversion = "2.5.2";
|
||||||
my ( @adjvars, @generalrec );
|
my ( @adjvars, @generalrec );
|
||||||
|
|
||||||
# Set defaults
|
# Set defaults
|
||||||
|
@ -197,7 +196,7 @@ if ( exists $opt{passenv} && exists $ENV{ $opt{passenv} } ) {
|
||||||
$opt{pass} = $opt{password} if ( $opt{pass} eq 0 and $opt{password} ne 0 );
|
$opt{pass} = $opt{password} if ( $opt{pass} eq 0 and $opt{password} ne 0 );
|
||||||
|
|
||||||
if ( $opt{dumpdir} ne '' ) {
|
if ( $opt{dumpdir} ne '' ) {
|
||||||
$opt{dumpdir} = abs_path( $opt{dumpdir} );
|
$opt{dumpdir}= abs_path($opt{dumpdir});
|
||||||
if ( !-d $opt{dumpdir} ) {
|
if ( !-d $opt{dumpdir} ) {
|
||||||
mkdir $opt{dumpdir} or die "Cannot create directory $opt{dumpdir}: $!";
|
mkdir $opt{dumpdir} or die "Cannot create directory $opt{dumpdir}: $!";
|
||||||
}
|
}
|
||||||
|
@ -2526,7 +2525,7 @@ sub check_architecture {
|
||||||
}
|
}
|
||||||
elsif ( `uname` =~ /Darwin/ && `uname -m` =~ /x86_64/ ) {
|
elsif ( `uname` =~ /Darwin/ && `uname -m` =~ /x86_64/ ) {
|
||||||
|
|
||||||
# Darwin gibas.local 12.5.1 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64
|
# Darwin gibas.local 12.5.2 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64
|
||||||
$arch = 64;
|
$arch = 64;
|
||||||
goodprint "Operating on 64-bit architecture";
|
goodprint "Operating on 64-bit architecture";
|
||||||
}
|
}
|
||||||
|
@ -3211,6 +3210,11 @@ sub calculations {
|
||||||
$mystat{'Innodb_buffer_pool_pages_total'}
|
$mystat{'Innodb_buffer_pool_pages_total'}
|
||||||
) if defined $mystat{'Innodb_buffer_pool_pages_total'};
|
) if defined $mystat{'Innodb_buffer_pool_pages_total'};
|
||||||
|
|
||||||
|
$mycalc{'innodb_buffer_alloc_pct'}=select_one(
|
||||||
|
"select round( 100* sum(allocated)/( select VARIABLE_VALUE ".
|
||||||
|
"FROM performance_schema.global_variables " .
|
||||||
|
"WHERE VARIABLE_NAME='innodb_buffer_pool_size' ) ,2)".
|
||||||
|
'FROM sys.x\$innodb_buffer_stats_by_table;');
|
||||||
# Binlog Cache
|
# Binlog Cache
|
||||||
if ( $myvar{'log_bin'} ne 'OFF' ) {
|
if ( $myvar{'log_bin'} ne 'OFF' ) {
|
||||||
$mycalc{'pct_binlog_cache'} = percentage(
|
$mycalc{'pct_binlog_cache'} = percentage(
|
||||||
|
@ -6355,46 +6359,60 @@ sub mysql_innodb {
|
||||||
. hr_bytes( $enginestats{'InnoDB'} )
|
. hr_bytes( $enginestats{'InnoDB'} )
|
||||||
. ") if possible." );
|
. ") if possible." );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# select round( 100* sum(allocated)/( select VARIABLE_VALUE
|
||||||
|
# FROM performance_schema.global_variables
|
||||||
|
# where VARIABLE_NAME='innodb_buffer_pool_size' )
|
||||||
|
# ,2) as "PCT ALLOC/BUFFER POOL"
|
||||||
|
#from sys.x$innodb_buffer_stats_by_table;
|
||||||
|
|
||||||
|
if ($mycalc{innodb_buffer_alloc_pct} < 80) {
|
||||||
|
badprint "Ratio Buffer Pool allocated / Buffer Pool Size: ".
|
||||||
|
$mycalc{'innodb_buffer_alloc_pct'} . '%';
|
||||||
|
} else {
|
||||||
|
goodprint "Ratio Buffer Pool allocated / Buffer Pool Size: ".
|
||||||
|
$mycalc{'innodb_buffer_alloc_pct'} . '%';
|
||||||
|
}
|
||||||
if ( $mycalc{'innodb_log_size_pct'} < 20
|
if ( $mycalc{'innodb_log_size_pct'} < 20
|
||||||
or $mycalc{'innodb_log_size_pct'} > 30 )
|
or $mycalc{'innodb_log_size_pct'} > 30 )
|
||||||
{
|
{
|
||||||
if ( defined $myvar{'innodb_redo_log_capacity'} ) {
|
if ( defined $myvar{'innodb_redo_log_capacity'} ) {
|
||||||
badprint
|
badprint
|
||||||
"Ratio InnoDB redo log capacity / InnoDB Buffer pool size ("
|
"Ratio InnoDB redo log capacity / InnoDB Buffer pool size ("
|
||||||
. $mycalc{'innodb_log_size_pct'} . "%): "
|
. $mycalc{'innodb_log_size_pct'} . "%): "
|
||||||
. hr_bytes( $myvar{'innodb_redo_log_capacity'} ) . " / "
|
. hr_bytes( $myvar{'innodb_redo_log_capacity'} ) . " / "
|
||||||
. hr_bytes( $myvar{'innodb_buffer_pool_size'} )
|
. hr_bytes( $myvar{'innodb_buffer_pool_size'} )
|
||||||
. " should be equal to 25%";
|
. " should be equal to 25%";
|
||||||
push( @adjvars,
|
push( @adjvars,
|
||||||
"innodb_redo_log_capacity should be (="
|
"innodb_redo_log_capacity should be (="
|
||||||
. hr_bytes_rnd( $myvar{'innodb_buffer_pool_size'} / 4 )
|
. hr_bytes_rnd( $myvar{'innodb_buffer_pool_size'} / 4 )
|
||||||
. ") if possible, so InnoDB Redo log Capacity equals 25% of buffer pool size."
|
. ") if possible, so InnoDB Redo log Capacity equals 25% of buffer pool size."
|
||||||
);
|
);
|
||||||
push( @generalrec,
|
push( @generalrec,
|
||||||
"Be careful, increasing innodb_redo_log_capacity means higher crash recovery mean time"
|
"Be careful, increasing innodb_redo_log_capacity means higher crash recovery mean time"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
badprint "Ratio InnoDB log file size / InnoDB Buffer pool size ("
|
badprint "Ratio InnoDB log file size / InnoDB Buffer pool size ("
|
||||||
. $mycalc{'innodb_log_size_pct'} . "%): "
|
. $mycalc{'innodb_log_size_pct'} . "%): "
|
||||||
. hr_bytes( $myvar{'innodb_log_file_size'} ) . " * "
|
. hr_bytes( $myvar{'innodb_log_file_size'} ) . " * "
|
||||||
. $myvar{'innodb_log_files_in_group'} . " / "
|
. $myvar{'innodb_log_files_in_group'} . " / "
|
||||||
. hr_bytes( $myvar{'innodb_buffer_pool_size'} )
|
. hr_bytes( $myvar{'innodb_buffer_pool_size'} )
|
||||||
. " should be equal to 25%";
|
. " should be equal to 25%";
|
||||||
push(
|
push(
|
||||||
@adjvars,
|
@adjvars,
|
||||||
"innodb_log_file_size should be (="
|
"innodb_log_file_size should be (="
|
||||||
. hr_bytes_rnd(
|
. hr_bytes_rnd(
|
||||||
$myvar{'innodb_buffer_pool_size'} /
|
$myvar{'innodb_buffer_pool_size'} /
|
||||||
$myvar{'innodb_log_files_in_group'} / 4
|
$myvar{'innodb_log_files_in_group'} / 4
|
||||||
)
|
)
|
||||||
. ") if possible, so InnoDB total log file size equals 25% of buffer pool size."
|
. ") if possible, so InnoDB total log file size equals 25% of buffer pool size."
|
||||||
);
|
);
|
||||||
push( @generalrec,
|
push( @generalrec,
|
||||||
"Be careful, increasing innodb_log_file_size / innodb_log_files_in_group means higher crash recovery mean time"
|
"Be careful, increasing innodb_log_file_size / innodb_log_files_in_group means higher crash recovery mean time"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
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, total 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."
|
||||||
);
|
);
|
||||||
|
@ -7371,7 +7389,7 @@ __END__
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
MySQLTuner 2.5.1 - MySQL High Performance Tuning Script
|
MySQLTuner 2.5.2 - MySQL High Performance Tuning Script
|
||||||
|
|
||||||
=head1 IMPORTANT USAGE GUIDELINES
|
=head1 IMPORTANT USAGE GUIDELINES
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue