From 467e999a17310cb485686f1140c5e1b4a1528132 Mon Sep 17 00:00:00 2001 From: Jean-Marie Renouard Date: Mon, 27 Sep 2021 11:55:22 +0200 Subject: [PATCH] clean end line --- .gitignore | 22 +- .perltidy | 38 +- INTERNALS.md | 834 ++++++++++++++++---------------- README.fr.md | 472 +++++++++--------- README.md | 746 ++++++++++++++-------------- Vagrant/prepare.sh | 18 +- build/bashrc | 136 +++--- build/build_rpm.sh | 36 +- build/clean.sh | 6 +- build/clearContainer.sh | 10 +- build/configimg.conf | 30 +- build/createMassDockerImages.sh | 180 +++---- build/createTestEnvs.sh | 54 +-- build/deployOn | 24 +- build/fetchSampleDatabases.sh | 68 +-- build/mysqltuner.spec.tpl | 102 ++-- build/runAudit.sh | 230 ++++----- build/runMT.sh | 52 +- build/sync.sh | 34 +- build/updateStaff.sh | 30 +- mysqltuner.pl | 2 +- 21 files changed, 1562 insertions(+), 1562 deletions(-) diff --git a/.gitignore b/.gitignore index bf0c3bd..14af449 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,11 @@ -build/mysqltuner-* -build/mysqltuner.spec -build/build.log -build/cve* -build/vulnerabilities* -*.bak -Vagrant/Vagrantfile -Vagrant/data -Vagrant/.vagrant -contents -contents/* +build/mysqltuner-* +build/mysqltuner.spec +build/build.log +build/cve* +build/vulnerabilities* +*.bak +Vagrant/Vagrantfile +Vagrant/data +Vagrant/.vagrant +contents +contents/* diff --git a/.perltidy b/.perltidy index 3e4678a..c89faf0 100644 --- a/.perltidy +++ b/.perltidy @@ -1,19 +1,19 @@ ---backup-and-modify-in-place ---backup-file-extension=beforeTidy ---block-brace-tightness=2 ---brace-tightness=2 ---closing-token-indentation=1 ---continuation-indentation=4 ---indent-columns=4 ---maximum-line-length=134 ---cuddled-else ---opening-sub-brace-on-new-line ---noopening-brace-on-new-line ---nooutdent-labels ---paren-tightness=2 ---square-bracket-tightness=2 ---vertical-tightness=0 ---vertical-tightness-closing=0 ---break-at-old-comma-breakpoints ---entab-leading-whitespace=4 ---tabs +--backup-and-modify-in-place +--backup-file-extension=beforeTidy +--block-brace-tightness=2 +--brace-tightness=2 +--closing-token-indentation=1 +--continuation-indentation=4 +--indent-columns=4 +--maximum-line-length=134 +--cuddled-else +--opening-sub-brace-on-new-line +--noopening-brace-on-new-line +--nooutdent-labels +--paren-tightness=2 +--square-bracket-tightness=2 +--vertical-tightness=0 +--vertical-tightness-closing=0 +--break-at-old-comma-breakpoints +--entab-leading-whitespace=4 +--tabs diff --git a/INTERNALS.md b/INTERNALS.md index 9f2090b..3e009cb 100644 --- a/INTERNALS.md +++ b/INTERNALS.md @@ -1,417 +1,417 @@ -## MySQLTuner Internals - -## Table of contents - -* [MySQLTuner steps](#mysqltuner-steps) -* [Get login information steps](#mysqltuner-get-login-information-steps) -* [System checks](#mysqltuner-system-checks) -* [Server version checks](#mysqltuner-server-version-checks) -* [Error log file checks](#mysql-error-log-file-analysis) -* [MySQL Storage engine general information](#mysql-storage-engine-general-information) -* [Security checks](#mysqltuner-security-checks) -* [CVE checks](#mysqltuner-cve-checks) -* [Database information](#mysqltuner-database-information) -* [Index information](#mysqltuner-index-information) -* [Connections information](#mysqltuner-connections-information) -* [Server information](#mysqltuner-server-information) -* [Sort, join and temp table information](#mysqltuner-sort-join-and-temp-table-information) -* [Global buffer information](#mysqltuner-global-buffer-information) -* [Query cache checks](#mysqltuner-query-cache-checks) -* [Slow queries checks](#mysqltuner-slow-queries-checks) -* [ThreadPool information](#mysqltuner-threadpool-information) -* [Replication checks](#mysqltuner-replication-checks) -* [InnoDB information](#mysqltuner-innodb-information) -* [MYISAM information](#mysqltuner-myisam-information) -* [ARIADB information](#mysqltuner-ariadb-information) -* [XTRADB information](#mysqltuner-xtradb-information) -* [TOKUDB information](#mysqltuner-tokudb-information) -* [ROCKDB information](#mysqltuner-rockdb-information) -* [CONNECT information](#mysqltuner-connect-information) -* [SPIDER information](#mysqltuner-spider-information) -* [GALERA information](#mysqltuner-galera-information) -* [Performance Schema information](#mysqltuner-performance-schema-and-sysschema-information) - -## MySQLTuner steps - -* Header Print -* Get login information -* Set up some OS variables -* Toss variables/status into hashes -* Get information about the tuning connexion -* Check current MySQL version -* Suggest 64-bit upgrade -* Analyze mysqld error log file -* Show enabled storage engines -* Show informations about databases (option: --dbstat) -* Show informations about indexes (option: --idxstat) -* Display some security recommendations -* Calculate everything we need -* Print the server stats -* Print MyISAM stats -* Print InnoDB stats -* Print AriaDB stats -* Print replication info -* Make recommendations based on stats -* Close reportfile if needed -* Dump result if debug is on - -## MySQLTuner get login information steps - -* Is a login possible? - * Force socket? - * Remote connection? - * _Specifying available RAM is required_ - * Got user/pass on command line? - * mysql-quickbackup credentials available? - * Plesk credentials available? - * DirectAdmin credentials available? - * Debian maintenance account credentials available? - * Just try a login - * If working, and .my.cnf isn't there, **WARNING** - * If working, and .my.cnf is there, okay - * Prompt for creds on the console - -## MySQLTuner system checks -* 32-bit w/>2GB RAM check -* Check number of opened ports (warning if more than 9 ports opened) -* Check 80, 8080, 443 and 8443 ports if warning are raised if there are opened -* Check if some banned ports are not opened (option --bannedports separated by comma) -* Check if non kernel and user process except mysqld are not using more than 15% of total physical memory) -* Check vm.swapiness -* Check /etc/security/limit.conf -* Check sysctl entries: sunrpc.tcp_slot_entries, vm.swappiness, fs.aio-fs-nr -* Check mount point -* Check Ethernet card -* Check load average - -## MySQLTuner Server version checks -* EOL MySQL version check -* Currently MySQL < 5.1 are EOF considered. -* Using 5.5+ version of MySQL for performance issue (asynchronous IO). - -## Mysql error log file analysis -* Look for potential current error log file name -* Check permission on error log file -* Check size on error log file -* Check error and warning on error log file -* Find last start and shutdown on error log file - -## MySQL Storage engine general information - -* Get storage engine counts/stats - * Check for DB engines that are enabled but unused - * Look for fragmented tables - * Look for auto-increments near capacity - * Look for table with autoincrement with value near max capacity - -## MySQLTuner security checks - -* Is anonymous user present? -* Users without passwords -* Users w/username as password -* Users w/o host restriction -* Weak password check (possibly using cracklib later?) -* Using basic_passwords.txt as password database -* Password list checks can be avoid (option: --skippassword) - -## MySQLTuner CVE vulnerabilities detection - -* option: --cvefile -* Check if your MariaDB or MySQL version contains CVE bulletins. - -## MySQLTuner database information -* Performance analysis parameter checks -* Per database information - * Tables number - * Rows number - * Total size - * Data size - * Percentage of data size - * Index size - * Percentage of index size - * Collation number - * Check that there is only one collation for all table in a database - * Check that there is only one collation for ll table columns in a database - * Check that there is only one storage engine per user database - - -## MySQLTuner index information - -* Top 10 worth selectivity index -* Per index information - * Index Cardinality - * Index Selectivity - * Misc information about index definition - * Misc information about index size - -## MySQLTuner Connections information - -* Highest usage of available connections -* Percentage of used connections (<85%) -* Percentage of aborted connections (<3%) - -## MySQLTuner server information - -* Uptime: If MySQL started within last 24 hours -* Bytes received and sent -* Number of connections -* Percentage between reads and writes -* Is binary log activated ? - * Is GTID mode activated ? - -## MySQLTuner sort, join and temp table information -* Max memory temporary table size allowed. -* Percentage of sort using temporary table (<10%) -* Number of join performed without using indexes (<250) -* Percentage of temporary table written on disk(<25%) -* Thread cache (=4) -* Thread cache hit ratio (>50%) if thread_handling is different of pools-of-threads -* Table cache hit ratio(>2°%) -* Table cache definition should be upper that total number of tables or in autoresizing mode -* Percentage of open file and open file limit(<85%) -* Percentage of table locks (<95%) -* Percentage of binlog cache lock (<90%) - -## MySQLTuner global buffer information - -* Key Buffer -* Max Tmp Table -* Per Thread Buffer - * Read Buffer - * Read RND Buffer - * Sort Buffer - * Thread stack - * Join Buffer - * Binlog Cache Buffers size if activated - -## MySQLTuner query cache checks - -* Is Query cache activated ? - * Query Cache Buffers - * Query Cache DISABLED, ALL REQUEST or ON DEMAND - * Query Cache Size - * Query cache hit ratio (cache efficiency) - -## MySQLTuner memory checks - -* Get total RAM/swap -* Is there enough memory for max connections reached by MySQL ? -* Is there enough memory for max connections allowed by MySQL ? -* Max percentage of memory used(<85%) - -## MySQLTuner slow queries checks - -* Percentage of Slow queries (<5%) - -## MySQLTuner replication checks - -* Is server replication configured as slave ? -* SQL replication thread running ? -* IO replication thread running ? -* Replication lag in seconds (Seconds_behind_master) -* Is Slave configured in read only ? -* replication type ROW, MIX, STMT -* replication Semisync master -* replication Semisync slave -* XA support activated -* replication started ? - -## MySQLTuner InnoDB information - -* InnoDB Buffer Pool Size - * If possible, innodb_buffer_pool_size should be greater data and index size for Innodb Table - * Innodb_buffer_pool_size should around 75 to 80 % of the available system memory. -* InnoDB Buffer Pool Instances - * MySQL needs 1 instance per 1Go of Buffer Pool - * innodb_buffer_pool instances = round(innodb_buffer_pool_size / 1Go) - * innodb_buffer_pool instances must be equals or lower than 64 - - - A bug in MySQL 5.6 causes SHOW VARIABLES to report an innodb_buffer_pool_instances value of 8 when innodb_buffer_pool_size is less than 1GB and only one buffer pool instance is present (Bug #18343670). - -* InnoDB Buffer Pool Usage - * If more than 20% of InnoDB buffer pool is not used, MySQLTuner raise an alert. -* InnoDB Buffer Pool Log Size - * InnoDB total log file size should be 25% of innodb_buffer_pool_size -* InnoDB Read efficiency - * Ratio of read without locks -* InnoDB Write efficiency - * Ratio of write without locks -* InnoDB Log Waits - * Checks that no lock is used on Innodb Log. -* InnoDB Chunk Size - * Check InnoDB Buffer Pool size is a multiple of InnoDB Buffer Pool chunk size * InnoDB Buffer Pool instances - -## MySQLTuner ARIADB information - -* Is Aria indexes size is greater than page cache size ? -* Page cache read hit ratio (>95%) -* Page cache write hit ratio (>95%) - - -## MySQLTuner MYISAM information - -* Key buffer usage (>90%) -* Is MyISAM indexes size is greater than key buffer size ? -* Key buffer read hit ratio (>95%) -* Key buffer write hit ratio (>95%) - -## MySQLTuner Galera information -* wsrep_ready cluster is ready -* wsrep_connected node is connected to other nodes -* wsrep_cluster_name is defined. -* wsrep_node_name is defined. -* Check thet notification script wsrep_notify_cmd is defined -* wsrep_cluster_status PRIMARY /NON PRIMARY. - * PRIMARY : Coherent cluster - * NO PRIMARY : cluster gets several states -* wsrep_ local_state_comment: Node state - * SYNCED (uptodate), - * DONOR(sending information to another node) - * Joiner(Try to reach cluster group) - * SYNCED state able to read/write -* wsrep_cluster_conf_id configuration level must be identical in all nodes -* wsrep_slave_thread is between 3 or 4 times number of CPU core. -* gcs.limit should be equal to wsrep_slave_threads * 5 -* gcs.fc_factor should be equal to 0.8 -* Flow control fraction should be lower than 0.02 (wsrep_flow_control_paused < 0.02) -* wsrep_last_commited committed level must be identical in all nodes -* Look for tables without primary keys -* Look for non InnoDB tables for Galera -* Variable innodb_flush_log_at_trx_commit should be set to 0. -* Check that there is 3 or 5 members in Galera cluster. -* Check that xtrabackup is used for SST method with wsrep_sst_method variable. -* Check variables wsrep_OSU_method is defined to TOI for updates. -* Check that there is no certification failures controlling wsrep_local_cert_failures status. - -## MySQLTuner TokuDB information - -* tokudb_cache_size -* tokudb_directio -* tokudb_empty_scan -* tokudb_read_block_size -* tokudb_commit_sync -* tokudb_checkpointing_period -* tokudb_block_size -* tokudb_cleaner_iterations -* tokudb_fanout - -## MySQLTuner XtraDB information - -* Nothing for the moment - -## MySQLTuner Connect information - -* Nothing for the moment - -## MySQLTuner Spider information - -* Nothing for the moment - -## MySQLTuner RocksDb information - -* Nothing for the moment - -## MySQLTuner Thread pool information - -* thread_pool_size between 16 to 36 for Innodb usage -* thread_pool_size between 4 to 8 for MyIsam usage - -## MySQLTuner performance schema and sysschema information -* Check that Performance schema is activated for 5.6+ version -* Check that Performance schema is deactivated for 5.5- version -* Check that Sys schema is installed -* sys Schema version -* Top user per connection -* Top user per statement -* Top user per statement latency -* Top user per lock latency -* Top user per full scans -* Top user per row_sent -* Top user per row modified -* Top user per io -* Top user per io latency -* Top host per connection -* Top host per statement -* Top host per statement latency -* Top host per lock latency -* Top host per full scans -* Top host per rows sent -* Top host per rows modified -* Top host per io -* Top 5 host per io latency -* Top IO type order by total io -* Top IO type order by total latency -* Top IO type order by max latency -* Top Stages order by total io -* Top Stages order by total latency -* Top Stages order by avg latency -* Top host per table scans -* InnoDB Buffer Pool by schema -* InnoDB Buffer Pool by table -* Process per allocated memory -* InnoDB Lock Waits -* Threads IO Latency -* High Cost SQL statements -* Top 5% slower queries -* Top 10 nb statement type -* Top statement by total latency -* Top statement by lock latency -* Top statement by full scans -* Top statement by rows sent -* Top statement by rows modified -* Use temporary tables -* Unused Indexes -* Full table scans -* Latest file IO by latency -* File by IO read bytes -* File by IO written bytes -* File per IO total latency -* File per IO read latency -* File per IO write latency -* Event Wait by read bytes -* Event Wait by write bytes -* Event per wait total latency -* Event per wait read latency -* Event per wait write latency -* TOP 15 most read indexes -* TOP 15 most modified indexes -* TOP 15 high select latency index -* TOP 15 high insert latency index -* TOP 15 high update latency index -* TOP 15 high delete latency index -* TOP 15 most read tables -* TOP 15 most modified tables -* TOP 15 high select latency tables -* TOP 15 high insert latency tables -* TOP 15 high update latency tables -* TOP 15 high delete latency tables -* Redundant indexes -* Tables not using InnoDb buffer -* Top 15 Tables using InnoDb buffer -* Top 15 Tables with InnoDb buffer free -* Top 15 Most executed queries -* Latest SQL queries in errors or warnings -* Top 20 queries with full table scans -* TOP 15 reader queries (95% percentile) -* TOP 15 row look queries (95% percentile) -* TOP 15 total latency queries (95% percentile) -* TOP 15 max latency queries (95% percentile) -* TOP 15 average latency queries (95% percentile) -* Top 20 queries with sort -* Last 50 queries with sort -* TOP 15 row sorting queries with sort -* TOP 15 total latency queries with sort -* TOP 15 merge queries with sort -* TOP 15 average sort merges queries with sort -* TOP 15 scans queries with sort -* TOP 15 range queries with sort -* Top 20 queries with temp table -* Last 50 queries with temp table -* TOP 15 total latency queries with temp table -* TOP 15 queries with temp table to disk -* TOP 15 class events by number -* TOP 30 events by number -* TOP 15 class events by total latency -* TOP 30 events by total latency -* TOP 15 class events by max latency -* TOP 30 events by max latency +## MySQLTuner Internals + +## Table of contents + +* [MySQLTuner steps](#mysqltuner-steps) +* [Get login information steps](#mysqltuner-get-login-information-steps) +* [System checks](#mysqltuner-system-checks) +* [Server version checks](#mysqltuner-server-version-checks) +* [Error log file checks](#mysql-error-log-file-analysis) +* [MySQL Storage engine general information](#mysql-storage-engine-general-information) +* [Security checks](#mysqltuner-security-checks) +* [CVE checks](#mysqltuner-cve-checks) +* [Database information](#mysqltuner-database-information) +* [Index information](#mysqltuner-index-information) +* [Connections information](#mysqltuner-connections-information) +* [Server information](#mysqltuner-server-information) +* [Sort, join and temp table information](#mysqltuner-sort-join-and-temp-table-information) +* [Global buffer information](#mysqltuner-global-buffer-information) +* [Query cache checks](#mysqltuner-query-cache-checks) +* [Slow queries checks](#mysqltuner-slow-queries-checks) +* [ThreadPool information](#mysqltuner-threadpool-information) +* [Replication checks](#mysqltuner-replication-checks) +* [InnoDB information](#mysqltuner-innodb-information) +* [MYISAM information](#mysqltuner-myisam-information) +* [ARIADB information](#mysqltuner-ariadb-information) +* [XTRADB information](#mysqltuner-xtradb-information) +* [TOKUDB information](#mysqltuner-tokudb-information) +* [ROCKDB information](#mysqltuner-rockdb-information) +* [CONNECT information](#mysqltuner-connect-information) +* [SPIDER information](#mysqltuner-spider-information) +* [GALERA information](#mysqltuner-galera-information) +* [Performance Schema information](#mysqltuner-performance-schema-and-sysschema-information) + +## MySQLTuner steps + +* Header Print +* Get login information +* Set up some OS variables +* Toss variables/status into hashes +* Get information about the tuning connexion +* Check current MySQL version +* Suggest 64-bit upgrade +* Analyze mysqld error log file +* Show enabled storage engines +* Show informations about databases (option: --dbstat) +* Show informations about indexes (option: --idxstat) +* Display some security recommendations +* Calculate everything we need +* Print the server stats +* Print MyISAM stats +* Print InnoDB stats +* Print AriaDB stats +* Print replication info +* Make recommendations based on stats +* Close reportfile if needed +* Dump result if debug is on + +## MySQLTuner get login information steps + +* Is a login possible? + * Force socket? + * Remote connection? + * _Specifying available RAM is required_ + * Got user/pass on command line? + * mysql-quickbackup credentials available? + * Plesk credentials available? + * DirectAdmin credentials available? + * Debian maintenance account credentials available? + * Just try a login + * If working, and .my.cnf isn't there, **WARNING** + * If working, and .my.cnf is there, okay + * Prompt for creds on the console + +## MySQLTuner system checks +* 32-bit w/>2GB RAM check +* Check number of opened ports (warning if more than 9 ports opened) +* Check 80, 8080, 443 and 8443 ports if warning are raised if there are opened +* Check if some banned ports are not opened (option --bannedports separated by comma) +* Check if non kernel and user process except mysqld are not using more than 15% of total physical memory) +* Check vm.swapiness +* Check /etc/security/limit.conf +* Check sysctl entries: sunrpc.tcp_slot_entries, vm.swappiness, fs.aio-fs-nr +* Check mount point +* Check Ethernet card +* Check load average + +## MySQLTuner Server version checks +* EOL MySQL version check +* Currently MySQL < 5.1 are EOF considered. +* Using 5.5+ version of MySQL for performance issue (asynchronous IO). + +## Mysql error log file analysis +* Look for potential current error log file name +* Check permission on error log file +* Check size on error log file +* Check error and warning on error log file +* Find last start and shutdown on error log file + +## MySQL Storage engine general information + +* Get storage engine counts/stats + * Check for DB engines that are enabled but unused + * Look for fragmented tables + * Look for auto-increments near capacity + * Look for table with autoincrement with value near max capacity + +## MySQLTuner security checks + +* Is anonymous user present? +* Users without passwords +* Users w/username as password +* Users w/o host restriction +* Weak password check (possibly using cracklib later?) +* Using basic_passwords.txt as password database +* Password list checks can be avoid (option: --skippassword) + +## MySQLTuner CVE vulnerabilities detection + +* option: --cvefile +* Check if your MariaDB or MySQL version contains CVE bulletins. + +## MySQLTuner database information +* Performance analysis parameter checks +* Per database information + * Tables number + * Rows number + * Total size + * Data size + * Percentage of data size + * Index size + * Percentage of index size + * Collation number + * Check that there is only one collation for all table in a database + * Check that there is only one collation for ll table columns in a database + * Check that there is only one storage engine per user database + + +## MySQLTuner index information + +* Top 10 worth selectivity index +* Per index information + * Index Cardinality + * Index Selectivity + * Misc information about index definition + * Misc information about index size + +## MySQLTuner Connections information + +* Highest usage of available connections +* Percentage of used connections (<85%) +* Percentage of aborted connections (<3%) + +## MySQLTuner server information + +* Uptime: If MySQL started within last 24 hours +* Bytes received and sent +* Number of connections +* Percentage between reads and writes +* Is binary log activated ? + * Is GTID mode activated ? + +## MySQLTuner sort, join and temp table information +* Max memory temporary table size allowed. +* Percentage of sort using temporary table (<10%) +* Number of join performed without using indexes (<250) +* Percentage of temporary table written on disk(<25%) +* Thread cache (=4) +* Thread cache hit ratio (>50%) if thread_handling is different of pools-of-threads +* Table cache hit ratio(>2°%) +* Table cache definition should be upper that total number of tables or in autoresizing mode +* Percentage of open file and open file limit(<85%) +* Percentage of table locks (<95%) +* Percentage of binlog cache lock (<90%) + +## MySQLTuner global buffer information + +* Key Buffer +* Max Tmp Table +* Per Thread Buffer + * Read Buffer + * Read RND Buffer + * Sort Buffer + * Thread stack + * Join Buffer + * Binlog Cache Buffers size if activated + +## MySQLTuner query cache checks + +* Is Query cache activated ? + * Query Cache Buffers + * Query Cache DISABLED, ALL REQUEST or ON DEMAND + * Query Cache Size + * Query cache hit ratio (cache efficiency) + +## MySQLTuner memory checks + +* Get total RAM/swap +* Is there enough memory for max connections reached by MySQL ? +* Is there enough memory for max connections allowed by MySQL ? +* Max percentage of memory used(<85%) + +## MySQLTuner slow queries checks + +* Percentage of Slow queries (<5%) + +## MySQLTuner replication checks + +* Is server replication configured as slave ? +* SQL replication thread running ? +* IO replication thread running ? +* Replication lag in seconds (Seconds_behind_master) +* Is Slave configured in read only ? +* replication type ROW, MIX, STMT +* replication Semisync master +* replication Semisync slave +* XA support activated +* replication started ? + +## MySQLTuner InnoDB information + +* InnoDB Buffer Pool Size + * If possible, innodb_buffer_pool_size should be greater data and index size for Innodb Table + * Innodb_buffer_pool_size should around 75 to 80 % of the available system memory. +* InnoDB Buffer Pool Instances + * MySQL needs 1 instance per 1Go of Buffer Pool + * innodb_buffer_pool instances = round(innodb_buffer_pool_size / 1Go) + * innodb_buffer_pool instances must be equals or lower than 64 + + - A bug in MySQL 5.6 causes SHOW VARIABLES to report an innodb_buffer_pool_instances value of 8 when innodb_buffer_pool_size is less than 1GB and only one buffer pool instance is present (Bug #18343670). + +* InnoDB Buffer Pool Usage + * If more than 20% of InnoDB buffer pool is not used, MySQLTuner raise an alert. +* InnoDB Buffer Pool Log Size + * InnoDB total log file size should be 25% of innodb_buffer_pool_size +* InnoDB Read efficiency + * Ratio of read without locks +* InnoDB Write efficiency + * Ratio of write without locks +* InnoDB Log Waits + * Checks that no lock is used on Innodb Log. +* InnoDB Chunk Size + * Check InnoDB Buffer Pool size is a multiple of InnoDB Buffer Pool chunk size * InnoDB Buffer Pool instances + +## MySQLTuner ARIADB information + +* Is Aria indexes size is greater than page cache size ? +* Page cache read hit ratio (>95%) +* Page cache write hit ratio (>95%) + + +## MySQLTuner MYISAM information + +* Key buffer usage (>90%) +* Is MyISAM indexes size is greater than key buffer size ? +* Key buffer read hit ratio (>95%) +* Key buffer write hit ratio (>95%) + +## MySQLTuner Galera information +* wsrep_ready cluster is ready +* wsrep_connected node is connected to other nodes +* wsrep_cluster_name is defined. +* wsrep_node_name is defined. +* Check thet notification script wsrep_notify_cmd is defined +* wsrep_cluster_status PRIMARY /NON PRIMARY. + * PRIMARY : Coherent cluster + * NO PRIMARY : cluster gets several states +* wsrep_ local_state_comment: Node state + * SYNCED (uptodate), + * DONOR(sending information to another node) + * Joiner(Try to reach cluster group) + * SYNCED state able to read/write +* wsrep_cluster_conf_id configuration level must be identical in all nodes +* wsrep_slave_thread is between 3 or 4 times number of CPU core. +* gcs.limit should be equal to wsrep_slave_threads * 5 +* gcs.fc_factor should be equal to 0.8 +* Flow control fraction should be lower than 0.02 (wsrep_flow_control_paused < 0.02) +* wsrep_last_commited committed level must be identical in all nodes +* Look for tables without primary keys +* Look for non InnoDB tables for Galera +* Variable innodb_flush_log_at_trx_commit should be set to 0. +* Check that there is 3 or 5 members in Galera cluster. +* Check that xtrabackup is used for SST method with wsrep_sst_method variable. +* Check variables wsrep_OSU_method is defined to TOI for updates. +* Check that there is no certification failures controlling wsrep_local_cert_failures status. + +## MySQLTuner TokuDB information + +* tokudb_cache_size +* tokudb_directio +* tokudb_empty_scan +* tokudb_read_block_size +* tokudb_commit_sync +* tokudb_checkpointing_period +* tokudb_block_size +* tokudb_cleaner_iterations +* tokudb_fanout + +## MySQLTuner XtraDB information + +* Nothing for the moment + +## MySQLTuner Connect information + +* Nothing for the moment + +## MySQLTuner Spider information + +* Nothing for the moment + +## MySQLTuner RocksDb information + +* Nothing for the moment + +## MySQLTuner Thread pool information + +* thread_pool_size between 16 to 36 for Innodb usage +* thread_pool_size between 4 to 8 for MyIsam usage + +## MySQLTuner performance schema and sysschema information +* Check that Performance schema is activated for 5.6+ version +* Check that Performance schema is deactivated for 5.5- version +* Check that Sys schema is installed +* sys Schema version +* Top user per connection +* Top user per statement +* Top user per statement latency +* Top user per lock latency +* Top user per full scans +* Top user per row_sent +* Top user per row modified +* Top user per io +* Top user per io latency +* Top host per connection +* Top host per statement +* Top host per statement latency +* Top host per lock latency +* Top host per full scans +* Top host per rows sent +* Top host per rows modified +* Top host per io +* Top 5 host per io latency +* Top IO type order by total io +* Top IO type order by total latency +* Top IO type order by max latency +* Top Stages order by total io +* Top Stages order by total latency +* Top Stages order by avg latency +* Top host per table scans +* InnoDB Buffer Pool by schema +* InnoDB Buffer Pool by table +* Process per allocated memory +* InnoDB Lock Waits +* Threads IO Latency +* High Cost SQL statements +* Top 5% slower queries +* Top 10 nb statement type +* Top statement by total latency +* Top statement by lock latency +* Top statement by full scans +* Top statement by rows sent +* Top statement by rows modified +* Use temporary tables +* Unused Indexes +* Full table scans +* Latest file IO by latency +* File by IO read bytes +* File by IO written bytes +* File per IO total latency +* File per IO read latency +* File per IO write latency +* Event Wait by read bytes +* Event Wait by write bytes +* Event per wait total latency +* Event per wait read latency +* Event per wait write latency +* TOP 15 most read indexes +* TOP 15 most modified indexes +* TOP 15 high select latency index +* TOP 15 high insert latency index +* TOP 15 high update latency index +* TOP 15 high delete latency index +* TOP 15 most read tables +* TOP 15 most modified tables +* TOP 15 high select latency tables +* TOP 15 high insert latency tables +* TOP 15 high update latency tables +* TOP 15 high delete latency tables +* Redundant indexes +* Tables not using InnoDb buffer +* Top 15 Tables using InnoDb buffer +* Top 15 Tables with InnoDb buffer free +* Top 15 Most executed queries +* Latest SQL queries in errors or warnings +* Top 20 queries with full table scans +* TOP 15 reader queries (95% percentile) +* TOP 15 row look queries (95% percentile) +* TOP 15 total latency queries (95% percentile) +* TOP 15 max latency queries (95% percentile) +* TOP 15 average latency queries (95% percentile) +* Top 20 queries with sort +* Last 50 queries with sort +* TOP 15 row sorting queries with sort +* TOP 15 total latency queries with sort +* TOP 15 merge queries with sort +* TOP 15 average sort merges queries with sort +* TOP 15 scans queries with sort +* TOP 15 range queries with sort +* Top 20 queries with temp table +* Last 50 queries with temp table +* TOP 15 total latency queries with temp table +* TOP 15 queries with temp table to disk +* TOP 15 class events by number +* TOP 30 events by number +* TOP 15 class events by total latency +* TOP 30 events by total latency +* TOP 15 class events by max latency +* TOP 30 events by max latency diff --git a/README.fr.md b/README.fr.md index 8bef63d..09fe27e 100644 --- a/README.fr.md +++ b/README.fr.md @@ -1,236 +1,236 @@ -MySQLTuner-perl -==== -[![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") -[![Percentage of issues still open](http://isitmaintained.com/badge/open/major/MySQLTuner-perl.svg)](http://isitmaintained.com/project/major/MySQLTuner-perl "Percentage of issues still open") -[![GPL Licence](https://badges.frapsoft.com/os/gpl/gpl.png?v=103)](https://opensource.org/licenses/GPL-3.0/) - -**MySQLTuner** est un script écrit en Perl qui permet d'effectuer une revue de configuration pour MySQL/MAriaDB/PerconaDB rapidement et propose des ajustements pour améliorer la performance et la stabilité du serveur. L'état des variables et statuts est analysé et présenté de manière synthétique et structurée ainsi que plusieurs suggestions basiques concernant la performance. - -**MySQLTuner** supporte dans a dernière version plus de ~300 indicators pour MySQL/MariaDB/Percona Server. - -**MySQLTuner** is maintained and indicator collect is increasing week after week supporting a lot of configuration sush 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 found more details on this indicators -![Indicators description](https://github.com/major/MySQLTuner-perl/blob/master/INTERNALS.md). - - -![MysqlTuner](https://github.com/major/MySQLTuner-perl/blob/master/mysqltuner.png) - -MySQLTuner needs you: -=== - -**MySQLTuner** needs contributors for documentation, code and feedbacks.. - -* Please join us on issue track at [GitHub tracker](https://github.com/major/MySQLTuner-perl/issues). -* Contribution guide is avalaible 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) - -Compatibility: -==== - -* MySQL 5.7 (full support) -* MySQL 5.6 (full support) -* MySQL 5.5 (full support) -* MariaDB 10.1 (full support) -* MariaDB 10.0 (full support) -* Percona Server 5.6 (full support) -* Percona XtraDB cluster (full support) -* MySQL 3.23, 4.0, 4.1, 5.0, 5.1 (partial support - deprecated version) -* 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) -* Windows is not supported at this time (Help wanted !!!!!) -* Unrestricted read access to the MySQL server (OS root access recommended for MySQL < 5.1) -* CVE vulnerabilites detection support from [https://cve.mitre.org](https://cve.mitre.org) - -***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. - -**Seriously - please review the FAQ section below.** - -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 --- - -You can download the entire repository by using 'git clone' followed by the cloning URL above. The simplest and shortest method is: - - 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 - perl mysqltuner.pl - -Of course, you can add the execute bit (`chmod +x mysqltuner.pl`) so you can execute it without calling perl directly. - -Specific usage --- - -__Usage:__ Minimal usage locally - - perl mysqltuner.pl - -__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 - - -__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 - -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 about 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 - pass=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. - - $ mysql_config_editor set --login-path=client --user=someusername --password --host=localhost - Enter passord: ******** - $ - -At this time, ~/.mylogin.cnf has been written with appropriated rigth 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 *.* FOR '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 a CVE vulneralibity checks ?** - -* Download vulnerabilities.csv from this repository. -* use option --cvefile to perform CVE checks - -**Question: How to use mysqltuner from 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 Connect to a remote host to perform tests (default: localhost) - --socket Use a different socket for a local connection - --port Port to use for connection (default: 3306) - --user Username to use for authentication - --pass Password to use for authentication - --defaults-file defaulfs file for credentials - -Since you are using a remote host, use parameters to supply values from the OS - - --forcemem Amount of RAM installed in megabytes - --forceswap 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) - -MySQLTuner and Vagrant --- -**MySQLTuner** contains following Vagrant configurations: -* Fedora Core 23 / MariaDB 10.0 -* Fedora Core 23 / MariaDB 10.1 -* Fedora Core 23 / MySQL 5.6 -* Fedora Core 23 / MySQL 5.7 - -**Vagrant File** are stored in Vagrant subdirectory. -* Follow this 2 steps after vagrant installation: -* Rename VagrantFile_for_Mxxx into Vagrantfile -* 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 23 box for official Fedora Download Website - * vagrant box add --name fc23 https://download.fedoraproject.org/pub/fedora/linux/releases/23/Cloud/x86_64/Images/Fedora-Cloud-Base-Vagrant-23-20151030.x86_64.vagrant-virtualbox.box -* Create a data directory - * mkdir data -* Rename Vagrantfile_MariaDB10.0 into Vagrantfile - * cp MySQLTuner-perl/Vagrant/Vagrantfile_for_MariaDB10.0 Vagrantfile -* Start vagrant - * vagrant up - -MySQLTuner a besoin de vous --- -**MySQLTuner** a besoin de contributeurs pour la documentation, le code, des tests et des retours d'expérience. - -* Rejoignez-nous sur le suivi de ticket à [GitHub tracker](https://github.com/major/MySQLTuner-perl/issues). -* Le guide de contribution en anglais est disponible ici [MySQLTuner contributing guide](https://github.com/major/MySQLTuner-perl/blob/master/CONTRIBUTING.md) -* Ajouter une étoile à **MySQLTuner project** ici [MySQLTuner Git Hub Project](https://github.com/major/MySQLTuner-perl) - +MySQLTuner-perl +==== +[![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") +[![Percentage of issues still open](http://isitmaintained.com/badge/open/major/MySQLTuner-perl.svg)](http://isitmaintained.com/project/major/MySQLTuner-perl "Percentage of issues still open") +[![GPL Licence](https://badges.frapsoft.com/os/gpl/gpl.png?v=103)](https://opensource.org/licenses/GPL-3.0/) + +**MySQLTuner** est un script écrit en Perl qui permet d'effectuer une revue de configuration pour MySQL/MAriaDB/PerconaDB rapidement et propose des ajustements pour améliorer la performance et la stabilité du serveur. L'état des variables et statuts est analysé et présenté de manière synthétique et structurée ainsi que plusieurs suggestions basiques concernant la performance. + +**MySQLTuner** supporte dans a dernière version plus de ~300 indicators pour MySQL/MariaDB/Percona Server. + +**MySQLTuner** is maintained and indicator collect is increasing week after week supporting a lot of configuration sush 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 found more details on this indicators +![Indicators description](https://github.com/major/MySQLTuner-perl/blob/master/INTERNALS.md). + + +![MysqlTuner](https://github.com/major/MySQLTuner-perl/blob/master/mysqltuner.png) + +MySQLTuner needs you: +=== + +**MySQLTuner** needs contributors for documentation, code and feedbacks.. + +* Please join us on issue track at [GitHub tracker](https://github.com/major/MySQLTuner-perl/issues). +* Contribution guide is avalaible 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) + +Compatibility: +==== + +* MySQL 5.7 (full support) +* MySQL 5.6 (full support) +* MySQL 5.5 (full support) +* MariaDB 10.1 (full support) +* MariaDB 10.0 (full support) +* Percona Server 5.6 (full support) +* Percona XtraDB cluster (full support) +* MySQL 3.23, 4.0, 4.1, 5.0, 5.1 (partial support - deprecated version) +* 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) +* Windows is not supported at this time (Help wanted !!!!!) +* Unrestricted read access to the MySQL server (OS root access recommended for MySQL < 5.1) +* CVE vulnerabilites detection support from [https://cve.mitre.org](https://cve.mitre.org) + +***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. + +**Seriously - please review the FAQ section below.** + +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 +-- + +You can download the entire repository by using 'git clone' followed by the cloning URL above. The simplest and shortest method is: + + 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 + perl mysqltuner.pl + +Of course, you can add the execute bit (`chmod +x mysqltuner.pl`) so you can execute it without calling perl directly. + +Specific usage +-- + +__Usage:__ Minimal usage locally + + perl mysqltuner.pl + +__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 + + +__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 + +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 about 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 + pass=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. + + $ mysql_config_editor set --login-path=client --user=someusername --password --host=localhost + Enter passord: ******** + $ + +At this time, ~/.mylogin.cnf has been written with appropriated rigth 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 *.* FOR '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 a CVE vulneralibity checks ?** + +* Download vulnerabilities.csv from this repository. +* use option --cvefile to perform CVE checks + +**Question: How to use mysqltuner from 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 Connect to a remote host to perform tests (default: localhost) + --socket Use a different socket for a local connection + --port Port to use for connection (default: 3306) + --user Username to use for authentication + --pass Password to use for authentication + --defaults-file defaulfs file for credentials + +Since you are using a remote host, use parameters to supply values from the OS + + --forcemem Amount of RAM installed in megabytes + --forceswap 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) + +MySQLTuner and Vagrant +-- +**MySQLTuner** contains following Vagrant configurations: +* Fedora Core 23 / MariaDB 10.0 +* Fedora Core 23 / MariaDB 10.1 +* Fedora Core 23 / MySQL 5.6 +* Fedora Core 23 / MySQL 5.7 + +**Vagrant File** are stored in Vagrant subdirectory. +* Follow this 2 steps after vagrant installation: +* Rename VagrantFile_for_Mxxx into Vagrantfile +* 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 23 box for official Fedora Download Website + * vagrant box add --name fc23 https://download.fedoraproject.org/pub/fedora/linux/releases/23/Cloud/x86_64/Images/Fedora-Cloud-Base-Vagrant-23-20151030.x86_64.vagrant-virtualbox.box +* Create a data directory + * mkdir data +* Rename Vagrantfile_MariaDB10.0 into Vagrantfile + * cp MySQLTuner-perl/Vagrant/Vagrantfile_for_MariaDB10.0 Vagrantfile +* Start vagrant + * vagrant up + +MySQLTuner a besoin de vous +-- +**MySQLTuner** a besoin de contributeurs pour la documentation, le code, des tests et des retours d'expérience. + +* Rejoignez-nous sur le suivi de ticket à [GitHub tracker](https://github.com/major/MySQLTuner-perl/issues). +* Le guide de contribution en anglais est disponible ici [MySQLTuner contributing guide](https://github.com/major/MySQLTuner-perl/blob/master/CONTRIBUTING.md) +* Ajouter une étoile à **MySQLTuner project** ici [MySQLTuner Git Hub Project](https://github.com/major/MySQLTuner-perl) + diff --git a/README.md b/README.md index 9f0320a..1de4405 100644 --- a/README.md +++ b/README.md @@ -1,373 +1,373 @@ -![MySQLTuner-perl](https://github.com/major/MySQLTuner-perl/blob/master/mtlogo.png) -==== -[![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") -[![Percentage of open issues](http://isitmaintained.com/badge/open/major/MySQLTuner-perl.svg)](http://isitmaintained.com/project/major/MySQLTuner-perl "Percentage of issues still open") -[![GPL License](https://badges.frapsoft.com/os/gpl/gpl.png?v=103)](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](https://github.com/major/MySQLTuner-perl/blob/master/mysqltuner.png) - -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 - -[![Stargazers over time](https://starcharts.herokuapp.com/major/MySQLTuner-perl.svg)](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: 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 Connect to a remote host to perform tests (default: localhost) - --socket Use a different socket for a local connection - --port Port to use for connection (default: 3306) - --user Username to use for authentication - --pass Password to use for authentication - --defaults-file defaults file for credentials - -Since you are using a remote host, use parameters to supply values from the OS - - --forcemem Amount of RAM installed in megabytes - --forceswap 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.. - -* 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 +![MySQLTuner-perl](https://github.com/major/MySQLTuner-perl/blob/master/mtlogo.png) +==== +[![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") +[![Percentage of open issues](http://isitmaintained.com/badge/open/major/MySQLTuner-perl.svg)](http://isitmaintained.com/project/major/MySQLTuner-perl "Percentage of issues still open") +[![GPL License](https://badges.frapsoft.com/os/gpl/gpl.png?v=103)](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](https://github.com/major/MySQLTuner-perl/blob/master/mysqltuner.png) + +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 + +[![Stargazers over time](https://starcharts.herokuapp.com/major/MySQLTuner-perl.svg)](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: 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 Connect to a remote host to perform tests (default: localhost) + --socket Use a different socket for a local connection + --port Port to use for connection (default: 3306) + --user Username to use for authentication + --pass Password to use for authentication + --defaults-file defaults file for credentials + +Since you are using a remote host, use parameters to supply values from the OS + + --forcemem Amount of RAM installed in megabytes + --forceswap 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.. + +* 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 diff --git a/Vagrant/prepare.sh b/Vagrant/prepare.sh index e1c5790..e6770fd 100644 --- a/Vagrant/prepare.sh +++ b/Vagrant/prepare.sh @@ -1,9 +1,9 @@ -#!/bin/sh -VERSION=${1:-"10.4"} -rm -f Vagrantfile -cp Vagrantfile_for_MariaDB${VERSION} Vagrantfile -mkdir data -vagrant plugin install vagrant-hostmanager -vagrant plugin install vagrant-vbguest -vagrant plugin install vagrant-proxyconf -vagrant --provision up +#!/bin/sh +VERSION=${1:-"10.4"} +rm -f Vagrantfile +cp Vagrantfile_for_MariaDB${VERSION} Vagrantfile +mkdir data +vagrant plugin install vagrant-hostmanager +vagrant plugin install vagrant-vbguest +vagrant plugin install vagrant-proxyconf +vagrant --provision up diff --git a/build/bashrc b/build/bashrc index 18344a8..16fa446 100644 --- a/build/bashrc +++ b/build/bashrc @@ -1,69 +1,69 @@ -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" } \ No newline at end of file diff --git a/build/build_rpm.sh b/build/build_rpm.sh index 8443226..1e96a34 100755 --- a/build/build_rpm.sh +++ b/build/build_rpm.sh @@ -1,18 +1,18 @@ -#!/bin/sh - -BUILD_DIR=`dirname $(readlink -f $0)` - -VERSION=$(grep -Ei 'my \$tunerversion' $BUILD_DIR/../mysqltuner.pl | grep = | cut -d\" -f2) -cd $BUILD_DIR -sh ./clean.sh - -perl -pe "s/%VERSION%/$VERSION/g" mysqltuner.spec.tpl > mysqltuner.spec -mkdir -p $BUILD_DIR/mysqltuner-$VERSION -cp $BUILD_DIR/../mysqltuner.pl mysqltuner.spec $BUILD_DIR/../LICENSE $BUILD_DIR/../basic_passwords.txt $BUILD_DIR/../*.csv $BUILD_DIR/mysqltuner-$VERSION -pod2man $BUILD_DIR/../mysqltuner.pl | gzip > $BUILD_DIR/mysqltuner-$VERSION/mysqltuner.1.gz - -tar czf $BUILD_DIR/mysqltuner-${VERSION}.tgz mysqltuner-$VERSION -rpmbuild -ta mysqltuner-${VERSION}.tgz 2>&1 | tee -a ./build.log -set -x -grep --color=never -E '(Wrote|crit)\S*:' $BUILD_DIR/build.log | cut -d: -f2 | xargs -I{} mv {} . -#rm -rf mysqltuner-$VERSION ./build.log +#!/bin/sh + +BUILD_DIR=`dirname $(readlink -f $0)` + +VERSION=$(grep -Ei 'my \$tunerversion' $BUILD_DIR/../mysqltuner.pl | grep = | cut -d\" -f2) +cd $BUILD_DIR +sh ./clean.sh + +perl -pe "s/%VERSION%/$VERSION/g" mysqltuner.spec.tpl > mysqltuner.spec +mkdir -p $BUILD_DIR/mysqltuner-$VERSION +cp $BUILD_DIR/../mysqltuner.pl mysqltuner.spec $BUILD_DIR/../LICENSE $BUILD_DIR/../basic_passwords.txt $BUILD_DIR/../*.csv $BUILD_DIR/mysqltuner-$VERSION +pod2man $BUILD_DIR/../mysqltuner.pl | gzip > $BUILD_DIR/mysqltuner-$VERSION/mysqltuner.1.gz + +tar czf $BUILD_DIR/mysqltuner-${VERSION}.tgz mysqltuner-$VERSION +rpmbuild -ta mysqltuner-${VERSION}.tgz 2>&1 | tee -a ./build.log +set -x +grep --color=never -E '(Wrote|crit)\S*:' $BUILD_DIR/build.log | cut -d: -f2 | xargs -I{} mv {} . +#rm -rf mysqltuner-$VERSION ./build.log diff --git a/build/clean.sh b/build/clean.sh index 4529219..52e7e90 100755 --- a/build/clean.sh +++ b/build/clean.sh @@ -1,3 +1,3 @@ -#!/bin/sh - -rm -rf mysqltuner-* mysqltuner.spec *.log +#!/bin/sh + +rm -rf mysqltuner-* mysqltuner.spec *.log diff --git a/build/clearContainer.sh b/build/clearContainer.sh index 410a071..e5f71ca 100644 --- a/build/clearContainer.sh +++ b/build/clearContainer.sh @@ -1,5 +1,5 @@ -#!/bin/sh - -docker ps | awk '{ print $NF}' |grep -v NAMES | xargs -n 1 docker kill -docker ps -a | awk '{ print $NF}' |grep -v NAMES | xargs -n 1 docker rm -docker ps -a +#!/bin/sh + +docker ps | awk '{ print $NF}' |grep -v NAMES | xargs -n 1 docker kill +docker ps -a | awk '{ print $NF}' |grep -v NAMES | xargs -n 1 docker rm +docker ps -a diff --git a/build/configimg.conf b/build/configimg.conf index b641cb7..c9996d4 100644 --- a/build/configimg.conf +++ b/build/configimg.conf @@ -1,15 +1,15 @@ -3306;mysql80;/var/lib/mysql8;mysql:8.0 -3307;mysql57;/var/lib/mysql57;mysql:5.7 -3308;mysql56;/var/lib/mysql56;mysql:5.6 -3309;mysql55;/var/lib/mysql55;mysql:5.5 - -4306;percona80;/var/lib/percona8;percona/percona-server:8.0 -4307;percona57;/var/lib/percona57;percona/percona-server:5.7 -4308;percona56;/var/lib/percona56;percona/percona-server:5.6 - -5306;mariadb104;/var/lib/mariadb104;mariadb:10.4 -5307;mariadb103;/var/lib/mariadb103;mariadb:10.3 -5308;mariadb102;/var/lib/mariadb102;mariadb:10.2 -5309;mariadb101;/var/lib/mariadb101;mariadb:10.1 -5310;mariadb100;/var/lib/mariadb100;mariadb:10.0 -5311;mariadb55;/var/lib/mariadb55;mariadb:5.5 +3306;mysql80;/var/lib/mysql8;mysql:8.0 +3307;mysql57;/var/lib/mysql57;mysql:5.7 +3308;mysql56;/var/lib/mysql56;mysql:5.6 +3309;mysql55;/var/lib/mysql55;mysql:5.5 + +4306;percona80;/var/lib/percona8;percona/percona-server:8.0 +4307;percona57;/var/lib/percona57;percona/percona-server:5.7 +4308;percona56;/var/lib/percona56;percona/percona-server:5.6 + +5306;mariadb104;/var/lib/mariadb104;mariadb:10.4 +5307;mariadb103;/var/lib/mariadb103;mariadb:10.3 +5308;mariadb102;/var/lib/mariadb102;mariadb:10.2 +5309;mariadb101;/var/lib/mariadb101;mariadb:10.1 +5310;mariadb100;/var/lib/mariadb100;mariadb:10.0 +5311;mariadb55;/var/lib/mariadb55;mariadb:5.5 diff --git a/build/createMassDockerImages.sh b/build/createMassDockerImages.sh index 543d860..8d72551 100644 --- a/build/createMassDockerImages.sh +++ b/build/createMassDockerImages.sh @@ -1,90 +1,90 @@ -#!/bin/sh - -input="./build/configimg.conf" -default_password="secret" - -echo "[client] -user=root -password=$default_password" > $HOME/.my.cnf - -chmod 600 $HOME/.my.cnf - -[ -f "$input" ] || echo " -3306;mysql80;/var/lib/mysql8;mysql:8.0 -3307;mysql57;/var/lib/mysql57;mysql:5.7 -3308;mysql56;/var/lib/mysql56;mysql:5.6 -3309;mysql55;/var/lib/mysql55;mysql:5.5 - -4306;percona80;/var/lib/percona8;percona/percona-server:8.0 -4307;percona57;/var/lib/percona57;percona/percona-server:5.7 -4308;percona56;/var/lib/percona56;percona/percona-server:5.6 - -5306;mariadb104;/var/lib/mariadb104;mariadb:10.4 -5307;mariadb103;/var/lib/mariadb103;mariadb:10.3 -5308;mariadb102;/var/lib/mariadb102;mariadb:10.2 -5309;mariadb101;/var/lib/mariadb101;mariadb:10.1 -5310;mariadb100;/var/lib/mariadb100;mariadb:10.0 -5311;mariadb55;/var/lib/mariadb55;mariadb:5.5 -" > "$input" - -# - -#echo '* PRUNING DOCKER SYSTEM DATA' - -#[ "$1" = "clean" ] || docker system prune -a -f -# download all images -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) - - if [ -n "$1" -a "$1" != "clean" ]; then - echo $line | grep -q "$1" - [ $? -eq 0 ] || continue - fi - echo "* PULLING DOCKER IMAGE: $image_name" - docker images | grep -E " $image_name$" - [ $? -ne 0 ] && docker pull $image_name - - echo "* REMOVING CONTAINER : $image_name" - docker ps -a | grep -qE "$container_name^" - docker rm -f $container_name - - if [ 1 -eq 0 ]; then - echo "* DELETING DATADIR: $container_datadir" - sudo rm -rf $container_datadir - [ "$1" = "clean" ] && continue - - echo "* CREATING DATADIR: $container_datadir" - sudo mkdir -p $container_datadir - fi - #sudo chown -R mysql.mysql $container_datadir - sudo chmod 777 $container_datadir - echo "* STARTING CONTAINER: $container_name($container_port/TCP) BASED ON $image_name -> $container_datadir" - set -x - docker run -d -e MYSQL_ROOT_PASSWORD=$default_password -p $container_port:3306 --name $container_name -v $container_datadir:/var/lib/mysql $image_name - set +x - sleep 6s - echo "* LOGS: $container_name" - docker logs $container_name - echo "* LISTING PORTS: $container_name BASED ON $image_name" - docker port $container_name - - echo "* LISTING VOLUMES: $container_name BASED ON $image_name" - docker inspect -f "{{ .Mounts }}" $container_name - - echo "* LISTING $container_datadir" - ls -ls $container_datadir - #break - docker logs $container_name | grep -q "ready for connections" -done < "$input" - -echo "* LISTING DOCKER IMAGES" -docker images - -echo "* LISTING DOCKER CONTAINER" -docker ps - +#!/bin/sh + +input="./build/configimg.conf" +default_password="secret" + +echo "[client] +user=root +password=$default_password" > $HOME/.my.cnf + +chmod 600 $HOME/.my.cnf + +[ -f "$input" ] || echo " +3306;mysql80;/var/lib/mysql8;mysql:8.0 +3307;mysql57;/var/lib/mysql57;mysql:5.7 +3308;mysql56;/var/lib/mysql56;mysql:5.6 +3309;mysql55;/var/lib/mysql55;mysql:5.5 + +4306;percona80;/var/lib/percona8;percona/percona-server:8.0 +4307;percona57;/var/lib/percona57;percona/percona-server:5.7 +4308;percona56;/var/lib/percona56;percona/percona-server:5.6 + +5306;mariadb104;/var/lib/mariadb104;mariadb:10.4 +5307;mariadb103;/var/lib/mariadb103;mariadb:10.3 +5308;mariadb102;/var/lib/mariadb102;mariadb:10.2 +5309;mariadb101;/var/lib/mariadb101;mariadb:10.1 +5310;mariadb100;/var/lib/mariadb100;mariadb:10.0 +5311;mariadb55;/var/lib/mariadb55;mariadb:5.5 +" > "$input" + +# + +#echo '* PRUNING DOCKER SYSTEM DATA' + +#[ "$1" = "clean" ] || docker system prune -a -f +# download all images +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) + + if [ -n "$1" -a "$1" != "clean" ]; then + echo $line | grep -q "$1" + [ $? -eq 0 ] || continue + fi + echo "* PULLING DOCKER IMAGE: $image_name" + docker images | grep -E " $image_name$" + [ $? -ne 0 ] && docker pull $image_name + + echo "* REMOVING CONTAINER : $image_name" + docker ps -a | grep -qE "$container_name^" + docker rm -f $container_name + + if [ 1 -eq 0 ]; then + echo "* DELETING DATADIR: $container_datadir" + sudo rm -rf $container_datadir + [ "$1" = "clean" ] && continue + + echo "* CREATING DATADIR: $container_datadir" + sudo mkdir -p $container_datadir + fi + #sudo chown -R mysql.mysql $container_datadir + sudo chmod 777 $container_datadir + echo "* STARTING CONTAINER: $container_name($container_port/TCP) BASED ON $image_name -> $container_datadir" + set -x + docker run -d -e MYSQL_ROOT_PASSWORD=$default_password -p $container_port:3306 --name $container_name -v $container_datadir:/var/lib/mysql $image_name + set +x + sleep 6s + echo "* LOGS: $container_name" + docker logs $container_name + echo "* LISTING PORTS: $container_name BASED ON $image_name" + docker port $container_name + + echo "* LISTING VOLUMES: $container_name BASED ON $image_name" + docker inspect -f "{{ .Mounts }}" $container_name + + echo "* LISTING $container_datadir" + ls -ls $container_datadir + #break + docker logs $container_name | grep -q "ready for connections" +done < "$input" + +echo "* LISTING DOCKER IMAGES" +docker images + +echo "* LISTING DOCKER CONTAINER" +docker ps + diff --git a/build/createTestEnvs.sh b/build/createTestEnvs.sh index e9addee..7c67392 100644 --- a/build/createTestEnvs.sh +++ b/build/createTestEnvs.sh @@ -1,28 +1,28 @@ -#!/bin/sh - -source build/bashrc - -systemctl status docker &>/dev/null -if [ $? -ne 0 ];then - sudo dnf install -y yum-utils device-mapper-persistent-data lvm2 - sudo dnf -y install dnf-plugins-core - sudo dnf config-manager \ - --add-repo \ - https://download.docker.com/linux/fedora/docker-ce.repo - - sudo dnf -y install docker-ce docker-ce-cli containerd.io - dnf list docker-ce --showduplicates | sort -r - - sudo systemctl start docker - sudo systemctl enable docker - sudo usermod -aG docker vagrant - sudo systemctl daemon-reload -fi - -sh build/createMassDockerImages.sh - -sh build/fetchSampleDatabases.sh clean -sh build/fetchSampleDatabases.sh fetchall - -exec_mysqls build/configimg.conf mysql contents/sakila-db/sakila-schema.sql +#!/bin/sh + +source build/bashrc + +systemctl status docker &>/dev/null +if [ $? -ne 0 ];then + sudo dnf install -y yum-utils device-mapper-persistent-data lvm2 + sudo dnf -y install dnf-plugins-core + sudo dnf config-manager \ + --add-repo \ + https://download.docker.com/linux/fedora/docker-ce.repo + + sudo dnf -y install docker-ce docker-ce-cli containerd.io + dnf list docker-ce --showduplicates | sort -r + + sudo systemctl start docker + sudo systemctl enable docker + sudo usermod -aG docker vagrant + sudo systemctl daemon-reload +fi + +sh build/createMassDockerImages.sh + +sh build/fetchSampleDatabases.sh clean +sh build/fetchSampleDatabases.sh fetchall + +exec_mysqls build/configimg.conf mysql contents/sakila-db/sakila-schema.sql exec_mysqls build/configimg.conf mysql contents/sakila-db/sakila-data.sql \ No newline at end of file diff --git a/build/deployOn b/build/deployOn index 29cff83..80b6039 100755 --- a/build/deployOn +++ b/build/deployOn @@ -1,12 +1,12 @@ -#!/bin/bash -set -xv - -_DIR=$(dirname `readlink -f $0`) - - -ssh $1 mkdir /images/mysqltuner -rsync -avz ${_DIR}/.. $1:/images/mysqltuner - -if [ "$2" = "run" ];then - ssh $1 "su - mysql -c 'cd /images/mysqltuner; source /opt/mysql/myqenv myserver1;perl mysqltuner.pl --verbose --color'" -fi +#!/bin/bash +set -xv + +_DIR=$(dirname `readlink -f $0`) + + +ssh $1 mkdir /images/mysqltuner +rsync -avz ${_DIR}/.. $1:/images/mysqltuner + +if [ "$2" = "run" ];then + ssh $1 "su - mysql -c 'cd /images/mysqltuner; source /opt/mysql/myqenv myserver1;perl mysqltuner.pl --verbose --color'" +fi diff --git a/build/fetchSampleDatabases.sh b/build/fetchSampleDatabases.sh index b580a1d..f0e02a4 100644 --- a/build/fetchSampleDatabases.sh +++ b/build/fetchSampleDatabases.sh @@ -1,35 +1,35 @@ -#!/bin/sh - - -DB_WORLD_URL="https://downloads.mysql.com/docs/world.sql.zip" -DB_WORLDX_URL="https://downloads.mysql.com/docs/world_x-db.zip" -DB_SAKILA_URL="https://downloads.mysql.com/docs/sakila-db.zip" -DB_MESSAGERIE_URL="https://downloads.mysql.com/docs/menagerie-db.zip" -DB_TESTDB_URL="https://github.com/datacharmer/test_db/archive/master.zip" - -getVal() -{ - local vari=$1 - eval "echo \$$vari" -} -case "$1" in - "fetchall") - for sample in WORLD WORLDX SAKILA MESSAGERIE TESTDB; do - sh $0 fetch $sample - done - ;; - "fetch") - [ -z "$2" ] && exit 1 - mkdir -p ./contents - [ -f "contents/$(basename $(getVal "DB_$2_URL"))" ] || wget -O contents/$(basename $(getVal "DB_$2_URL")) $(getVal "DB_$2_URL") - if [ $? -eq 0 ];then - (cd contents; unzip $( basename $(getVal "DB_$2_URL")) ) - fi - ;; - "clean") - rm -rf contents - ;; - *) - echo "Unknown operation: $1" - ;; +#!/bin/sh + + +DB_WORLD_URL="https://downloads.mysql.com/docs/world.sql.zip" +DB_WORLDX_URL="https://downloads.mysql.com/docs/world_x-db.zip" +DB_SAKILA_URL="https://downloads.mysql.com/docs/sakila-db.zip" +DB_MESSAGERIE_URL="https://downloads.mysql.com/docs/menagerie-db.zip" +DB_TESTDB_URL="https://github.com/datacharmer/test_db/archive/master.zip" + +getVal() +{ + local vari=$1 + eval "echo \$$vari" +} +case "$1" in + "fetchall") + for sample in WORLD WORLDX SAKILA MESSAGERIE TESTDB; do + sh $0 fetch $sample + done + ;; + "fetch") + [ -z "$2" ] && exit 1 + mkdir -p ./contents + [ -f "contents/$(basename $(getVal "DB_$2_URL"))" ] || wget -O contents/$(basename $(getVal "DB_$2_URL")) $(getVal "DB_$2_URL") + if [ $? -eq 0 ];then + (cd contents; unzip $( basename $(getVal "DB_$2_URL")) ) + fi + ;; + "clean") + rm -rf contents + ;; + *) + echo "Unknown operation: $1" + ;; esac \ No newline at end of file diff --git a/build/mysqltuner.spec.tpl b/build/mysqltuner.spec.tpl index e4cfcb8..c457b51 100644 --- a/build/mysqltuner.spec.tpl +++ b/build/mysqltuner.spec.tpl @@ -1,51 +1,51 @@ -Summary: High Performance MySQL Tuning Script -Name: mysqltuner -Version: %VERSION% -Release: 1 -License: GPL v3+ -Group: Applications -Source0: https://github.com/build/MySQLTuner-perl/build/%{name}-%{version}.tgz -URL: https://github.com/major/MySQLTuner-perl -Requires: mysql -BuildArch: noarch -BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) - -%description -MySQLTuner is a high-performance MySQL tuning script written in Perl -that will provide you with a snapshot of a MySQL server's health. -Based on the statistics gathered, specific recommendations will be -provided that will increase a MySQL server's efficiency and -performance. The script gives you automated MySQL tuning that is on -the level of what you would receive from a MySQL DBA. - -This script has been derived from many of the ideas in Matthew -Montgomery's MySQL tuning primer script. - -%prep -%setup -q - -%install -rm -rf $RPM_BUILD_ROOT -install -d $RPM_BUILD_ROOT%{_bindir} -install -d $RPM_BUILD_ROOT%{_datarootdir} -install -d $RPM_BUILD_ROOT/%{_mandir}/man1 -install -p %{name}.pl $RPM_BUILD_ROOT%{_bindir}/%{name} -install -d $RPM_BUILD_ROOT%{_datarootdir}/%{name} -install -p LICENSE $RPM_BUILD_ROOT%{_datarootdir}/%{name} -install -p basic_passwords.txt $RPM_BUILD_ROOT%{_datarootdir}/%{name} -install -p vulnerabilities.csv $RPM_BUILD_ROOT%{_datarootdir}/%{name} -install -p %{name}.1.gz $RPM_BUILD_ROOT/%{_mandir}/man1 - -%clean -rm -rf $RPM_BUILD_ROOT - -%files -%defattr(644,root,root,755) -%doc %{_datarootdir}/%{name} -%attr(755,root,root) %{_bindir}/%{name} -%{_mandir}/man1/* - -%changelog -* Thu Apr 14 2016 Jean-Marie RENOUARD %VERSION%-1 -- Initial RPM release - +Summary: High Performance MySQL Tuning Script +Name: mysqltuner +Version: %VERSION% +Release: 1 +License: GPL v3+ +Group: Applications +Source0: https://github.com/build/MySQLTuner-perl/build/%{name}-%{version}.tgz +URL: https://github.com/major/MySQLTuner-perl +Requires: mysql +BuildArch: noarch +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) + +%description +MySQLTuner is a high-performance MySQL tuning script written in Perl +that will provide you with a snapshot of a MySQL server's health. +Based on the statistics gathered, specific recommendations will be +provided that will increase a MySQL server's efficiency and +performance. The script gives you automated MySQL tuning that is on +the level of what you would receive from a MySQL DBA. + +This script has been derived from many of the ideas in Matthew +Montgomery's MySQL tuning primer script. + +%prep +%setup -q + +%install +rm -rf $RPM_BUILD_ROOT +install -d $RPM_BUILD_ROOT%{_bindir} +install -d $RPM_BUILD_ROOT%{_datarootdir} +install -d $RPM_BUILD_ROOT/%{_mandir}/man1 +install -p %{name}.pl $RPM_BUILD_ROOT%{_bindir}/%{name} +install -d $RPM_BUILD_ROOT%{_datarootdir}/%{name} +install -p LICENSE $RPM_BUILD_ROOT%{_datarootdir}/%{name} +install -p basic_passwords.txt $RPM_BUILD_ROOT%{_datarootdir}/%{name} +install -p vulnerabilities.csv $RPM_BUILD_ROOT%{_datarootdir}/%{name} +install -p %{name}.1.gz $RPM_BUILD_ROOT/%{_mandir}/man1 + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(644,root,root,755) +%doc %{_datarootdir}/%{name} +%attr(755,root,root) %{_bindir}/%{name} +%{_mandir}/man1/* + +%changelog +* Thu Apr 14 2016 Jean-Marie RENOUARD %VERSION%-1 +- Initial RPM release + diff --git a/build/runAudit.sh b/build/runAudit.sh index e6092e9..d74b94b 100644 --- a/build/runAudit.sh +++ b/build/runAudit.sh @@ -1,116 +1,116 @@ -#!/bin/bash - -server=$1 -_DIR=$(dirname `readlink -f $0`) - -#SSH_OPTIONS="-i utilities/id_rsa" - -SSH_OPTIONS="${SSH_OPTIONS:-""} - -export SSH_CLIENT="ssh -q $SSH_OPTIONS -o TCPKeepAlive=yes -o ServerAliveInterval=50 -o strictHostKeyChecking=no" -export SCP_CLIENT="scp -q $SSH_OPTIONS -o TCPKeepAlive=yes -o ServerAliveInterval=50 -o strictHostKeyChecking=no" - _DIR="$(dirname "`readlink -f $0`")" - -echo "* CLEANUP OLD RESULT FILES" -rm -f mysqltuner_${server}.txt pt-*_${server}.txt innotop_${server}.txt - -echo "* RUNNNING MYSQLTUNER" -$SSH_CLIENT root@${server} "mysqltuner --verbose --outputfile /tmp/mysqltuner_${server}.txt" -[ $? -ne 0 ] && exit 1 - -echo "* RUNNNING PERCONA SUMMARY" -$SSH_CLIENT root@${server} "pt-summary> /tmp/pt-summary_${server}.txt" -[ $? -ne 0 ] && exit 1 - -echo "* RUNNNING PERCONA MYSQL SUMMARY" -$SSH_CLIENT root@${server} "pt-mysql-summary> /tmp/pt-mysql-summary_${server}.txt" -[ $? -ne 0 ] && exit 1 - -echo "* RUNNNING INNOTOP" -$SSH_CLIENT root@${server} "innotop -C -d1 --count 5 -n>> /tmp/innotop_${server}.txt" -[ $? -ne 0 ] && exit 1 - -echo "* IMPORTING RESULT TXT" -$SCP_CLIENT root@${server}:/tmp/mysqltuner_${server}.txt . -$SCP_CLIENT root@${server}:/tmp/pt-*_${server}.txt . -$SCP_CLIENT root@${server}:/tmp/innotop_${server}.txt . -[ $? -ne 0 ] && exit 1 - -REPORT_NAME=audit.html -echo "* GENERATING HTML RESULT" -( -DATE="$(date)" -cat< - - - - - MySQL/MariaDB Audit report - $DATE - - - - - - - - - -

MySQL/MariaDB Audit report - $DATE

-
- -
-
-EOF
-) > ${REPORT_NAME}
-
-perl ${_DIR}/txt2Html.pl - mysqltuner_${server}.txt >> ${REPORT_NAME}
-
-(
-cat << 'EOF'
-
-
-
-EOF
-) >> ${REPORT_NAME}
-
-perl ${_DIR}/txt2Html.pl \# pt-summary_${server}.txt >> ${REPORT_NAME}
-(
-cat << 'EOF'
-
-
-
-EOF
-) >> ${REPORT_NAME}
-perl ${_DIR}/txt2Html.pl \# pt-mysql-summary_${server}.txt >> ${REPORT_NAME}
-
-(
-cat << 'EOF'
-
-
-
-EOF
-) >> ${REPORT_NAME}
-
-cat innotop_${server}.txt >> ${REPORT_NAME}
-(
-cat << 'EOF'
-
-
- - - - -EOF -) >> ${REPORT_NAME} -echo "* ALL IS OK" +#!/bin/bash + +server=$1 +_DIR=$(dirname `readlink -f $0`) + +#SSH_OPTIONS="-i utilities/id_rsa" + +SSH_OPTIONS="${SSH_OPTIONS:-""} + +export SSH_CLIENT="ssh -q $SSH_OPTIONS -o TCPKeepAlive=yes -o ServerAliveInterval=50 -o strictHostKeyChecking=no" +export SCP_CLIENT="scp -q $SSH_OPTIONS -o TCPKeepAlive=yes -o ServerAliveInterval=50 -o strictHostKeyChecking=no" + _DIR="$(dirname "`readlink -f $0`")" + +echo "* CLEANUP OLD RESULT FILES" +rm -f mysqltuner_${server}.txt pt-*_${server}.txt innotop_${server}.txt + +echo "* RUNNNING MYSQLTUNER" +$SSH_CLIENT root@${server} "mysqltuner --verbose --outputfile /tmp/mysqltuner_${server}.txt" +[ $? -ne 0 ] && exit 1 + +echo "* RUNNNING PERCONA SUMMARY" +$SSH_CLIENT root@${server} "pt-summary> /tmp/pt-summary_${server}.txt" +[ $? -ne 0 ] && exit 1 + +echo "* RUNNNING PERCONA MYSQL SUMMARY" +$SSH_CLIENT root@${server} "pt-mysql-summary> /tmp/pt-mysql-summary_${server}.txt" +[ $? -ne 0 ] && exit 1 + +echo "* RUNNNING INNOTOP" +$SSH_CLIENT root@${server} "innotop -C -d1 --count 5 -n>> /tmp/innotop_${server}.txt" +[ $? -ne 0 ] && exit 1 + +echo "* IMPORTING RESULT TXT" +$SCP_CLIENT root@${server}:/tmp/mysqltuner_${server}.txt . +$SCP_CLIENT root@${server}:/tmp/pt-*_${server}.txt . +$SCP_CLIENT root@${server}:/tmp/innotop_${server}.txt . +[ $? -ne 0 ] && exit 1 + +REPORT_NAME=audit.html +echo "* GENERATING HTML RESULT" +( +DATE="$(date)" +cat< + + + + + MySQL/MariaDB Audit report - $DATE + + + + + + + + + +

MySQL/MariaDB Audit report - $DATE

+
+ +
+
+EOF
+) > ${REPORT_NAME}
+
+perl ${_DIR}/txt2Html.pl - mysqltuner_${server}.txt >> ${REPORT_NAME}
+
+(
+cat << 'EOF'
+
+
+
+EOF
+) >> ${REPORT_NAME}
+
+perl ${_DIR}/txt2Html.pl \# pt-summary_${server}.txt >> ${REPORT_NAME}
+(
+cat << 'EOF'
+
+
+
+EOF
+) >> ${REPORT_NAME}
+perl ${_DIR}/txt2Html.pl \# pt-mysql-summary_${server}.txt >> ${REPORT_NAME}
+
+(
+cat << 'EOF'
+
+
+
+EOF
+) >> ${REPORT_NAME}
+
+cat innotop_${server}.txt >> ${REPORT_NAME}
+(
+cat << 'EOF'
+
+
+ + + + +EOF +) >> ${REPORT_NAME} +echo "* ALL IS OK" exit 0 \ No newline at end of file diff --git a/build/runMT.sh b/build/runMT.sh index d41fe7d..7e2798a 100644 --- a/build/runMT.sh +++ b/build/runMT.sh @@ -1,26 +1,26 @@ -#!/bin/sh - -input="./build/configimg.conf" - -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) - - if [ -n "$1" -a "$1" != "$container_name" ]; then - continue - fi - shift - sudo rm -f /var/lib/mysql - sudo ln -sf $container_datadir /var/lib/mysql - sudo chmod 777 /var/lib/mysql - - #sudo docker logs $container_name > /tmp/mysqld.log - ls -ls /var/lib | grep -E 'mysql$' - #set +x - perl mysqltuner.pl $* --host 127.0.0.1 --port $container_port - exit $? -done < "$input" +#!/bin/sh + +input="./build/configimg.conf" + +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) + + if [ -n "$1" -a "$1" != "$container_name" ]; then + continue + fi + shift + sudo rm -f /var/lib/mysql + sudo ln -sf $container_datadir /var/lib/mysql + sudo chmod 777 /var/lib/mysql + + #sudo docker logs $container_name > /tmp/mysqld.log + ls -ls /var/lib | grep -E 'mysql$' + #set +x + perl mysqltuner.pl $* --host 127.0.0.1 --port $container_port + exit $? +done < "$input" diff --git a/build/sync.sh b/build/sync.sh index 3330fb0..22f638a 100644 --- a/build/sync.sh +++ b/build/sync.sh @@ -1,17 +1,17 @@ -#!/bin/sh -# Used to sync the original project with local project. - -#Save existing working -git stash - -#add project url to current repository as upstream-live -git remote add upstream-live https://github.com/major/MySQLTuner-perl - -#Fetch updated code -git fetch upstream-live - -#Going back to the master branch for mearging latest code -git checkout master - -#Merge latest code with master branch. -git merge upstream-live/master +#!/bin/sh +# Used to sync the original project with local project. + +#Save existing working +git stash + +#add project url to current repository as upstream-live +git remote add upstream-live https://github.com/major/MySQLTuner-perl + +#Fetch updated code +git fetch upstream-live + +#Going back to the master branch for mearging latest code +git checkout master + +#Merge latest code with master branch. +git merge upstream-live/master diff --git a/build/updateStaff.sh b/build/updateStaff.sh index 4dd4761..d61e19b 100644 --- a/build/updateStaff.sh +++ b/build/updateStaff.sh @@ -1,15 +1,15 @@ -#!/bin/sh - -(cd .. -echo "* GENERATING USAGE FILE" -pod2markdown mysqltuner.pl >USAGE.md -echo "* TIDYFY SCRIPT" -perltidy -b mysqltuner.pl -) -echo "* Update CVE list" -perl updateCVElist.pl -dos2unix ../mysqltuner.pl -git add ../vulnerabilities.csv ../mysqltuner.pl ../USAGE.md -git commit -m 'Update Vulnerabilities list -Indenting mysqltuner -Update Usage information' +#!/bin/sh + +(cd .. +echo "* GENERATING USAGE FILE" +pod2markdown mysqltuner.pl >USAGE.md +echo "* TIDYFY SCRIPT" +perltidy -b mysqltuner.pl +) +echo "* Update CVE list" +perl updateCVElist.pl +dos2unix ../mysqltuner.pl +git add ../vulnerabilities.csv ../mysqltuner.pl ../USAGE.md +git commit -m 'Update Vulnerabilities list +Indenting mysqltuner +Update Usage information' diff --git a/mysqltuner.pl b/mysqltuner.pl index cd78b0d..9f53107 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -30,7 +30,7 @@ # Everett Barnes Tom Krouper Gary Barrueto # Simon Greenaway Adam Stein Isart Montane # Baptiste M. Cole Turner Major Hayden -# Joe Ashcraft JeSan-Marie Renouard Christian Loos +# Joe Ashcraft Jean-Marie Renouard Christian Loos # Julien Francoz Daniel Black # # Inspired by Matthew Montgomery's tuning-primer.sh script: