Compare commits

..

No commits in common. "master" and "v2.5.2" have entirely different histories.

16 changed files with 167 additions and 677 deletions

View file

@ -1,6 +0,0 @@
*.md
build/**
Makefile
.perltidy
*.json
*.png

2
.gitignore vendored
View file

@ -18,5 +18,3 @@ result_*
sql/*.sql
sql/*.csv
cve.csv
default*.cnf
.env

54
.travis.yml Normal file
View file

@ -0,0 +1,54 @@
language: perl
perl:
- "5.24"
os: linux
dist: focal
services:
- docker
env:
- DB=mariadb:5.5
- DB=mariadb:10.2
- DB=mariadb:10.3
- DB=mariadb:10.4
- DB=mariadb:10.5
- DB=mysql:5.5
- DB=mysql:5.7
- DB=mysql:8.0
- DB=percona:5.6
- DB=percona:5.7
- DB=percona:8.0
install:
- cpanm --quiet --notest Data::Dumper
- cpanm --quiet --notest JSON
- cpanm --quiet --notest Perl::Critic
- cpanm --quiet --notest Text::Template
before_script:
- mysql --version
- mysqladmin --version
- docker run -it --name=mysqltestinstance -d -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -p 3306:3306 ${DB}
- echo -e "[client]\nuser=root\npassword=\"\"\nhost=127.0.0.1" > ~/.my.cnf
- chmod 600 ~/.my.cnf
- git clone https://github.com/datacharmer/test_db.git
- cd test_db
- count=10
- while ! mysql -e 'select version()' && [ $count -gt 0 ]; do echo $count seconds to go; sleep 1; count=$(( $count - 1 )); done
- if [[ $DB =~ .*:8.0 ]] ; then
for file in public_key.pem ca.pem server-cert.pem client-key.pem client-cert.pem ; do
docker cp mysqltestinstance:/var/lib/mysql/$file "${HOME}" ;
done ;
fi
- "cat employees.sql | grep -v 'storage_engine' | mysql"
- cd ..
script:
- ./mysqltuner.pl --verbose --tbstat 2>stderr.txt | tee -a "stdout.txt"
after_script:
- docker stop mysqltestinstance
- echo "Standard Output: $(cat stdout.txt)"
- echo "Standard Error : $(cat stderr.txt)"

View file

@ -127,7 +127,7 @@ these guidelines is the best way to get your work included in MySQLTuner.
<a name="git-flow"></a>
#### Git Flow for pull requests
1. [Fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo) the project, clone your fork,
1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork,
and configure the remotes:
```bash

View file

@ -1 +0,0 @@
2.5.4

View file

@ -1,31 +0,0 @@
FROM ubuntu:latest
LABEL maintainer="jmrenouard@gmail.com"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt upgrade -y && apt-get install -yq --no-install-recommends \
apt-utils \
curl \
wget \
perl \
perl-doc \
mysql-client \
libjson-perl \
libtext-template-perl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /results
RUN apt clean all
WORKDIR /
COPY ./mysqltuner.pl /mysqltuner.pl
COPY ./vulnerabilities.csv /vulnerabilities.txt
COPY ./basic_passwords.txt /basic_passwords.txt
COPY ./template_example.tpl /template.tpl
ENTRYPOINT [ "perl", "/mysqltuner.pl", "--passwordfile", "/basic_passwords.txt",\
"--cvefile", "/vulnerabilities.txt", "--nosysstat", "--defaults-file", \
"/defaults.cnf", "--dumpdir", "/results", "--outputfile", \
"/results/mysqltuner.txt", "--template", "/template.tpl", \
"--reportfile", "/results/mysqltuner.html" ]
CMD ["--verbose" ]

View file

@ -20,9 +20,8 @@ help:
installdep_debian:
sudo apt install -y cpanminus libpod-markdown-perl libwww-mechanize-gzip-perl perltidy dos2unix
sudo cpanm File::Util
curl -sL https://raw.githubusercontent.com/slimtoolkit/slim/master/scripts/install-slim.sh | sudo -E bash -
apt install -y cpanminus libpod-markdown-perl libwww-mechanize-gzip-perl perltidy dos2unix
cpanm File::Util
tidy:
dos2unix ./mysqltuner.pl
@ -40,10 +39,6 @@ generate_cve:
git add ./vulnerabilities.csv
git commit -m "Generate CVE list at $(shell date --iso=seconds)"
generate_version_file:
rm -f CURRENT_VERSION.txt
grep "# mysqltuner.pl - Version" ./mysqltuner.pl | awk '{ print $$NF}' > CURRENT_VERSION.txt
generate_features:
perl ./build/genFeatures.sh
git add ./FEATURES.md
@ -73,18 +68,5 @@ increment_major_version:
git tag -a v$(UPDATE_MINOR_VERSION) -m "Generate $(UPDATE_MAJOR_VERSION) major version at $(shell date --iso=seconds)"
git push --tags
docker_build:
docker build . -t jmrenouard/mysqltuner:latest -t jmrenouard/mysqltuner:$(VERSION)
docker_slim:
docker run --rm -it --privileged -v /var/run/docker.sock:/var/run/docker.sock -v $(PWD):/root/app -w /root/app jmrenouard/mysqltuner:latest slim build
docker_push: docker_build
bash build/publishtodockerhub.sh $(VERSION)
push:
git push
pull:
git pull

View file

@ -2,6 +2,7 @@
[!["Buy Us A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/jmrenouard)
[![Build Status - Master](https://travis-ci.org/major/MySQLTuner-perl.svg?branch=master)](https://travis-ci.org/major/MySQLTuner-perl)
[![Project Status](http://opensource.box.com/badges/active.svg)](http://opensource.box.com/badges)
[![Project Status](http://opensource.box.com/badges/maintenance.svg)](http://opensource.box.com/badges)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/major/MySQLTuner-perl.svg)](http://isitmaintained.com/project/major/MySQLTuner-perl "Average time to resolve an issue")

View file

@ -2,6 +2,7 @@
[!["Buy Us A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/jmrenouard)
[![Build Status - Master](https://travis-ci.org/major/MySQLTuner-perl.svg?branch=master)](https://travis-ci.org/major/MySQLTuner-perl)
[![Project Status](http://opensource.box.com/badges/active.svg)](http://opensource.box.com/badges)
[![Project Status](http://opensource.box.com/badges/maintenance.svg)](http://opensource.box.com/badges)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/major/MySQLTuner-perl.svg)](http://isitmaintained.com/project/major/MySQLTuner-perl "Average time to resolve an issue")

124
README.md
View file

@ -34,29 +34,26 @@ MySQLTuner needs you
## Stargazers over time
[![Stargazers over time](https://starchart.cc/major/MySQLTuner-perl.svg)](https://starchart.cc/major/MySQLTuner-perl)
[![Stargazers over time](https://starcharts.herokuapp.com/major/MySQLTuner-perl.svg)](https://starcharts.herokuapp.com/major/MySQLTuner-perl)
Compatibility
====
Test result are available here:
Test result are available here: [Travis CI/MySQLTuner-perl](https://travis-ci.org/major/MySQLTuner-perl)
* MySQL 8.0, 8.2, 8.3 (full support)
* Percona Server 8.0, 8.2, 8.3 (full support)
* MariaDB 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2 (full support)
* MySQL 8.0 (partial support, password checks don't work)
* Percona Server 8.0 (partial support, password checks don't work)
* MySQL 5.7 (full support)
* Percona Server 5.7 (full support)
* MariaDB 10.3 - 10.11 (full support)
* Galera replication (full support)
* Percona XtraDB cluster (full support)
* Mysql Replications (partial support, no test environment)
* MySQL 8.1 (not supported, deprecated version)
* Percona Server 5.7 (not supported, deprecated version)
* MySQL 5.7 (not supported, deprecated version)
* MySQL 5.6 and earlier (not supported, deprecated version)
* Percona Server 5.6 (not supported, deprecated version)
* MariaDB 10.7, 10.8, 10.9, 10.10 (not supported, deprecated version)
* MariaDB 10.3 and earlier (not supported, deprecated version)
* MariaDB 5.5 (not supported, deprecated version)
* MariaDB 10.2 and earlier (not supported, deprecated version)
***Windows Support is partial***
@ -68,30 +65,24 @@ Test result are available here:
* Cloud based is not supported at this time (Help wanted! GCP, AWS, Azure support requested)
***Unsupported storage engines: PRs welcome***
--
* NDB is not supported feel free to create a Pull Request
* MyISAM is too old and no longer active
* RockDB
* Archive
* Spider
* ColummStore
* TokuDB
* XtraDB
* Connect
Unmaintenained stuff from MySQL or MariaDB:
--
* MyISAM is too old and no longer active
* RockDB is not maintained anymore
* TokuDB is not maintained anymore
* XtraDB is not maintained anymore
* CVE vulnerabilities detection support from [https://cve.mitre.org](https://cve.mitre.org)
***MINIMAL REQUIREMENTS***
* Perl 5.6 or later (with [perl-doc](http://search.cpan.org/~dapm/perl-5.14.4/pod/perldoc.pod) package)
* Unix/Linux based operating system (tested on Linux, BSD variants, and Solaris variants)
* Unrestricted read access to the MySQL server
OS root access recommended for MySQL < 5.1
* Unrestricted read access to the MySQL server (OS root access recommended for MySQL < 5.1)
***WARNING***
--
@ -140,12 +131,9 @@ Optional Sysschema installation for MySQL 5.6
--
Sysschema is installed by default under MySQL 5.7 and MySQL 8 from Oracle.
By default, on MySQL 5.6/5.7/8, performance schema is enabled.
By default, on MySQL 5.6/5.7/8, performance schema is enabled by default.
For previous MySQL 5.6 version, you can follow this command to create a new database sys containing very useful view on Performance schema:
Sysschema for MySQL old version
--
```bash
curl "https://codeload.github.com/mysql/mysql-sys/zip/master" > sysschema.zip
# check zip file
@ -155,52 +143,18 @@ cd mysql-sys-master
mysql -uroot -p < sys_56.sql
```
Sysschema for MariaDB old version
Optional Performance schema and Sysschema installation for MariaDB < 10.6
--
```bash
curl "https://github.com/FromDual/mariadb-sys/archive/refs/heads/master.zip" > sysschema.zip
# check zip file
unzip -l sysschema.zip
unzip sysschema.zip
cd mariadb-sys-master
mysql -u root -p < ./sys_10.sql
```
Sysschema is not installed by default under MariaDB prior to 10.6 [MariaDB sys](https://mariadb.com/kb/en/sys-schema/)
Performance schema setup
--
By default, performance_schema is enabled and sysschema is installed on latest version.
By default, on MariaDB, performance schema is disabled (MariaDB<10.6).
Consider activating performance schema across your my.cnf configuration file:
By default, on MariaDB, performance schema is disabled by default. consider activating performance schema across your my.cnf configuration file:
```ini
[mysqld]
performance_schema = on
performance-schema-consumer-events-statements-history-long = ON
performance-schema-consumer-events-statements-history = ON
performance-schema-consumer-events-statements-current = ON
performance-schema-consumer-events-stages-current=ON
performance-schema-consumer-events-stages-history=ON
performance-schema-consumer-events-stages-history-long=ON
performance-schema-consumer-events-transactions-current=ON
performance-schema-consumer-events-transactions-history=ON
performance-schema-consumer-events-transactions-history-long=ON
performance-schema-consumer-events-waits-current=ON
performance-schema-consumer-events-waits-history=ON
performance-schema-consumer-events-waits-history-long=ON
performance-schema-instrument='%=ON'
max-digest-length=2048
performance-schema-max-digest-length=2018
```
Sysschema installation for MariaDB < 10.6
--
Sysschema is not installed by default under MariaDB prior to 10.6 [MariaDB sys](https://mariadb.com/kb/en/sys-schema/)
You can follow this command to create a new database sys containing a useful view on Performance schema:
```bash
@ -213,27 +167,13 @@ mysql -u root -p < ./sys_10.sql
```
Errors & solutions for performance schema installation
--
ERROR 1054 (42S22) at line 78 in file: './views/p_s/metrics_56.sql': Unknown column 'STATUS' in 'field list'
--
This error can be safely ignored
Consider using a recent MySQL/MariaDB version to avoid this kind of issue during sysschema installation
In recent versions, sysschema is installed and integrated by default as sys schema (SHOW DATABASES)
ERROR at line 21: Failed to open file './tables/sys_config_data_10.sql -- ported', error: 2
Have a look at #452 solution given by @ericx
--
Fixing sysctl configuration (/etc/sysctl.conf)
--
It is a system wide setting and not a database setting: [Linux FS Kernel settings](https://www.kernel.org/doc/html/latest/admin-guide/sysctl/fs.html#id1)
You can check its values via:
@ -312,14 +252,6 @@ perl mysqltuner.pl --silent --reportfile /tmp/result_mysqltuner.txt --template=/
__Important__: [Text::Template](https://metacpan.org/pod/Text::Template) module is mandatory for `--reportfile` and/or `--template` options, because this module is needed to generate appropriate output based on a text template.
__Usage:__ Dumping all information_schema and sysschema views as csv file into results subdirectory
```bash
perl mysqltuner.pl --verbose --dumpdir=./result
```
__Usage:__ Enable debugging information
```bash
@ -383,6 +315,7 @@ Follow instructions from Github repo
[GitHub AHA main repository](https://github.com/theZiz/aha)
**Using AHA Html report generation**
perl mysqltuner.pl --verbose --color > reports.txt
@ -473,22 +406,15 @@ After which, `~/.mylogin.cnf` will be created with the appropriate access.
To get information about stored credentials, use the following command:
```bash
$mysql_config_editor print
[client]
user = someusername
password = *****
host = localhost
```
$mysql_config_editor print
[client]
user = someusername
password = *****
host = localhost
**Question: What's minimum privileges needed by a specific mysqltuner user in database ?**
```bash
mysql>GRANT SELECT, PROCESS,EXECUTE, REPLICATION CLIENT,
SHOW DATABASES,SHOW VIEW
ON *.*
TO 'mysqltuner'@'localhost' identified by pwd1234;
```
mysql>GRANT SELECT, PROCESS,EXECUTE, REPLICATION CLIENT,SHOW DATABASES,SHOW VIEW ON *.* TO 'mysqltuner'@'localhost' identified by pwd1234;
**Question: It's not working on my OS! What gives?!**

View file

@ -2,6 +2,7 @@
[!["Buy Us A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/jmrenouard)
[![Build Status - Master](https://travis-ci.org/major/MySQLTuner-perl.svg?branch=master)](https://travis-ci.org/major/MySQLTuner-perl)
[![Project Status](http://opensource.box.com/badges/active.svg)](http://opensource.box.com/badges)
[![Project Status](http://opensource.box.com/badges/maintenance.svg)](http://opensource.box.com/badges)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/major/MySQLTuner-perl.svg)](http://isitmaintained.com/project/major/MySQLTuner-perl "Average time to resolve an issue")
@ -35,11 +36,11 @@ MySQLTuner нуждается в вас:
## Количество "звезд" по времени
[![Stargazers over time](https://starchart.cc/major/MySQLTuner-perl.svg)](https://starchart.cc/major/MySQLTuner-perl)
[![Stargazers over time](https://starcharts.herokuapp.com/major/MySQLTuner-perl.svg)](https://starcharts.herokuapp.com/major/MySQLTuner-perl)
Совместимость
====
Результаты тестов:
Результаты тестов: [Travis CI/MySQLTuner-perl](https://travis-ci.org/major/MySQLTuner-perl)
* MySQL 8 (полная поддержка, проверка пароля не работает)
* MySQL 5.7 (полная поддержка)
* MySQL 5.6 (полная поддержка)

View file

@ -1,6 +1,6 @@
# NAME
MySQLTuner 2.6.0 - MySQL High Performance Tuning Script
MySQLTuner 2.5.2 - MySQL High Performance Tuning Script
# IMPORTANT USAGE GUIDELINES
@ -44,20 +44,15 @@ You must provide the remote server's total memory when connecting to other serve
--template <path> Path to a template file
--dumpdir <path> Path to a directory where to dump information files
--feature <feature> Run a specific feature (see FEATURES section)
--dumpdir <path> information_schema tables and sys views are dumped in CSV in this path
# OUTPUT OPTIONS
=head1 OUTPUT OPTIONS
--silent Don't output anything on screen
--verbose Print out all options (default: no verbose, dbstat, idxstat, sysstat, tbstat, pfstat)
--color Print output in color
--nocolor Don't print output in color
--nogood Remove OK responses
--nobad Remove negative/suggestion responses
--noinfo Remove informational responses
--debug Print debug information
--experimental Print experimental analysis (may fail)
--nondedicated Consider server is not dedicated to Db server usage only
--noprocess Consider no other process is running
--dbstat Print database information
--nodbstat Don't print database information

View file

@ -1,11 +0,0 @@
#!/bin/bash
[ -f "./.env" ] && source ./.env
[ -f "../.env" ] && source ../.env
VERSION=$1
docker login -u $DOCKER_USER_LOGIN -p $DOCKER_USER_PASSWORD
docker tag jmrenouard/mysqltuner:latest jmrenouard/mysqltuner:$VERSION
docker push jmrenouard/mysqltuner:latest
docker push jmrenouard/mysqltuner:$VERSION

View file

@ -1,4 +1,4 @@
#!/usr/bin/env perl
#!/usr/bin/perl
use warnings;
use strict;
use WWW::Mechanize::GZip;
@ -74,7 +74,6 @@ foreach my $line (<CVE>) {
}
}
close(CVE);
chmod 0644, "./cve.csv", "../vulnerabilities.csv";
#unlink ('cve.csv') if (-f 'cve.csv');
exit(0);

View file

@ -1,5 +1,4 @@
#!/usr/bin/env perl
# mysqltuner.pl - Version 2.6.0
# mysqltuner.pl - Version 2.5.2
# High Performance MySQL Tuning Script
# Copyright (C) 2015-2023 Jean-Marie Renouard - jmrenouard@gmail.com
# Copyright (C) 2006-2023 Major Hayden - major@mhtx.net
@ -57,7 +56,7 @@ use Cwd 'abs_path';
#use Env;
# Set up a few variables for use in the script
my $tunerversion = "2.6.0";
my $tunerversion = "2.5.2";
my ( @adjvars, @generalrec );
# Set defaults
@ -109,8 +108,6 @@ my %opt = (
"prettyjson" => 0,
"reportfile" => 0,
"verbose" => 0,
"experimental" => 0,
"nondedicated" => 0,
"defaults-file" => '',
"defaults-extra-file" => '',
"protocol" => '',
@ -153,8 +150,7 @@ GetOptions(
'server-log=s', 'protocol=s',
'defaults-extra-file=s', 'dumpdir=s',
'feature=s', 'dbgpattern=s',
'defaultarch=i', 'experimental',
'nondedicated'
'defaultarch=i'
)
or pod2usage(
-exitval => 1,
@ -212,15 +208,10 @@ $basic_password_files = "/usr/share/mysqltuner/basic_passwords.txt"
$opt{dbgpattern} = '.*' if ( $opt{dbgpattern} eq '' );
# Activate debug variables
#if ( $opt{debug} ne '' ) { $opt{debug} = 2; }
# Activate experimental calculations and analysis
#if ( $opt{experimental} ne '' ) { $opt{experimental} = 1; }
# check if we need to enable verbose mode
if ( $opt{feature} ne '' ) { $opt{verbose} = 1; }
if ( $opt{verbose} ) {
$opt{checkversion} = 0; # Check for updates to MySQLTuner
$opt{checkversion} = 1; # Check for updates to MySQLTuner
$opt{dbstat} = 1; # Print database information
$opt{tbstat} = 1; # Print database information
$opt{idxstat} = 1; # Print index information
@ -595,8 +586,6 @@ sub os_setup {
chomp($physical_memory);
chomp($swap_memory);
chomp($os);
$physical_memory = $opt{forcemem}
if ( defined( $opt{forcemem} ) and $opt{forcemem} gt 0 );
$result{'OS'}{'OS Type'} = $os;
$result{'OS'}{'Physical Memory'}{'bytes'} = $physical_memory;
$result{'OS'}{'Physical Memory'}{'pretty'} = hr_bytes($physical_memory);
@ -774,9 +763,9 @@ sub mysql_setup {
$mysqladmincmd = $opt{mysqladmin};
}
else {
$mysqladmincmd = which( "mariadb-admin", $ENV{'PATH'} );
$mysqladmincmd = which( "mysqladmin", $ENV{'PATH'} );
if ( !-e $mysqladmincmd ) {
$mysqladmincmd = which( "mysqladmin", $ENV{'PATH'} );
$mysqladmincmd = which( "mariadb-admin", $ENV{'PATH'} );
}
}
chomp($mysqladmincmd);
@ -795,9 +784,9 @@ sub mysql_setup {
$mysqlcmd = $opt{mysqlcmd};
}
else {
$mysqlcmd = which( "mariadb", $ENV{'PATH'} );
$mysqlcmd = which( "mysql", $ENV{'PATH'} );
if ( !-e $mysqlcmd ) {
$mysqlcmd = which( "mysql", $ENV{'PATH'} );
$mysqlcmd = which( "mariadb", $ENV{'PATH'} );
}
}
chomp($mysqlcmd);
@ -1590,9 +1579,12 @@ sub log_file_recommendations {
while ( my $logLi = <$fh> ) {
chomp $logLi;
$numLi++;
debugprint "$numLi: $logLi" if $logLi =~ /\[(warning|error)\]/i;
$nbErrLog++ if $logLi =~ /\[error\]/i;
$nbWarnLog++ if $logLi =~ /\[warning\]/i;
debugprint "$numLi: $logLi"
if $logLi =~ /warning|error/i and $logLi !~ /Logging to/;
$nbErrLog++
if $logLi =~ /error/i
and $logLi !~ /(Logging to|\[Warning\].*ERROR_FOR_DIVISION_BY_ZERO)/;
$nbWarnLog++ if $logLi =~ /warning/i;
push @lastShutdowns, $logLi
if $logLi =~ /Shutdown complete/ and $logLi !~ /Innodb/i;
push @lastStarts, $logLi if $logLi =~ /ready for connections/;
@ -2053,28 +2045,17 @@ sub system_recommendations {
infoprint "User process except mysqld used "
. hr_bytes_rnd($omem) . " RAM.";
if ( ( 0.15 * $physical_memory ) < $omem ) {
if ( $opt{nondedicated} ) {
infoprint "No warning with --nondedicated option";
infoprint
badprint
"Other user process except mysqld used more than 15% of total physical memory "
. percentage( $omem, $physical_memory ) . "% ("
. hr_bytes_rnd($omem) . " / "
. hr_bytes_rnd($physical_memory) . ")";
}
else {
badprint
"Other user process except mysqld used more than 15% of total physical memory "
. percentage( $omem, $physical_memory ) . "% ("
. hr_bytes_rnd($omem) . " / "
. hr_bytes_rnd($physical_memory) . ")";
push( @generalrec,
. percentage( $omem, $physical_memory ) . "% ("
. hr_bytes_rnd($omem) . " / "
. hr_bytes_rnd($physical_memory) . ")";
push( @generalrec,
"Consider stopping or dedicate server for additional process other than mysqld."
);
push( @adjvars,
);
push( @adjvars,
"DON'T APPLY SETTINGS BECAUSE THERE ARE TOO MANY PROCESSES RUNNING ON THIS SERVER. OOM KILL CAN OCCUR!"
);
}
);
}
else {
infoprint
@ -2435,13 +2416,17 @@ sub validate_mysql_version {
prettyprint " ";
if ( mysql_version_eq(9)
or mysql_version_eq(8, 4)
or mysql_version_eq(8, 0)
if ( mysql_version_eq(8)
or mysql_version_eq( 5, 7 )
or mysql_version_eq( 10, 3 )
or mysql_version_eq( 10, 4 )
or mysql_version_eq( 10, 5 )
or mysql_version_eq( 10, 6 )
or mysql_version_eq( 10, 11 )
or mysql_version_eq( 11, 4 ) )
or mysql_version_eq( 10, 7 )
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'} . "";
@ -2544,7 +2529,7 @@ sub check_architecture {
}
elsif ( `uname` =~ /Darwin/ && `uname -m` =~ /x86_64/ ) {
# Darwin gibas.local 12.6.0 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;
goodprint "Operating on 64-bit architecture";
}
@ -3179,16 +3164,10 @@ sub calculations {
$myvar{"innodb_buffer_pool_instances"} = 1
unless defined( $myvar{'innodb_buffer_pool_instances'} );
if ( $myvar{'have_innodb'} eq "YES" ) {
if ( defined $myvar{'innodb_redo_log_capacity'} ) {
$mycalc{'innodb_log_size_pct'} =
( $myvar{'innodb_redo_log_capacity'} /
$myvar{'innodb_buffer_pool_size'} ) * 100;
} else {
$mycalc{'innodb_log_size_pct'} =
( $myvar{'innodb_log_file_size'} *
$myvar{'innodb_log_files_in_group'} * 100 /
$myvar{'innodb_buffer_pool_size'} );
}
$mycalc{'innodb_log_size_pct'} =
( $myvar{'innodb_log_file_size'} *
$myvar{'innodb_log_files_in_group'} * 100 /
$myvar{'innodb_buffer_pool_size'} );
}
if ( !defined $myvar{'innodb_buffer_pool_size'} ) {
$mycalc{'innodb_log_size_pct'} = 0;
@ -3235,13 +3214,11 @@ sub calculations {
$mystat{'Innodb_buffer_pool_pages_total'}
) if defined $mystat{'Innodb_buffer_pool_pages_total'};
my $lreq =
"select ROUND( 100* sum(allocated)/ "
. $myvar{'innodb_buffer_pool_size'}
. ',1) FROM sys.x\$innodb_buffer_stats_by_table;';
debugprint("lreq: $lreq");
$mycalc{'innodb_buffer_alloc_pct'} = select_one($lreq)
if ( $opt{experimental} );
$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
if ( $myvar{'log_bin'} ne 'OFF' ) {
@ -3385,18 +3362,10 @@ sub mysql_stats {
if ( $physical_memory <
( $mycalc{'max_peak_memory'} + get_other_process_memory() ) )
{
if ( $opt{nondedicated} ) {
infoprint "No warning with --nondedicated option";
infoprint
"Overall possible memory usage with other process exceeded memory";
}
else {
badprint
"Overall possible memory usage with other process exceeded memory";
push( @generalrec,
"Dedicate this server to your database for highest performance."
);
}
badprint
"Overall possible memory usage with other process exceeded memory";
push( @generalrec,
"Dedicate this server to your database for highest performance." );
}
else {
goodprint
@ -6397,27 +6366,18 @@ sub mysql_innodb {
}
# select round( 100* sum(allocated)/( select VARIABLE_VALUE
# FROM information_schema.global_variables
# 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 ( $opt{experimental} ) {
debugprint( 'innodb_buffer_alloc_pct: "'
. $mycalc{innodb_buffer_alloc_pct}
. '"' );
if ( defined $mycalc{innodb_buffer_alloc_pct}
and $mycalc{innodb_buffer_alloc_pct} ne '' )
{
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_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
or $mycalc{'innodb_log_size_pct'} > 30 )
@ -7238,8 +7198,6 @@ sub headerprint {
. "\t * Major Hayden <major\@mhtx.net>\n"
. " >> Bug reports, feature requests, and downloads at http://mysqltuner.pl/\n"
. " >> Run with '--help' for additional options and output filtering";
debugprint( "Debug: " . $opt{debug} );
debugprint( "Experimental: " . $opt{experimental} );
}
sub string2file {
@ -7250,12 +7208,12 @@ sub string2file {
"Unable to open $filename in write mode. Please check permissions for this file or directory";
print $fh $content if defined($content);
close $fh;
debugprint $content;
debugprint $content if ( $opt{'debug'} );
}
sub file2array {
my $filename = shift;
debugprint "* reading $filename";
debugprint "* reading $filename" if ( $opt{'debug'} );
my $fh;
open( $fh, q(<), "$filename" )
or die "Couldn't open $filename for reading: $!\n";
@ -7441,7 +7399,7 @@ __END__
=head1 NAME
MySQLTuner 2.6.0 - MySQL High Performance Tuning Script
MySQLTuner 2.5.2 - MySQL High Performance Tuning Script
=head1 IMPORTANT USAGE GUIDELINES
@ -7485,8 +7443,6 @@ You must provide the remote server's total memory when connecting to other serve
--template <path> Path to a template file
--dumpdir <path> Path to a directory where to dump information files
--feature <feature> Run a specific feature (see FEATURES section)
--dumpdir <path> information_schema tables and sys views are dumped in CSV in this path
=head1 OUTPUT OPTIONS
--silent Don't output anything on screen
@ -7497,8 +7453,6 @@ You must provide the remote server's total memory when connecting to other serve
--nobad Remove negative/suggestion responses
--noinfo Remove informational responses
--debug Print debug information
--experimental Print experimental analysis (may fail)
--nondedicated Consider server is not dedicated to Db server usage only
--noprocess Consider no other process is running
--dbstat Print database information
--nodbstat Don't print database information

View file

@ -1,372 +0,0 @@
{
"version": "1.1",
"engine": "linux/amd64|Transformer|1.40.11|1b271555882eacdfb4e6598d6d0552e9b9b1449b|2024-02-02_01:36:22PM",
"containerized": false,
"host_distro": {
"name": "Ubuntu",
"version": "24.04",
"display_name": "Ubuntu 24.04 LTS"
},
"type": "build",
"state": "done",
"target_reference": "jmrenouard/mysqltuner:latest",
"system": {
"type": "Linux",
"release": "5.15.153.1-microsoft-standard-WSL2",
"distro": {
"name": "Ubuntu",
"version": "24.04",
"display_name": "Ubuntu 24.04 LTS"
}
},
"source_image": {
"identity": {
"id": "sha256:de54a9bc71612ce378cafe4d719064ae17578f7a5c202f08c2340cb4a5bd8fa9",
"tags": [
"2.5.4",
"latest"
],
"names": [
"jmrenouard/mysqltuner:2.5.4",
"jmrenouard/mysqltuner:latest"
]
},
"size": 210101762,
"size_human": "210 MB",
"create_time": "2024-07-15T20:57:18Z",
"docker_version": "",
"architecture": "amd64",
"os": "linux",
"labels": {
"maintainer": "jmrenouard@gmail.com",
"org.opencontainers.image.ref.name": "ubuntu",
"org.opencontainers.image.version": "24.04"
},
"env_vars": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"DEBIAN_FRONTEND=noninteractive"
],
"container_entry": {
"exe_path": ""
}
},
"minified_image_size": 37270902,
"minified_image_size_human": "37 MB",
"minified_image": "jmrenouard/mysqltuner.slim",
"minified_image_id": "sha256:cc97d204ab37932775e72b3d45523bac97c6a58f3fea9130c3e5a478655be815",
"minified_image_digest": "sha256:025d34ffb0fa21690d6852e2d2d72ca6bf7892400a141dc1c750aa5b82ffc0a5",
"minified_image_has_data": true,
"minified_by": 5.637152596950833,
"artifact_location": "/tmp/slim-state/.slim-state/images/de54a9bc71612ce378cafe4d719064ae17578f7a5c202f08c2340cb4a5bd8fa9/artifacts",
"container_report_name": "creport.json",
"seccomp_profile_name": "jmrenouard-mysqltuner-seccomp.json",
"apparmor_profile_name": "jmrenouard-mysqltuner-apparmor-profile",
"image_stack": [
{
"is_top_image": true,
"id": "sha256:de54a9bc71612ce378cafe4d719064ae17578f7a5c202f08c2340cb4a5bd8fa9",
"full_name": "jmrenouard/mysqltuner:2.5.4",
"repo_name": "jmrenouard/mysqltuner",
"version_tag": "2.5.4",
"raw_tags": [
"jmrenouard/mysqltuner:2.5.4",
"jmrenouard/mysqltuner:latest"
],
"create_time": "2024-07-15T20:57:18Z",
"new_size": 210101762,
"new_size_human": "210 MB",
"instructions": [
{
"type": "ARG",
"time": "2024-06-07T12:00:06Z",
"is_nop": true,
"local_image_exists": false,
"layer_index": 0,
"size": 0,
"params": "RELEASE",
"command_snippet": "ARG RELEASE",
"command_all": "ARG RELEASE",
"inst_set_time_bucket": "2024-06-07T14:00:00+02:00",
"inst_set_time_index": 0,
"inst_set_time_reverse_index": 2
},
{
"type": "ARG",
"time": "2024-06-07T12:00:06Z",
"is_nop": true,
"local_image_exists": false,
"layer_index": 0,
"size": 0,
"params": "LAUNCHPAD_BUILD_ARCH",
"command_snippet": "ARG LAUNCHPAD_BUILD_ARCH",
"command_all": "ARG LAUNCHPAD_BUILD_ARCH",
"inst_set_time_bucket": "2024-06-07T14:00:00+02:00",
"inst_set_time_index": 0,
"inst_set_time_reverse_index": 2
},
{
"type": "LABEL",
"time": "2024-06-07T12:00:06Z",
"is_nop": true,
"local_image_exists": false,
"layer_index": 0,
"size": 0,
"params": "org.opencontainers.image.ref.name=ubuntu",
"command_snippet": "LABEL org.opencontainers.image.ref.name=ubun...",
"command_all": "LABEL org.opencontainers.image.ref.name=ubuntu",
"inst_set_time_bucket": "2024-06-07T14:00:00+02:00",
"inst_set_time_index": 0,
"inst_set_time_reverse_index": 2
},
{
"type": "LABEL",
"time": "2024-06-07T12:00:06Z",
"is_nop": true,
"local_image_exists": false,
"layer_index": 0,
"size": 0,
"params": "org.opencontainers.image.version=24.04",
"command_snippet": "LABEL org.opencontainers.image.version=24.04",
"command_all": "LABEL org.opencontainers.image.version=24.04",
"inst_set_time_bucket": "2024-06-07T14:00:00+02:00",
"inst_set_time_index": 0,
"inst_set_time_reverse_index": 2
},
{
"type": "ADD",
"time": "2024-06-07T12:00:08Z",
"is_nop": true,
"local_image_exists": false,
"layer_index": 0,
"size": 78050118,
"size_human": "78 MB",
"params": "file:5601f441718b0d192d73394b35fd07675342837ec9089ddd52dd1dc0de79630e in /",
"command_snippet": "ADD file:5601f441718b0d192d73394b35fd0767534...",
"command_all": "ADD file:5601f441718b0d192d73394b35fd07675342837ec9089ddd52dd1dc0de79630e /",
"target": "/",
"source_type": "file",
"inst_set_time_bucket": "2024-06-07T14:00:00+02:00",
"inst_set_time_index": 0,
"inst_set_time_reverse_index": 2
},
{
"type": "CMD",
"time": "2024-06-07T12:00:09Z",
"is_nop": true,
"is_exec_form": true,
"local_image_exists": false,
"layer_index": 0,
"size": 0,
"params": "[\"/bin/bash\"]\n",
"command_snippet": "CMD [\"/bin/bash\"]\n",
"command_all": "CMD [\"/bin/bash\"]\n",
"inst_set_time_bucket": "2024-06-07T14:00:00+02:00",
"inst_set_time_index": 0,
"inst_set_time_reverse_index": 2
},
{
"type": "LABEL",
"time": "2024-07-15T20:30:50Z",
"is_nop": false,
"local_image_exists": false,
"layer_index": 0,
"size": 0,
"params": "maintainer=jmrenouard@gmail.com",
"command_snippet": "LABEL maintainer=jmrenouard@gmail.com",
"command_all": "LABEL maintainer=jmrenouard@gmail.com",
"comment": "buildkit.dockerfile.v0",
"is_buildkit_instruction": true,
"inst_set_time_bucket": "2024-07-15T22:30:00+02:00",
"inst_set_time_index": 1,
"inst_set_time_reverse_index": 1
},
{
"type": "ENV",
"time": "2024-07-15T20:30:50Z",
"is_nop": false,
"local_image_exists": false,
"layer_index": 0,
"size": 0,
"params": "DEBIAN_FRONTEND=noninteractive",
"command_snippet": "ENV DEBIAN_FRONTEND=noninteractive",
"command_all": "ENV DEBIAN_FRONTEND=noninteractive",
"comment": "buildkit.dockerfile.v0",
"is_buildkit_instruction": true,
"inst_set_time_bucket": "2024-07-15T22:30:00+02:00",
"inst_set_time_index": 1,
"inst_set_time_reverse_index": 1
},
{
"type": "RUN",
"time": "2024-07-15T20:30:50Z",
"is_nop": false,
"local_image_exists": false,
"layer_index": 0,
"size": 129424033,
"size_human": "129 MB",
"command_snippet": "RUN apt-get update && \\\n\tapt upgrade -y && \\...",
"command_all": "RUN apt-get update && \\\n\tapt upgrade -y && \\\n\tapt-get install -yq --no-install-recommends apt-utils curl wget perl perl-doc mysql-client libjson-perl libtext-template-perl && \\\n\tapt-get clean && \\\n\trm -rf /var/lib/apt/lists/* && \\\n\tmkdir -p /results",
"system_commands": [
"apt-get update",
"apt upgrade -y",
"apt-get install -yq --no-install-recommends apt-utils curl wget perl perl-doc mysql-client libjson-perl libtext-template-perl",
"apt-get clean",
"rm -rf /var/lib/apt/lists/*",
"mkdir -p /results"
],
"comment": "buildkit.dockerfile.v0",
"is_buildkit_instruction": true,
"inst_set_time_bucket": "2024-07-15T22:30:00+02:00",
"inst_set_time_index": 1,
"inst_set_time_reverse_index": 1
},
{
"type": "RUN",
"time": "2024-07-15T20:57:17Z",
"is_nop": false,
"local_image_exists": false,
"layer_index": 0,
"size": 0,
"command_snippet": "RUN apt clean all",
"command_all": "RUN apt clean all",
"system_commands": [
"apt clean all"
],
"comment": "buildkit.dockerfile.v0",
"is_buildkit_instruction": true,
"inst_set_time_bucket": "2024-07-15T22:45:00+02:00",
"inst_set_time_index": 2,
"inst_set_time_reverse_index": 0
},
{
"type": "WORKDIR",
"time": "2024-07-15T20:57:17Z",
"is_nop": false,
"local_image_exists": false,
"layer_index": 0,
"size": 0,
"params": "/",
"command_snippet": "WORKDIR /",
"command_all": "WORKDIR /",
"system_commands": [
"mkdir -p /"
],
"comment": "buildkit.dockerfile.v0",
"is_buildkit_instruction": true,
"inst_set_time_bucket": "2024-07-15T22:45:00+02:00",
"inst_set_time_index": 2,
"inst_set_time_reverse_index": 0
},
{
"type": "COPY",
"time": "2024-07-15T20:57:17Z",
"is_nop": false,
"local_image_exists": false,
"layer_index": 0,
"size": 264380,
"size_human": "264 kB",
"params": "./mysqltuner.pl /mysqltuner.pl",
"command_snippet": "COPY ./mysqltuner.pl /mysqltuner.pl",
"command_all": "COPY ./mysqltuner.pl /mysqltuner.pl",
"comment": "buildkit.dockerfile.v0",
"is_buildkit_instruction": true,
"inst_set_time_bucket": "2024-07-15T22:45:00+02:00",
"inst_set_time_index": 2,
"inst_set_time_reverse_index": 0
},
{
"type": "COPY",
"time": "2024-07-15T20:57:18Z",
"is_nop": false,
"local_image_exists": false,
"layer_index": 0,
"size": 2355059,
"size_human": "2.4 MB",
"params": "./vulnerabilities.csv /vulnerabilities.txt",
"command_snippet": "COPY ./vulnerabilities.csv /vulnerabilities....",
"command_all": "COPY ./vulnerabilities.csv /vulnerabilities.txt",
"comment": "buildkit.dockerfile.v0",
"is_buildkit_instruction": true,
"inst_set_time_bucket": "2024-07-15T22:45:00+02:00",
"inst_set_time_index": 2,
"inst_set_time_reverse_index": 0
},
{
"type": "COPY",
"time": "2024-07-15T20:57:18Z",
"is_nop": false,
"local_image_exists": false,
"layer_index": 0,
"size": 3988,
"size_human": "4.0 kB",
"params": "./basic_passwords.txt /basic_passwords.txt",
"command_snippet": "COPY ./basic_passwords.txt /basic_passwords....",
"command_all": "COPY ./basic_passwords.txt /basic_passwords.txt",
"comment": "buildkit.dockerfile.v0",
"is_buildkit_instruction": true,
"inst_set_time_bucket": "2024-07-15T22:45:00+02:00",
"inst_set_time_index": 2,
"inst_set_time_reverse_index": 0
},
{
"type": "COPY",
"time": "2024-07-15T20:57:18Z",
"is_nop": false,
"local_image_exists": false,
"layer_index": 0,
"size": 4184,
"size_human": "4.2 kB",
"params": "./template_example.tpl /template.tpl",
"command_snippet": "COPY ./template_example.tpl /template.tpl",
"command_all": "COPY ./template_example.tpl /template.tpl",
"comment": "buildkit.dockerfile.v0",
"is_buildkit_instruction": true,
"inst_set_time_bucket": "2024-07-15T22:45:00+02:00",
"inst_set_time_index": 2,
"inst_set_time_reverse_index": 0
},
{
"type": "ENTRYPOINT",
"time": "2024-07-15T20:57:18Z",
"is_nop": false,
"is_exec_form": true,
"local_image_exists": false,
"layer_index": 0,
"size": 0,
"params": "[\"perl\",\"/mysqltuner.pl\",\"--passwordfile\",\"/basic_passwords.txt\",\"--cvefile\",\"/vulnerabilities.txt\",\"--nosysstat\",\"--defaults-file\",\"/defaults.cnf\",\"--dumpdir\",\"/results\",\"--outputfile\",\"/results/mysqltuner.txt\",\"--template\",\"/template.tpl\",\"--reportfile\",\"/results/mysqltuner.html\"]\n",
"command_snippet": "ENTRYPOINT [\"perl\",\"/mysqltuner.pl\",\"--passw...",
"command_all": "ENTRYPOINT [\"perl\",\"/mysqltuner.pl\",\"--passwordfile\",\"/basic_passwords.txt\",\"--cvefile\",\"/vulnerabilities.txt\",\"--nosysstat\",\"--defaults-file\",\"/defaults.cnf\",\"--dumpdir\",\"/results\",\"--outputfile\",\"/results/mysqltuner.txt\",\"--template\",\"/template.tpl\",\"--reportfile\",\"/results/mysqltuner.html\"]\n",
"comment": "buildkit.dockerfile.v0",
"is_buildkit_instruction": true,
"inst_set_time_bucket": "2024-07-15T22:45:00+02:00",
"inst_set_time_index": 2,
"inst_set_time_reverse_index": 0
},
{
"type": "CMD",
"time": "2024-07-15T20:57:18Z",
"is_last_instruction": true,
"is_nop": false,
"is_exec_form": true,
"local_image_exists": true,
"layer_index": 0,
"size": 0,
"params": "[\"--verbose\"]\n",
"command_snippet": "CMD [\"--verbose\"]\n",
"command_all": "CMD [\"--verbose\"]\n",
"comment": "buildkit.dockerfile.v0",
"raw_tags": [
"jmrenouard/mysqltuner:2.5.4",
"jmrenouard/mysqltuner:latest"
],
"is_buildkit_instruction": true,
"inst_set_time_bucket": "2024-07-15T22:45:00+02:00",
"inst_set_time_index": 2,
"inst_set_time_reverse_index": 0
}
]
}
],
"image_created": true,
"image_build_engine": "internal"
}