Merge done
This commit is contained in:
commit
87aff130f3
7 changed files with 1120 additions and 349 deletions
36
.github/workflows/exec.yml
vendored
Normal file
36
.github/workflows/exec.yml
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
# This is a basic workflow to help you get started with Actions
|
||||
|
||||
name: CI
|
||||
|
||||
# Controls when the workflow will run
|
||||
on:
|
||||
# Triggers the workflow on push or pull request events but only for the master branch
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
# Runs a single command using the runners shell
|
||||
- name: Run a one-line script
|
||||
run: echo Hello, world!
|
||||
|
||||
# Runs a set of commands using the runners shell
|
||||
- name: Run a multi-line script
|
||||
run: |
|
||||
echo Add other actions to build,
|
||||
echo test, and deploy your project.
|
379
README.md
379
README.md
|
@ -348,6 +348,385 @@ MySQLTuner and Vagrant
|
|||
d985820667c2 mysql:8.0 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:3306->3306/tcp, 33060/tcp mysql 8 0
|
||||
|
||||
|
||||
MySQLTuner needs you
|
||||
--
|
||||
**MySQLTuner** needs contributors for documentation, code and feedback..
|
||||
|
||||
* Please join us on issue track at [GitHub tracker](https://github.com/major/MySQLTuner-perl/issues).
|
||||
* Contribution guide is available following [MySQLTuner contributing guide](https://github.com/major/MySQLTuner-perl/blob/master/CONTRIBUTING.md)
|
||||
* Star **MySQLTuner project** at [MySQLTuner Git Hub Project](https://github.com/major/MySQLTuner-perl)
|
||||
|
||||
Contributions welcome !
|
||||
--
|
||||
|
||||
How to contribute using Pull Request ? Follow this guide : [Pull request creation](https://opensource.com/article/19/7/create-pull-request-github)
|
||||
|
||||
Simple steps to create a pull request:
|
||||
--
|
||||
|
||||
- Fork this Github project
|
||||
- Clone it to your local system
|
||||
- Make a new branch
|
||||
- Make your changes
|
||||
- Push it back to your repo
|
||||
- Click the Compare & pull request button
|
||||
- Click Create pull request to open a new pull request
|
||||
=======
|
||||

|
||||
====
|
||||
[](https://travis-ci.org/major/MySQLTuner-perl)
|
||||
[](http://opensource.box.com/badges)
|
||||
[](http://opensource.box.com/badges)
|
||||
[](http://isitmaintained.com/project/major/MySQLTuner-perl "Average time to resolve an issue")
|
||||
[](http://isitmaintained.com/project/major/MySQLTuner-perl "Percentage of issues still open")
|
||||
[](https://opensource.org/licenses/GPL-3.0/)
|
||||
|
||||
**MySQLTuner** is a script written in Perl that allows you to review a MySQL installation quickly and make adjustments to increase performance and stability. The current configuration variables and status data is retrieved and presented in a brief format along with some basic performance suggestions.
|
||||
|
||||
**MySQLTuner** supports ~300 indicators for MySQL/MariaDB/Percona Server in this last version.
|
||||
|
||||
**MySQLTuner** is maintained and indicator collect is increasing week after week supporting a lot of configuration such as [Galera Cluster](http://galeracluster.com/), [TokuDB](https://www.percona.com/software/mysql-database/percona-tokudb), [Performance schema](https://github.com/mysql/mysql-sys), Linux OS metrics, [InnoDB](http://dev.mysql.com/doc/refman/5.7/en/innodb-storage-engine.html), [MyISAM](http://dev.mysql.com/doc/refman/5.7/en/myisam-storage-engine.html), [Aria](https://mariadb.com/kb/en/mariadb/aria/), ...
|
||||
|
||||
You can find more details on these indicators here:
|
||||
[Indicators description](https://github.com/major/MySQLTuner-perl/blob/master/INTERNALS.md).
|
||||
|
||||
|
||||

|
||||
|
||||
MySQLTuner needs you:
|
||||
===
|
||||
|
||||
**MySQLTuner** needs contributors for documentation, code and feedback..
|
||||
|
||||
* Please join us on issue track at [GitHub tracker](https://github.com/major/MySQLTuner-perl/issues).
|
||||
* Contribution guide is available following [MySQLTuner contributing guide](https://github.com/major/MySQLTuner-perl/blob/master/CONTRIBUTING.md)
|
||||
* Star **MySQLTuner project** at [MySQLTuner Git Hub Project](https://github.com/major/MySQLTuner-perl)
|
||||
## Stargazers over time
|
||||
|
||||
[](https://starcharts.herokuapp.com/major/MySQLTuner-perl)
|
||||
|
||||
Compatibility
|
||||
====
|
||||
Test result are available here: [Travis CI/MySQLTuner-perl](https://travis-ci.org/major/MySQLTuner-perl)
|
||||
* MySQL 8.0 (partial support, password checks don't work)
|
||||
* MySQL 5.7 (full support)
|
||||
* MySQL 5.6 (full support, no more MySQL support)
|
||||
* MySQL 5.5 (full support, no more MySQL support)
|
||||
* MariaDB 10.5 (full support)
|
||||
* MariaDB 10.4 (full support)
|
||||
* MariaDB 10.3 (full support)
|
||||
* MariaDB 10.2 (full support)
|
||||
* MariaDB 10.1 (full support, no more MariaDB support)
|
||||
* MariaDB 10.0 (full support, no more MariaDB support)
|
||||
* MariaDB 5.5 (full support, no more MariaDB support)
|
||||
* Percona Server 8.0 (partial support, password checks don't work)
|
||||
* Percona Server 5.7 (full support)
|
||||
* Percona Server 5.6 (full support)
|
||||
|
||||
* Percona XtraDB cluster (partial support, no test environment)
|
||||
* Mysql Replications (partial support, no test environment)
|
||||
* Galera replication (partial support, no test environment)
|
||||
|
||||
* MySQL 3.23, 4.0, 4.1, 5.0, 5.1 (partial support - deprecated version)
|
||||
|
||||
*** UNSUPPORTED ENVIRONMENTS - NEED HELP FOR THAT :) ***
|
||||
* Windows is not supported at this time (Help wanted !!!!!)
|
||||
* Cloud based is not supported at this time (Help wanted !!!!!)
|
||||
|
||||
* 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)
|
||||
|
||||
***WARNING***
|
||||
--
|
||||
It is **extremely important** for you to fully understand each change
|
||||
you make to a MySQL database server. If you don't understand portions
|
||||
of the script's output, or if you don't understand the recommendations,
|
||||
**you should consult** a knowledgeable DBA or system administrator
|
||||
that you trust. **Always** test your changes on staging environments, and
|
||||
always keep in mind that improvements in one area can **negatively affect**
|
||||
MySQL in other areas.
|
||||
|
||||
It's **also important** to wait at least a day of uptime to get accurate results. In fact, running
|
||||
**mysqltuner** on a fresh restarted server is completely useless.
|
||||
|
||||
**Seriously - please review the FAQ section below.**
|
||||
|
||||
|
||||
Security recommendations
|
||||
--
|
||||
|
||||
Hi directadmin user!
|
||||
We detected that you run mysqltuner with da_admin's credentials taken from `/usr/local/directadmin/conf/my.cnf`, which might bring to a password discovery!
|
||||
Read link for more details [Issue #289](https://github.com/major/MySQLTuner-perl/issues/289).
|
||||
|
||||
What MySQLTuner is checking exactly ?
|
||||
--
|
||||
All checks done by **MySQLTuner** are documented in [MySQLTuner Internals](https://github.com/major/MySQLTuner-perl/blob/master/INTERNALS.md) documentation.
|
||||
|
||||
Download/Installation
|
||||
--
|
||||
|
||||
Choose one of these methods:
|
||||
|
||||
1) Script direct download (the simplest and shortest method):
|
||||
|
||||
```
|
||||
wget http://mysqltuner.pl/ -O mysqltuner.pl
|
||||
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/basic_passwords.txt -O basic_passwords.txt
|
||||
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/vulnerabilities.csv -O vulnerabilities.csv
|
||||
```
|
||||
|
||||
2) You can download the entire repository by using `git clone` or `git clone --depth 1 -b master` followed by the cloning URL above.
|
||||
|
||||
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.
|
||||
For previous 5.6 version, you can follow this command to create a new database sys containing very useful view on Performance schema:
|
||||
|
||||
curl "https://codeload.github.com/mysql/mysql-sys/zip/master" > sysschema.zip
|
||||
# check zip file
|
||||
unzip -l sysschema.zip
|
||||
unzip sysschema.zip
|
||||
cd mysql-sys-master
|
||||
mysql -uroot -p < sys_56.sql
|
||||
|
||||
Optional Performance schema and Sysschema installation for MariaDB 10.x
|
||||
--
|
||||
|
||||
Sysschema is not installed by default under MariaDB 10.x.
|
||||
By default, on MariaDB, performance schema is disabled by default. consider activating performance schema across your my.cnf configuration file:
|
||||
|
||||
[mysqld]
|
||||
performance_schema = on
|
||||
|
||||
You can follow this command to create a new database sys containing very useful view on Performance schema:
|
||||
|
||||
curl "https://codeload.github.com/FromDual/mariadb-sys/zip/master" > mariadb-sys.zip
|
||||
# check zip file
|
||||
unzip -l mariadb-sys.zip
|
||||
unzip mariadb-sys.zip
|
||||
cd mariadb-sys-master/
|
||||
mysql -u root -p < ./sys_10.sql
|
||||
|
||||
Errors & solutions for performance schema installation
|
||||
|
||||
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
|
||||
|
||||
Performance tips
|
||||
--
|
||||
Metadata statistic updates can impact strongly performance of database servers and MySQLTuner.
|
||||
Be sure that innodb_stats_on_metadata is disabled.
|
||||
|
||||
set global innodb_stats_on_metadata = 0;
|
||||
|
||||
Specific usage
|
||||
--
|
||||
|
||||
__Usage:__ Minimal usage locally
|
||||
|
||||
perl mysqltuner.pl --host 127.0.0.1
|
||||
|
||||
Of course, you can add the execute bit (`chmod +x mysqltuner.pl`) so you can execute it without calling perl directly.
|
||||
|
||||
__Usage:__ Minimal usage remotely
|
||||
|
||||
perl mysqltuner.pl --host targetDNS_IP --user admin_user --pass admin_password
|
||||
|
||||
__Usage:__ Enable maximum output information around MySQL/MariaDb without debugging
|
||||
|
||||
perl mysqltuner.pl --verbose
|
||||
perl mysqltuner.pl --buffers --dbstat --idxstat --sysstat --pfstat --tbstat
|
||||
|
||||
|
||||
__Usage:__ Enable CVE vulnerabilities check for your MariaDB or MySQL version
|
||||
|
||||
perl mysqltuner.pl --cvefile=vulnerabilities.csv
|
||||
|
||||
__Usage:__ Write your result in a file with information displayed
|
||||
|
||||
perl mysqltuner.pl --outputfile /tmp/result_mysqltuner.txt
|
||||
|
||||
__Usage:__ Write your result in a file **without outputting information**
|
||||
|
||||
perl mysqltuner.pl --silent --outputfile /tmp/result_mysqltuner.txt
|
||||
|
||||
__Usage:__ Using template model to customize your reporting file based on [Text::Template](https://metacpan.org/pod/Text::Template) syntax.
|
||||
|
||||
perl mysqltuner.pl --silent --reportfile /tmp/result_mysqltuner.txt --template=/tmp/mymodel.tmpl
|
||||
|
||||
__Usage:__ Enable debugging information
|
||||
|
||||
perl mysqltuner.pl --debug
|
||||
|
||||
__Usage:__ Update MySQLTuner and data files (password and cve) if needed
|
||||
|
||||
perl mysqltuner.pl --checkversion --updateversion
|
||||
|
||||
FAQ
|
||||
--
|
||||
|
||||
**Question: Will MySQLTuner fix my slow MySQL server?**
|
||||
|
||||
**No.** MySQLTuner is a read only script. It won't write to any configuration files, change the status of any daemons, or call your mother to wish her a happy birthday. It will give you an overview of your server's performance and make some basic recommendations for improvements that you can make after it completes. *Make sure you read the warning above prior to following any recommendations.*
|
||||
|
||||
**Question: Can I fire my DBA now?**
|
||||
|
||||
**MySQLTuner will not replace your DBA in any form or fashion.** If your DBA constantly takes your parking spot and steals your lunch from the fridge, then you may want to consider it - but that's your call.
|
||||
|
||||
**Question: Why does MySQLTuner keep asking me the login credentials for MySQL over and over?**
|
||||
|
||||
The script will try its best to log in via any means possible. It will check for ~/.my.cnf files, Plesk password files, and empty password root logins. If none of those are available, then you'll be prompted for a password. If you'd like the script to run in an automated fashion without user intervention, then create a .my.cnf file in your home directory which contains:
|
||||
|
||||
[client]
|
||||
user=someusername
|
||||
password=thatuserspassword
|
||||
|
||||
Once you create it, make sure it's owned by your user and the mode on the file is 0600. This should prevent the prying eyes from getting your database login credentials under normal conditions. If a [T-1000 shows up in a LAPD uniform](https://en.wikipedia.org/wiki/T-1000) and demands your database credentials, you won't have much of an option.
|
||||
|
||||
**Question: Is there another way to secure credentials on latest MySQL and MariaDB distributions ?**
|
||||
|
||||
You could use mysql_config_editor utilities.
|
||||
~~~bash
|
||||
$ mysql_config_editor set --login-path=client --user=someusername --password --host=localhost
|
||||
Enter password: ********
|
||||
~~~
|
||||
After which, `~/.mylogin.cnf` will be created with the appropriate access.
|
||||
|
||||
To get information about stored credentials, use the following command:
|
||||
|
||||
$mysql_config_editor print
|
||||
[client]
|
||||
user = someusername
|
||||
password = *****
|
||||
host = localhost
|
||||
|
||||
**Question: What's minimum privileges needed by a specific mysqltuner user in database ?**
|
||||
|
||||
mysql>GRANT SELECT, PROCESS,EXECUTE, REPLICATION CLIENT,SHOW DATABASES,SHOW VIEW ON *.* TO 'mysqltuner'@'localhost' identified by pwd1234;
|
||||
|
||||
**Question: What's minimum privileges needed by a specific mysqltuner user in database for MySQL 8 or MariaDB 10.5 ?**
|
||||
|
||||
mysql>GRANT SELECT, PROCESS,EXECUTE, REPLICA MONITOR,SHOW DATABASES,SHOW VIEW ON *.* TO 'mysqltuner'@'localhost' identified by pwd1234;
|
||||
|
||||
|
||||
**Question: It's not working on my OS! What gives?!**
|
||||
|
||||
These kinds of things are bound to happen. Here are the details I need from you in order to research the problem thoroughly:
|
||||
|
||||
* OS and OS version
|
||||
* Architecture (x86, x86_64, IA64, Commodore 64)
|
||||
* Exact MySQL version
|
||||
* Where you obtained your MySQL version (OS package, source, etc)
|
||||
* The full text of the error
|
||||
* A copy of SHOW VARIABLES and SHOW GLOBAL STATUS output (if possible)
|
||||
|
||||
**Question: How to perform CVE vulnerability checks?**
|
||||
|
||||
* Download vulnerabilities.csv from this repository.
|
||||
* use option --cvefile to perform CVE checks
|
||||
|
||||
**Question: How to use mysqltuner from a remote host?**
|
||||
Thanks to [@rolandomysqldba](http://dba.stackexchange.com/users/877/rolandomysqldba)
|
||||
|
||||
* You will still have to connect like a mysql client:
|
||||
|
||||
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
|
||||
--pass <password> Password to use for authentication
|
||||
--defaults-file <path> defaults file for credentials
|
||||
|
||||
Since you are using a remote host, use parameters to supply values from the OS
|
||||
|
||||
--forcemem <size> Amount of RAM installed in megabytes
|
||||
--forceswap <size> Amount of swap memory configured in megabytes
|
||||
|
||||
* You may have to contact your remote SysAdmin to ask how much RAM and swap you have
|
||||
|
||||
If the database has too many tables, or very large table, use this:
|
||||
|
||||
--skipsize Don't enumerate tables and their types/sizes (default: on)
|
||||
(Recommended for servers with many tables)
|
||||
|
||||
**Question: Can I install this project using homebrew on Apple Macintosh?**
|
||||
|
||||
Yes! `brew install mysqltuner` can be used to install this application using [homebrew](https://brew.sh/) on Apple Macintosh.
|
||||
|
||||
MySQLTuner and Vagrant
|
||||
--
|
||||
**MySQLTuner** contains following Vagrant configurations:
|
||||
* Fedora Core 30 / Docker
|
||||
|
||||
**Vagrant File** is stored in Vagrant subdirectory.
|
||||
* Follow following step after vagrant installation:
|
||||
$ vagrant up
|
||||
|
||||
**MySQLTuner** contains a Vagrant configurations for test purpose and development
|
||||
* Install VirtualBox and Vagrant
|
||||
* https://www.virtualbox.org/wiki/Downloads
|
||||
* https://www.vagrantup.com/downloads.html
|
||||
* Clone repository
|
||||
* git clone https://github.com/major/MySQLTuner-perl.git
|
||||
* Install Vagrant plugins vagrant-hostmanager and vagrant-vbguest
|
||||
* vagrant plugin install vagrant-hostmanager
|
||||
* vagrant plugin install vagrant-vbguest
|
||||
* Add Fedora Core 30 box for official Fedora Download Website
|
||||
* vagrant box add --name generic/fedora30
|
||||
* Create a data directory
|
||||
* mkdir data
|
||||
|
||||
|
||||
## setup test environments
|
||||
|
||||
$ sh build/createTestEnvs.sh
|
||||
|
||||
$ source build/bashrc
|
||||
$ mysql_percona80 sakila
|
||||
sakila> ...
|
||||
|
||||
$ docker images
|
||||
mariadb 10.1 fc612450e1f1 12 days ago 352MB
|
||||
mariadb 10.2 027b7c57b8c6 12 days ago 340MB
|
||||
mariadb 10.3 47dff68107c4 12 days ago 343MB
|
||||
mariadb 10.4 92495405fc36 12 days ago 356MB
|
||||
mysql 5.6 95e0fc47b096 2 weeks ago 257MB
|
||||
mysql 5.7 383867b75fd2 2 weeks ago 373MB
|
||||
mysql 8.0 b8fd9553f1f0 2 weeks ago 445MB
|
||||
percona/percona-server 5.7 ddd245ed3496 5 weeks ago 585MB
|
||||
percona/percona-server 5.6 ed0a36e0cf1b 6 weeks ago 421MB
|
||||
percona/percona-server 8.0 390ae97d57c6 6 weeks ago 697MB
|
||||
mariadb 5.5 c7bf316a4325 4 months ago 352MB
|
||||
mariadb 10.0 d1bde56970c6 4 months ago 353MB
|
||||
mysql 5.5 d404d78aa797 4 months ago 205MB
|
||||
|
||||
$ docker ps
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
da2be9b050c9 mariadb:5.5 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:5311->3306/tcp mariadb55
|
||||
5deca25d5ac8 mariadb:10.0 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:5310->3306/tcp mariadb100
|
||||
73aaeb37e2c2 mariadb:10.1 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:5309->3306/tcp mariadb101
|
||||
72ffa77e01ec mariadb:10.2 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:5308->3306/tcp mariadb102
|
||||
f5996f2041df mariadb:10.3 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:5307->3306/tcp mariadb103
|
||||
4890c52372bb mariadb:10.4 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:5306->3306/tcp mariadb104
|
||||
6b9dc078e921 percona/percona-server:5.6 "/docker-entrypoint.…" 7 hours ago Up 7 hours 0.0.0.0:4308->3306/tcp percona56
|
||||
3a4c7c826d4c percona/percona-server:5.7 "/docker-entrypoint.…" 7 hours ago Up 7 hours 0.0.0.0:4307->3306/tcp percona57
|
||||
3dda408c91b0 percona/percona-server:8.0 "/docker-entrypoint.…" 7 hours ago Up 7 hours 33060/tcp, 0.0.0.0:4306->3306/tcp percona80
|
||||
600a4e7e9dcd mysql:5.5 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:3309->3306/tcp mysql55
|
||||
4bbe54342e5d mysql:5.6 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:3308->3306/tcp mysql56
|
||||
a49783249a11 mysql:5.7 "docker-entrypoint.s…" 7 hours ago Up 7 hours 33060/tcp, 0.0.0.0:3307->3306/tcp mysql57
|
||||
d985820667c2 mysql:8.0 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:3306->3306/tcp, 33060/tcp mysql 8 0
|
||||
|
||||
|
||||
MySQLTuner needs you
|
||||
--
|
||||
**MySQLTuner** needs contributors for documentation, code and feedback..
|
||||
|
|
6
USAGE.md
6
USAGE.md
|
@ -1,6 +1,6 @@
|
|||
# NAME
|
||||
|
||||
MySQLTuner 1.7.21 - MySQL High Performance Tuning Script
|
||||
MySQLTuner 1.8.1 - MySQL High Performance Tuning Script
|
||||
|
||||
# IMPORTANT USAGE GUIDELINES
|
||||
|
||||
|
@ -47,6 +47,8 @@ You must provide the remote server's total memory when connecting to other serve
|
|||
--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
|
||||
|
@ -133,7 +135,7 @@ Maintained by Major Hayden (major\\@mhtx.net) - Licensed under GPL
|
|||
|
||||
# COPYRIGHT AND LICENSE
|
||||
|
||||
Copyright (C) 2006-2020 Major Hayden - major@mhtx.net
|
||||
Copyright (C) 2006-2021 Major Hayden - major@mhtx.net
|
||||
|
||||
For the latest updates, please visit http://mysqltuner.pl/
|
||||
|
||||
|
|
241
build/bashrc
241
build/bashrc
|
@ -1,69 +1,174 @@
|
|||
alias gst='git status'
|
||||
alias gcm='git commit -m'
|
||||
alias gmh='git log --follow -p --'
|
||||
alias ll='ls -ls'
|
||||
alias lh='ls -lsh'
|
||||
alias la='ls -lsa'
|
||||
alias gam='git status | grep "modified" | cut -d: -f2 | xargs -n 1 git add'
|
||||
alias serve="python -m $(python -c 'import sys; print("http.server" if sys.version_info[:2] > (2,7) else "SimpleHTTPServer")')"
|
||||
|
||||
dcmd()
|
||||
{
|
||||
docker exec -i -t $1 bash
|
||||
}
|
||||
|
||||
gen_mysqlalias()
|
||||
{
|
||||
input="$1"
|
||||
|
||||
while IFS='' read -r line
|
||||
do
|
||||
[ -z "$line" ] && continue
|
||||
container_port=$(echo "$line" | cut -d\; -f1)
|
||||
container_name=$(echo "$line" | cut -d\; -f2)
|
||||
container_datadir=$(echo "$line" | cut -d\; -f3)
|
||||
image_name=$(echo "$line" | cut -d\; -f4)
|
||||
|
||||
alias mysql_$container_name="mysql -u root -h 127.0.0.1 -P $container_port"
|
||||
done < "$input"
|
||||
}
|
||||
|
||||
exec_mysql()
|
||||
{
|
||||
input="$1"
|
||||
name=$2
|
||||
db=$3
|
||||
sqlfile=$4
|
||||
while IFS='' read -r line
|
||||
do
|
||||
[ -z "$line" ] && continue
|
||||
echo "$line" | grep -q $name
|
||||
[ $? -ne 0 ] && continue
|
||||
container_port=$(echo "$line" | cut -d\; -f1)
|
||||
container_name=$(echo "$line" | cut -d\; -f2)
|
||||
container_datadir=$(echo "$line" | cut -d\; -f3)
|
||||
image_name=$(echo "$line" | cut -d\; -f4)
|
||||
|
||||
|
||||
echo "* Executing $sqlfile on $container_name"
|
||||
cat $sqlfile | mysql -u root -h 127.0.0.1 -P $container_port
|
||||
done < "$input"
|
||||
}
|
||||
exec_mysqls()
|
||||
{
|
||||
input="$1"
|
||||
db=$2
|
||||
sqlfile=$3
|
||||
while IFS='' read -r line
|
||||
do
|
||||
[ -z "$line" ] && continue
|
||||
container_port=$(echo "$line" | cut -d\; -f1)
|
||||
container_name=$(echo "$line" | cut -d\; -f2)
|
||||
container_datadir=$(echo "$line" | cut -d\; -f3)
|
||||
image_name=$(echo "$line" | cut -d\; -f4)
|
||||
|
||||
|
||||
echo "* Executing $sqlfile on $container_name"
|
||||
cat $sqlfile | mysql -u root -h 127.0.0.1 -P $container_port
|
||||
done < "$input"
|
||||
alias gst='git status'
|
||||
alias gcm='git commit -m'
|
||||
alias gmh='git log --follow -p --'
|
||||
alias ll='ls -ls'
|
||||
alias lh='ls -lsh'
|
||||
alias la='ls -lsa'
|
||||
alias gam='git status | grep "modified" | cut -d: -f2 | xargs -n 1 git add'
|
||||
alias serve="python -m $(python -c 'import sys; print("http.server" if sys.version_info[:2] > (2,7) else "SimpleHTTPServer")')"
|
||||
|
||||
dcmd()
|
||||
{
|
||||
docker exec -i -t $1 bash
|
||||
}
|
||||
|
||||
gen_mysqlalias()
|
||||
{
|
||||
input="$1"
|
||||
|
||||
while IFS='' read -r line
|
||||
do
|
||||
[ -z "$line" ] && continue
|
||||
container_port=$(echo "$line" | cut -d\; -f1)
|
||||
container_name=$(echo "$line" | cut -d\; -f2)
|
||||
container_datadir=$(echo "$line" | cut -d\; -f3)
|
||||
image_name=$(echo "$line" | cut -d\; -f4)
|
||||
|
||||
alias mysql_$container_name="mysql -u root -h 127.0.0.1 -P $container_port"
|
||||
done < "$input"
|
||||
}
|
||||
|
||||
exec_mysql()
|
||||
{
|
||||
input="$1"
|
||||
name=$2
|
||||
db=$3
|
||||
sqlfile=$4
|
||||
while IFS='' read -r line
|
||||
do
|
||||
[ -z "$line" ] && continue
|
||||
echo "$line" | grep -q $name
|
||||
[ $? -ne 0 ] && continue
|
||||
container_port=$(echo "$line" | cut -d\; -f1)
|
||||
container_name=$(echo "$line" | cut -d\; -f2)
|
||||
container_datadir=$(echo "$line" | cut -d\; -f3)
|
||||
image_name=$(echo "$line" | cut -d\; -f4)
|
||||
|
||||
|
||||
echo "* Executing $sqlfile on $container_name"
|
||||
cat $sqlfile | mysql -u root -h 127.0.0.1 -P $container_port
|
||||
done < "$input"
|
||||
}
|
||||
exec_mysqls()
|
||||
{
|
||||
input="$1"
|
||||
db=$2
|
||||
sqlfile=$3
|
||||
while IFS='' read -r line
|
||||
do
|
||||
[ -z "$line" ] && continue
|
||||
container_port=$(echo "$line" | cut -d\; -f1)
|
||||
container_name=$(echo "$line" | cut -d\; -f2)
|
||||
container_datadir=$(echo "$line" | cut -d\; -f3)
|
||||
image_name=$(echo "$line" | cut -d\; -f4)
|
||||
|
||||
|
||||
echo "* Executing $sqlfile on $container_name"
|
||||
cat $sqlfile | mysql -u root -h 127.0.0.1 -P $container_port
|
||||
done < "$input"
|
||||
=======
|
||||
# Some Alias
|
||||
alias h=history
|
||||
alias s=sudo
|
||||
alias rsh='ssh -l root'
|
||||
alias lh='ls -lsh'
|
||||
alias ll='ls -ls'
|
||||
alias la='ls -lsa'
|
||||
|
||||
alias gst='git status'
|
||||
alias grm='git rm -f'
|
||||
alias gadd='git add'
|
||||
alias gcm='git commit -m'
|
||||
alias gps='git push'
|
||||
alias gpl='git pull'
|
||||
alias glg='git log'
|
||||
alias gmh='git log --follow -p --'
|
||||
alias gbl='git blame'
|
||||
alias grs='git reset --soft HEAD~1'
|
||||
alias grh='git reset --hard HEAD~1'
|
||||
alias serve="python -m $(python -c 'import sys; print("http.server" if sys.version_info[:2] > (2,7) else "SimpleHTTPServer")')"
|
||||
|
||||
|
||||
gunt() {
|
||||
git status | \
|
||||
grep -vE '(Changes to be committed:| to publish your local commits|git add|git restore|On branch|Your branch|Untracked files|nclude in what will b|but untracked files present|no changes added to commit|modified:|deleted:|Changes not staged for commit)' |\
|
||||
sort | uniq | \
|
||||
xargs -n 1 $*
|
||||
}
|
||||
|
||||
gam() {
|
||||
git status | \
|
||||
grep 'modified:' | \
|
||||
cut -d: -f2- | \
|
||||
sort | uniq | \
|
||||
xargs -n 1 git add
|
||||
}
|
||||
|
||||
gad() {
|
||||
git status | \
|
||||
grep 'deleted:' | \
|
||||
cut -d: -f2- | \
|
||||
sort | uniq | \
|
||||
xargs -n 1 git rm -f
|
||||
}
|
||||
|
||||
dcmd()
|
||||
{
|
||||
docker exec -i -t $1 bash
|
||||
}
|
||||
|
||||
gen_mysqlalias()
|
||||
{
|
||||
input="$1"
|
||||
|
||||
while IFS='' read -r line
|
||||
do
|
||||
[ -z "$line" ] && continue
|
||||
container_port=$(echo "$line" | cut -d\; -f1)
|
||||
container_name=$(echo "$line" | cut -d\; -f2)
|
||||
container_datadir=$(echo "$line" | cut -d\; -f3)
|
||||
image_name=$(echo "$line" | cut -d\; -f4)
|
||||
|
||||
alias mysql_$container_name="mysql -u root -h 127.0.0.1 -P $container_port"
|
||||
done < "$input"
|
||||
}
|
||||
|
||||
exec_mysql()
|
||||
{
|
||||
input="$1"
|
||||
name=$2
|
||||
db=$3
|
||||
sqlfile=$4
|
||||
while IFS='' read -r line
|
||||
do
|
||||
[ -z "$line" ] && continue
|
||||
echo "$line" | grep -q $name
|
||||
[ $? -ne 0 ] && continue
|
||||
container_port=$(echo "$line" | cut -d\; -f1)
|
||||
container_name=$(echo "$line" | cut -d\; -f2)
|
||||
container_datadir=$(echo "$line" | cut -d\; -f3)
|
||||
image_name=$(echo "$line" | cut -d\; -f4)
|
||||
|
||||
|
||||
echo "* Executing $sqlfile on $container_name"
|
||||
cat $sqlfile | mysql -u root -h 127.0.0.1 -P $container_port
|
||||
done < "$input"
|
||||
}
|
||||
exec_mysqls()
|
||||
{
|
||||
input="$1"
|
||||
db=$2
|
||||
sqlfile=$3
|
||||
while IFS='' read -r line
|
||||
do
|
||||
[ -z "$line" ] && continue
|
||||
container_port=$(echo "$line" | cut -d\; -f1)
|
||||
container_name=$(echo "$line" | cut -d\; -f2)
|
||||
container_datadir=$(echo "$line" | cut -d\; -f3)
|
||||
image_name=$(echo "$line" | cut -d\; -f4)
|
||||
|
||||
|
||||
echo "* Executing $sqlfile on $container_name"
|
||||
cat $sqlfile | mysql -u root -h 127.0.0.1 -P $container_port
|
||||
done < "$input"
|
||||
}
|
|
@ -14,14 +14,15 @@ my $i=1;
|
|||
while (my $row = <$fh>) {
|
||||
chomp $row;
|
||||
if ($row =~ /^$headerSep/) {
|
||||
print "</pre>\n";
|
||||
$row =~ s/$headerSep//g;
|
||||
print "<H3 >$row</H3>\n";
|
||||
print "<pre>";
|
||||
$i++;
|
||||
next;
|
||||
}
|
||||
print "</pre>\n";
|
||||
$row =~ s/$headerSep//g;
|
||||
print "<H3 >$row</H3>\n";
|
||||
print "<pre>";
|
||||
$i++;
|
||||
next;
|
||||
}
|
||||
print "$row\n" unless $row =~ /^\s*$/;
|
||||
}
|
||||
print "</pre>\n";
|
||||
close $fh;
|
||||
|
212
mysqltuner.pl
212
mysqltuner.pl
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env perl
|
||||
# mysqltuner.pl - Version 1.7.24
|
||||
# mysqltuner.pl - Version 1.8.1
|
||||
# High Performance MySQL Tuning Script
|
||||
# Copyright (C) 2006-2021 Major Hayden - major@mhtx.net
|
||||
#
|
||||
|
@ -56,7 +56,7 @@ $Data::Dumper::Pair = " : ";
|
|||
#use Env;
|
||||
|
||||
# Set up a few variables for use in the script
|
||||
my $tunerversion = "1.7.24";
|
||||
my $tunerversion = "1.8.1";
|
||||
my ( @adjvars, @generalrec );
|
||||
|
||||
# Set defaults
|
||||
|
@ -133,7 +133,7 @@ GetOptions(
|
|||
'color', 'noprocess',
|
||||
'dbstat', 'nodbstat',
|
||||
'tbstat', 'notbstat',
|
||||
'colstat', 'nocolstat',
|
||||
'colstat', 'nocolstat',
|
||||
'sysstat', 'nosysstat',
|
||||
'pfstat', 'nopfstat',
|
||||
'idxstat', 'noidxstat',
|
||||
|
@ -199,12 +199,12 @@ 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{colstat} = 0 if ( $opt{nocolstat} == 1 ); # Don't Print column 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
|
||||
$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
|
||||
|
||||
|
@ -300,9 +300,18 @@ sub infoprinthcmd {
|
|||
|
||||
# Calculates the number of physical cores considering HyperThreading
|
||||
sub cpu_cores {
|
||||
my $cntCPU =
|
||||
if ( $^O eq 'linux' ) {
|
||||
my $cntCPU =
|
||||
`awk -F: '/^core id/ && !P[\$2] { CORES++; P[\$2]=1 }; /^physical id/ && !N[\$2] { CPUs++; N[\$2]=1 }; END { print CPUs*CORES }' /proc/cpuinfo`;
|
||||
return ( $cntCPU == 0 ? `nproc` : $cntCPU );
|
||||
return ( $cntCPU == 0 ? `nproc` : $cntCPU );
|
||||
}
|
||||
|
||||
if ( $^O eq 'freebsd' ) {
|
||||
my $cntCPU = `sysctl -n kern.smp.cores`;
|
||||
chomp $cntCPU;
|
||||
return $cntCPU + 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
# Calculates the parameter passed in bytes, then rounds it to one decimal place
|
||||
|
@ -1167,11 +1176,26 @@ sub get_all_vars {
|
|||
}
|
||||
}
|
||||
debugprint Dumper(@mysqlenginelist);
|
||||
my @mysqlslave = select_array("SHOW SLAVE STATUS\\G");
|
||||
|
||||
my @mysqlslave;
|
||||
if ( mysql_version_eq(8) or mysql_version_ge( 10, 5 ) ) {
|
||||
@mysqlslave = select_array("SHOW REPLICA STATUS\\G");
|
||||
}
|
||||
else {
|
||||
@mysqlslave = select_array("SHOW SLAVE STATUS\\G");
|
||||
}
|
||||
arr2hash( \%myrepl, \@mysqlslave, ':' );
|
||||
$result{'Replication'}{'Status'} = \%myrepl;
|
||||
my @mysqlslaves = select_array "SHOW SLAVE HOSTS";
|
||||
my @lineitems = ();
|
||||
|
||||
my @mysqlslaves;
|
||||
if ( mysql_version_eq(8) or mysql_version_ge( 10, 5 ) ) {
|
||||
@mysqlslaves = select_array "SHOW SLAVE STATUS";
|
||||
}
|
||||
else {
|
||||
@mysqlslaves = select_array("SHOW SLAVE HOSTS\\G");
|
||||
}
|
||||
|
||||
my @lineitems = ();
|
||||
foreach my $line (@mysqlslaves) {
|
||||
debugprint "L: $line ";
|
||||
@lineitems = split /\s+/, $line;
|
||||
|
@ -1336,14 +1360,14 @@ sub log_file_recommendations {
|
|||
if ( $nbWarnLog > 0 ) {
|
||||
badprint "$myvar{'log_error'} contains $nbWarnLog warning(s).";
|
||||
push @generalrec,
|
||||
"Control warning line(s) into $myvar{'log_error'} file";
|
||||
"Check warning line(s) in $myvar{'log_error'} file";
|
||||
}
|
||||
else {
|
||||
goodprint "$myvar{'log_error'} doesn't contain any warning.";
|
||||
}
|
||||
if ( $nbErrLog > 0 ) {
|
||||
badprint "$myvar{'log_error'} contains $nbErrLog error(s).";
|
||||
push @generalrec, "Control error line(s) into $myvar{'log_error'} file";
|
||||
push @generalrec, "Check error line(s) in $myvar{'log_error'} file";
|
||||
}
|
||||
else {
|
||||
goodprint "$myvar{'log_error'} doesn't contain any error.";
|
||||
|
@ -1565,8 +1589,18 @@ sub merge_hash {
|
|||
}
|
||||
|
||||
sub is_virtual_machine {
|
||||
my $isVm = `grep -Ec '^flags.*\ hypervisor\ ' /proc/cpuinfo`;
|
||||
return ( $isVm == 0 ? 0 : 1 );
|
||||
if ( $^O eq 'linux' ) {
|
||||
my $isVm = `grep -Ec '^flags.*\ hypervisor\ ' /proc/cpuinfo`;
|
||||
return ( $isVm == 0 ? 0 : 1 );
|
||||
}
|
||||
|
||||
if ( $^O eq 'freebsd' ) {
|
||||
my $isVm = `sysctl -n kern.vm_guest`;
|
||||
chomp $isVm;
|
||||
print "FARK DEBUG isVm=[$isVm]";
|
||||
return ( $isVm eq 'none' ? 0 : 1 );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub infocmd {
|
||||
|
@ -1635,17 +1669,18 @@ sub get_kernel_info {
|
|||
infoprint "TCP slot entries is > 100.";
|
||||
}
|
||||
|
||||
if ( `sysctl -n fs.aio-max-nr` < 1000000 ) {
|
||||
badprint
|
||||
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)';
|
||||
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.";
|
||||
}
|
||||
}
|
||||
else {
|
||||
infoprint "Max Number of AIO events is > 1M.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sub get_system_info {
|
||||
|
@ -1913,10 +1948,10 @@ q{SELECT CONCAT(QUOTE(user), '@', QUOTE(host)) FROM mysql.global_priv WHERE
|
|||
foreach my $line ( sort @mysqlstatlist ) {
|
||||
chomp($line);
|
||||
my $luser = ( split /@/, $line )[0];
|
||||
badprint "User '" . $line
|
||||
. "' does not specify hostname restrictions.";
|
||||
badprint "User " . $line
|
||||
. " does not specify hostname restrictions.";
|
||||
push( @generalrec,
|
||||
"Restrict Host for $luser\@% to $luser\@LimitedIPRangeOrLocalhost"
|
||||
"Restrict Host for $luser\@'%' to $luser\@LimitedIPRangeOrLocalhost"
|
||||
);
|
||||
push( @generalrec,
|
||||
"RENAME USER $luser\@'%' TO "
|
||||
|
@ -2035,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' ) {
|
||||
|
@ -2068,7 +2103,8 @@ sub validate_mysql_version {
|
|||
or mysql_version_eq( 10, 2 )
|
||||
or mysql_version_eq( 10, 3 )
|
||||
or mysql_version_eq( 10, 4 )
|
||||
or mysql_version_eq( 10, 5 ) )
|
||||
or mysql_version_eq( 10, 5 )
|
||||
or mysql_version_eq( 10, 6 ) )
|
||||
{
|
||||
goodprint "Currently running supported MySQL version "
|
||||
. $myvar{'version'} . "";
|
||||
|
@ -2706,8 +2742,19 @@ sub calculations {
|
|||
|
||||
# Table cache
|
||||
if ( $mystat{'Opened_tables'} > 0 ) {
|
||||
$mycalc{'table_cache_hit_rate'} =
|
||||
int( $mystat{'Open_tables'} * 100 / $mystat{'Opened_tables'} );
|
||||
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 {
|
||||
$mycalc{'table_cache_hit_rate'} = 100;
|
||||
|
@ -2767,6 +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'} );
|
||||
if ( $myvar{'have_innodb'} eq "YES" ) {
|
||||
$mycalc{'innodb_log_size_pct'} =
|
||||
( $myvar{'innodb_log_file_size'} *
|
||||
|
@ -3257,11 +3308,25 @@ sub mysql_stats {
|
|||
my $table_cache_var = "";
|
||||
if ( $mystat{'Open_tables'} > 0 ) {
|
||||
if ( $mycalc{'table_cache_hit_rate'} < 20 ) {
|
||||
badprint "Table cache hit rate: $mycalc{'table_cache_hit_rate'}% ("
|
||||
. hr_num( $mystat{'Open_tables'} )
|
||||
. " open / "
|
||||
. hr_num( $mystat{'Opened_tables'} )
|
||||
. " opened)";
|
||||
|
||||
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";
|
||||
}
|
||||
|
@ -3302,11 +3367,24 @@ sub mysql_stats {
|
|||
. ")" );
|
||||
}
|
||||
else {
|
||||
goodprint "Table cache hit rate: $mycalc{'table_cache_hit_rate'}% ("
|
||||
. hr_num( $mystat{'Open_tables'} )
|
||||
. " open / "
|
||||
. hr_num( $mystat{'Opened_tables'} )
|
||||
. " opened)";
|
||||
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)";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3554,7 +3632,31 @@ sub mariadb_threadpool {
|
|||
infoprint "ThreadPool stat is enabled.";
|
||||
infoprint "Thread Pool Size: " . $myvar{'thread_pool_size'} . " thread(s).";
|
||||
|
||||
if ( $myvar{'version'} =~ /mariadb|percona/i ) {
|
||||
if ( $myvar{'version'} =~ /percona/i ) {
|
||||
my $np = cpu_cores;
|
||||
if ( $myvar{'thread_pool_size'} >= $np
|
||||
and $myvar{'thread_pool_size'} < ( $np * 1.5 ) )
|
||||
{
|
||||
goodprint
|
||||
"thread_pool_size for Percona betwwen 1 and 1.5 times nimber of CPUs ("
|
||||
. $np . " and "
|
||||
. ( $np * 1.5 ) . ")";
|
||||
}
|
||||
else {
|
||||
badprint
|
||||
"thread_pool_size for Percona betwwen 1 and 1.5 times nimber of CPUs ("
|
||||
. $np . " and "
|
||||
. ( $np * 1.5 ) . ")";
|
||||
push( @adjvars,
|
||||
"thread_pool_size between "
|
||||
. $np . " and "
|
||||
. ( $np * 1.5 )
|
||||
. " for InnoDB usage" );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $myvar{'version'} =~ /mariadb/i ) {
|
||||
infoprint "Using default value is good enough for your version ("
|
||||
. $myvar{'version'} . ")";
|
||||
return;
|
||||
|
@ -5257,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;
|
||||
|
@ -5279,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;
|
||||
|
@ -5373,15 +5475,19 @@ having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0"
|
|||
|
||||
if ( get_wsrep_option('gcs.fc_limit') != $myvar{'wsrep_slave_threads'} * 5 )
|
||||
{
|
||||
badprint "gcs.fc_limit should be equal to 5 * wsrep_slave_threads (=".($myvar{'wsrep_slave_threads'} * 5). ")";
|
||||
push @adjvars, "gcs.fc_limit= wsrep_slave_threads * 5 (=".($myvar{'wsrep_slave_threads'} * 5). ")";
|
||||
badprint "gcs.fc_limit should be equal to 5 * wsrep_slave_threads (="
|
||||
. ( $myvar{'wsrep_slave_threads'} * 5 ) . ")";
|
||||
push @adjvars, "gcs.fc_limit= wsrep_slave_threads * 5 (="
|
||||
. ( $myvar{'wsrep_slave_threads'} * 5 ) . ")";
|
||||
}
|
||||
else {
|
||||
goodprint "gcs.fc_limit is equal to 5 * wsrep_slave_threads ( =".get_wsrep_option('gcs.fc_limit') .")";
|
||||
goodprint "gcs.fc_limit is equal to 5 * wsrep_slave_threads ( ="
|
||||
. get_wsrep_option('gcs.fc_limit') . ")";
|
||||
}
|
||||
|
||||
if ( get_wsrep_option('gcs.fc_factor') != 0.8 ) {
|
||||
badprint "gcs.fc_factor should be equal to 0.8 (=".get_wsrep_option('gcs.fc_factor').")";
|
||||
badprint "gcs.fc_factor should be equal to 0.8 (="
|
||||
. get_wsrep_option('gcs.fc_factor') . ")";
|
||||
push @adjvars, "gcs.fc_factor=0.8";
|
||||
}
|
||||
else {
|
||||
|
@ -5446,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 ) {
|
||||
|
@ -6131,10 +6237,12 @@ sub mysql_tables {
|
|||
uc($ctype) . ( $isnull eq 'NO' ? " NOT NULL" : "" );
|
||||
my $optimal_type = '';
|
||||
|
||||
if ($opt{colstat} == 1) {
|
||||
$optimal_type = select_str_g( "Optimal_fieldtype",
|
||||
if ( $opt{colstat} == 1 ) {
|
||||
$optimal_type = select_str_g( "Optimal_fieldtype",
|
||||
"SELECT \\`$_\\` FROM \\`$dbname\\`.\\`$tbname\\` PROCEDURE ANALYSE(100000)"
|
||||
) unless ( mysql_version_ge(8) and not mysql_version_eq(10) );
|
||||
)
|
||||
unless ( mysql_version_ge(8)
|
||||
and not mysql_version_eq(10) );
|
||||
}
|
||||
if ( $optimal_type eq '' ) {
|
||||
infoprint " Current Fieldtype: $current_type";
|
||||
|
@ -6487,7 +6595,7 @@ __END__
|
|||
|
||||
=head1 NAME
|
||||
|
||||
MySQLTuner 1.7.24 - MySQL High Performance Tuning Script
|
||||
MySQLTuner 1.8.1 - 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