Update Vulnerabilities list
Indenting mysqltuner Update Usage information
This commit is contained in:
parent
d37a1f7c79
commit
1e9920b545
2 changed files with 225 additions and 59 deletions
156
USAGE.md
156
USAGE.md
|
@ -0,0 +1,156 @@
|
|||
# NAME
|
||||
|
||||
MySQLTuner 1.8.1 - MySQL High Performance Tuning Script
|
||||
|
||||
# IMPORTANT USAGE GUIDELINES
|
||||
|
||||
To run the script with the default options, run the script without arguments
|
||||
Allow MySQL server to run for at least 24-48 hours before trusting suggestions
|
||||
Some routines may require root level privileges (script will provide warnings)
|
||||
You must provide the remote server's total memory when connecting to other servers
|
||||
|
||||
# CONNECTION AND AUTHENTICATION
|
||||
|
||||
--host <hostname> Connect to a remote host to perform tests (default: localhost)
|
||||
--socket <socket> Use a different socket for a local connection
|
||||
--port <port> Port to use for connection (default: 3306)
|
||||
--user <username> Username to use for authentication
|
||||
--userenv <envvar> Name of env variable which contains username to use for authentication
|
||||
--pass <password> Password to use for authentication
|
||||
--passenv <envvar> Name of env variable which contains password to use for authentication
|
||||
--ssl-ca <path> Path to public key
|
||||
--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
|
||||
|
||||
# PERFORMANCE AND REPORTING OPTIONS
|
||||
|
||||
--skipsize Don't enumerate tables and their types/sizes (default: on)
|
||||
(Recommended for servers with many tables)
|
||||
--skippassword Don't perform checks on user passwords(default: off)
|
||||
--checkversion Check for updates to MySQLTuner (default: don't check)
|
||||
--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)
|
||||
|
||||
# OUTPUT OPTIONS
|
||||
|
||||
--silent Don't output anything on screen
|
||||
--nogood Remove OK responses
|
||||
--nobad Remove negative/suggestion responses
|
||||
--noinfo Remove informational responses
|
||||
--debug Print debug information
|
||||
--noprocess Consider no other process is running
|
||||
--dbstat Print database information
|
||||
--nodbstat Don't Print database information
|
||||
--tbstat Print table information
|
||||
--notbstat Don't Print table information
|
||||
--colstat Print column information
|
||||
--nocolstat Don't Print column information
|
||||
--idxstat Print index information
|
||||
--noidxstat Don't Print index information
|
||||
--sysstat Print system information
|
||||
--nosysstat Don't Print system information
|
||||
--pfstat Print Performance schema
|
||||
--nopfstat Don't Print Performance schema
|
||||
--verbose Prints out all options (default: no verbose, dbstat, idxstat, sysstat, tbstat, pfstat)
|
||||
--bannedports Ports banned separated by comma(,)
|
||||
--maxportallowed Number of ports opened allowed on this hosts
|
||||
--cvefile <path> CVE File for vulnerability checks
|
||||
--nocolor Don't print output in color
|
||||
--json Print result as JSON string
|
||||
--buffers Print global and per-thread buffer values
|
||||
--outputfile <path> Path to a output txt file
|
||||
--reportfile <path> Path to a report txt file
|
||||
--template <path> Path to a template file
|
||||
|
||||
# PERLDOC
|
||||
|
||||
You can find documentation for this module with the perldoc command.
|
||||
|
||||
perldoc mysqltuner
|
||||
|
||||
## INTERNALS
|
||||
|
||||
[https://github.com/major/MySQLTuner-perl/blob/master/INTERNALS.md](https://github.com/major/MySQLTuner-perl/blob/master/INTERNALS.md)
|
||||
|
||||
Internal documentation
|
||||
|
||||
# AUTHORS
|
||||
|
||||
Major Hayden - major@mhtx.net
|
||||
|
||||
# CONTRIBUTORS
|
||||
|
||||
- Matthew Montgomery
|
||||
- Paul Kehrer
|
||||
- Dave Burgess
|
||||
- Jonathan Hinds
|
||||
- Mike Jackson
|
||||
- Nils Breunese
|
||||
- Shawn Ashlee
|
||||
- Luuk Vosslamber
|
||||
- Ville Skytta
|
||||
- Trent Hornibrook
|
||||
- Jason Gill
|
||||
- Mark Imbriaco
|
||||
- Greg Eden
|
||||
- Aubin Galinotti
|
||||
- Giovanni Bechis
|
||||
- Bill Bradford
|
||||
- Ryan Novosielski
|
||||
- Michael Scheidell
|
||||
- Blair Christensen
|
||||
- Hans du Plooy
|
||||
- Victor Trac
|
||||
- Everett Barnes
|
||||
- Tom Krouper
|
||||
- Gary Barrueto
|
||||
- Simon Greenaway
|
||||
- Adam Stein
|
||||
- Isart Montane
|
||||
- Baptiste M.
|
||||
- Cole Turner
|
||||
- Major Hayden
|
||||
- Joe Ashcraft
|
||||
- Jean-Marie Renouard
|
||||
- Stephan GroBberndt
|
||||
- Christian Loos
|
||||
|
||||
# SUPPORT
|
||||
|
||||
Bug reports, feature requests, and downloads at http://mysqltuner.pl/
|
||||
|
||||
Bug tracker can be found at https://github.com/major/MySQLTuner-perl/issues
|
||||
|
||||
Maintained by Major Hayden (major\\@mhtx.net) - Licensed under GPL
|
||||
|
||||
# SOURCE CODE
|
||||
|
||||
[https://github.com/major/MySQLTuner-perl](https://github.com/major/MySQLTuner-perl)
|
||||
|
||||
git clone https://github.com/major/MySQLTuner-perl.git
|
||||
|
||||
# COPYRIGHT AND LICENSE
|
||||
|
||||
Copyright (C) 2006-2021 Major Hayden - major@mhtx.net
|
||||
|
||||
For the latest updates, please visit http://mysqltuner.pl/
|
||||
|
||||
Git repository available at https://github.com/major/MySQLTuner-perl
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
128
mysqltuner.pl
128
mysqltuner.pl
|
@ -204,7 +204,7 @@ $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
|
||||
$opt{pfstat} = 0
|
||||
$opt{pfstat} = 0
|
||||
if ( $opt{nopfstat} == 1 ); # Don't Print performance schema information
|
||||
$opt{idxstat} = 0 if ( $opt{noidxstat} == 1 ); # Don't Print index information
|
||||
|
||||
|
@ -1669,18 +1669,18 @@ sub get_kernel_info {
|
|||
infoprint "TCP slot entries is > 100.";
|
||||
}
|
||||
|
||||
if ( -f "/proc/sys/fs/aio-max-nr" )
|
||||
{
|
||||
if ( `sysctl -n fs.aio-max-nr` < 1000000 ) {
|
||||
badprint
|
||||
"Max running total of the number of events is < 1M, please consider having a value greater than 1M";
|
||||
push @generalrec, "setup Max running number events greater than 1M";
|
||||
push @adjvars,
|
||||
'fs.aio-max-nr > 1M (echo 1048576 > /proc/sys/fs/aio-max-nr)';
|
||||
} else {
|
||||
infoprint "Max Number of AIO events is > 1M.";
|
||||
}
|
||||
}
|
||||
if ( -f "/proc/sys/fs/aio-max-nr" ) {
|
||||
if ( `sysctl -n fs.aio-max-nr` < 1000000 ) {
|
||||
badprint
|
||||
"Max running total of the number of events is < 1M, please consider having a value greater than 1M";
|
||||
push @generalrec, "setup Max running number events greater than 1M";
|
||||
push @adjvars,
|
||||
'fs.aio-max-nr > 1M (echo 1048576 > /proc/sys/fs/aio-max-nr)';
|
||||
}
|
||||
else {
|
||||
infoprint "Max Number of AIO events is > 1M.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub get_system_info {
|
||||
|
@ -2070,7 +2070,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' ) {
|
||||
|
@ -2742,18 +2742,21 @@ sub calculations {
|
|||
|
||||
# Table cache
|
||||
if ( $mystat{'Opened_tables'} > 0 ) {
|
||||
if (not defined($mystat{'Table_open_cache_hits'})) {
|
||||
$mycalc{'table_cache_hit_rate'} =
|
||||
int( $mystat{'Open_tables'} * 100 / $mystat{'Opened_tables'} );
|
||||
} else {
|
||||
$mycalc{'table_cache_hit_rate'} =
|
||||
int(
|
||||
$mystat{'Table_open_cache_hits'} * 100 / (
|
||||
$mystat{'Table_open_cache_hits'} +
|
||||
$mystat{'Table_open_cache_misses'} ) );
|
||||
}
|
||||
if ( not defined( $mystat{'Table_open_cache_hits'} ) ) {
|
||||
$mycalc{'table_cache_hit_rate'} =
|
||||
int( $mystat{'Open_tables'} * 100 / $mystat{'Opened_tables'} );
|
||||
}
|
||||
else {
|
||||
$mycalc{'table_cache_hit_rate'} = int(
|
||||
$mystat{'Table_open_cache_hits'} * 100 / (
|
||||
$mystat{'Table_open_cache_hits'} +
|
||||
$mystat{'Table_open_cache_misses'}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$mycalc{'table_cache_hit_rate'} = 100;
|
||||
}
|
||||
|
||||
|
@ -2811,8 +2814,10 @@ sub calculations {
|
|||
}
|
||||
|
||||
# InnoDB
|
||||
$myvar{'innodb_log_files_in_group'} = 1 unless defined($myvar{'innodb_log_files_in_group'});
|
||||
$myvar{"innodb_buffer_pool_instances"} = 1 unless defined($myvar{'innodb_buffer_pool_instances'});
|
||||
$myvar{'innodb_log_files_in_group'} = 1
|
||||
unless defined( $myvar{'innodb_log_files_in_group'} );
|
||||
$myvar{"innodb_buffer_pool_instances"} = 1
|
||||
unless defined( $myvar{'innodb_buffer_pool_instances'} );
|
||||
if ( $myvar{'have_innodb'} eq "YES" ) {
|
||||
$mycalc{'innodb_log_size_pct'} =
|
||||
( $myvar{'innodb_log_file_size'} *
|
||||
|
@ -3304,21 +3309,23 @@ sub mysql_stats {
|
|||
if ( $mystat{'Open_tables'} > 0 ) {
|
||||
if ( $mycalc{'table_cache_hit_rate'} < 20 ) {
|
||||
|
||||
unless (defined($mystat{'Table_open_cache_hits'})) {
|
||||
badprint "Table cache hit rate: $mycalc{'table_cache_hit_rate'}% ("
|
||||
. hr_num( $mystat{'Open_tables'} )
|
||||
. " hits / "
|
||||
. hr_num( $mystat{'Opened_tables'} )
|
||||
. " requests)";
|
||||
} else {
|
||||
badprint "Table cache hit rate: $mycalc{'table_cache_hit_rate'}% ("
|
||||
. hr_num( $mystat{'Table_open_cache_hits'} )
|
||||
. " hits / "
|
||||
. hr_num( $mystat{'Table_open_cache_hits'} +
|
||||
$mystat{'Table_open_cache_misses'} )
|
||||
. " requests)";
|
||||
}
|
||||
|
||||
unless ( defined( $mystat{'Table_open_cache_hits'} ) ) {
|
||||
badprint
|
||||
"Table cache hit rate: $mycalc{'table_cache_hit_rate'}% ("
|
||||
. hr_num( $mystat{'Open_tables'} )
|
||||
. " hits / "
|
||||
. hr_num( $mystat{'Opened_tables'} )
|
||||
. " requests)";
|
||||
}
|
||||
else {
|
||||
badprint
|
||||
"Table cache hit rate: $mycalc{'table_cache_hit_rate'}% ("
|
||||
. hr_num( $mystat{'Table_open_cache_hits'} )
|
||||
. " hits / "
|
||||
. hr_num( $mystat{'Table_open_cache_hits'} +
|
||||
$mystat{'Table_open_cache_misses'} )
|
||||
. " requests)";
|
||||
}
|
||||
|
||||
if ( mysql_version_ge( 5, 1 ) ) {
|
||||
$table_cache_var = "table_open_cache";
|
||||
|
@ -3360,20 +3367,23 @@ sub mysql_stats {
|
|||
. ")" );
|
||||
}
|
||||
else {
|
||||
unless (defined($mystat{'Table_open_cache_hits'})) {
|
||||
goodprint "Table cache hit rate: $mycalc{'table_cache_hit_rate'}% ("
|
||||
. hr_num( $mystat{'Open_tables'} )
|
||||
. " hits / "
|
||||
. hr_num( $mystat{'Opened_tables'} )
|
||||
. " requests)";
|
||||
} else {
|
||||
goodprint "Table cache hit rate: $mycalc{'table_cache_hit_rate'}% ("
|
||||
. hr_num( $mystat{'Table_open_cache_hits'} )
|
||||
. " hits / "
|
||||
. hr_num( $mystat{'Table_open_cache_hits'} +
|
||||
$mystat{'Table_open_cache_misses'} )
|
||||
. " requests)";
|
||||
}
|
||||
unless ( defined( $mystat{'Table_open_cache_hits'} ) ) {
|
||||
goodprint
|
||||
"Table cache hit rate: $mycalc{'table_cache_hit_rate'}% ("
|
||||
. hr_num( $mystat{'Open_tables'} )
|
||||
. " hits / "
|
||||
. hr_num( $mystat{'Opened_tables'} )
|
||||
. " requests)";
|
||||
}
|
||||
else {
|
||||
goodprint
|
||||
"Table cache hit rate: $mycalc{'table_cache_hit_rate'}% ("
|
||||
. hr_num( $mystat{'Table_open_cache_hits'} )
|
||||
. " hits / "
|
||||
. hr_num( $mystat{'Table_open_cache_hits'} +
|
||||
$mystat{'Table_open_cache_misses'} )
|
||||
. " requests)";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -5349,7 +5359,7 @@ sub trim {
|
|||
sub get_wsrep_options {
|
||||
return () unless defined $myvar{'wsrep_provider_options'};
|
||||
|
||||
my @galera_options = split /;/, $myvar{'wsrep_provider_options'};
|
||||
my @galera_options = split /;/, $myvar{'wsrep_provider_options'};
|
||||
my $wsrep_slave_threads = $myvar{'wsrep_slave_threads'};
|
||||
push @galera_options, ' wsrep_slave_threads = ' . $wsrep_slave_threads;
|
||||
@galera_options = remove_cr @galera_options;
|
||||
|
@ -5371,7 +5381,7 @@ sub get_wsrep_option {
|
|||
my @galera_options = get_wsrep_options;
|
||||
return '' unless scalar(@galera_options) > 0;
|
||||
my @memValues = grep /\s*$key =/, @galera_options;
|
||||
my $memValue = $memValues[0];
|
||||
my $memValue = $memValues[0];
|
||||
return 0 unless defined $memValue;
|
||||
$memValue =~ s/.*=\s*(.+)$/$1/g;
|
||||
return $memValue;
|
||||
|
@ -5542,7 +5552,7 @@ having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0"
|
|||
goodprint "Galera Cluster address is defined: "
|
||||
. $myvar{'wsrep_cluster_address'};
|
||||
my @NodesTmp = split /,/, $myvar{'wsrep_cluster_address'};
|
||||
my $nbNodes = @NodesTmp;
|
||||
my $nbNodes = @NodesTmp;
|
||||
infoprint "There are $nbNodes nodes in wsrep_cluster_address";
|
||||
my $nbNodesSize = trim( $mystat{'wsrep_cluster_size'} );
|
||||
if ( $nbNodesSize == 3 or $nbNodesSize == 5 ) {
|
||||
|
|
Loading…
Reference in a new issue