[root@amb01 ~]# wget http://mysqltuner.pl/ -O mysqltuner.pl --no-check-certificate [root@amb01 ~]# chmod a+x mysqltuner.pl [root@amb01 ~]# ./mysqltuner.pl --help Name: MySQLTuner 1.7.13 - MySQL High Performance Tuning Script Important Usage Guidelines: To run the script with the default options, run the script without arguments Allow MySQL server to run for at least 24-48 hours before trusting suggestions Some routines may require root level privileges (script will provide warnings) You must provide the remote server's total memory when connecting to other servers Connection and Authentication: --host <hostname> Connect to a remote host to perform tests (default: localhost) --socket <socket> Use a different socket for a local connection --port <port> Port to use for connection (default: 3306) --user <username> Username to use for authentication --userenv <envvar> Name of env variable which contains username to use for authentication --pass <password> Password to use for authentication --passenv <envvar> Name of env variable which contains password to use for authentication --ssl-ca <path> Path to public key --mysqladmin <path> Path to a custom mysqladmin executable --mysqlcmd <path> Path to a custom mysql executable --defaults-file <path> Path to a custom .my.cnf Performance and Reporting Options: --skipsize Don't enumerate tables and their types/sizes (default: on) (Recommended for servers with many tables) --skippassword Don't perform checks on user passwords(default: off) --checkversion Check for updates to MySQLTuner (default: don't check) --updateversion Check for updates to MySQLTuner and update when newer version is available (default: don't check) --forcemem <size> Amount of RAM installed in megabytes --forceswap <size> Amount of swap memory configured in megabytes --passwordfile <path> Path to a password file list(one password by line) Output Options: --silent Don't output anything on screen --nogood Remove OK responses --nobad Remove negative/suggestion responses --noinfo Remove informational responses --debug Print debug information --dbstat Print database information --tbstat Print table information --notbstat Don't Print table information --idxstat Print index information --sysstat Print system information --pfstat Print Performance schema --bannedports Ports banned separated by comma(,) --maxportallowed Number of ports opened allowed on this hosts --cvefile <path> CVE File for vulnerability checks --nocolor Don't print output in color --json Print result as JSON string --buffers Print global and per-thread buffer values --outputfile <path> Path to a output txt file --reportfile <path> Path to a report txt file --template <path> Path to a template file --verbose Prints out all options (default: no verbose) [root@amb01 ~]# ./mysqltuner.pl --user root --pass abcd.1234 --updateversion >> MySQLTuner 1.7.13 - Major Hayden <[email protected]> >> Bug reports, feature requests, and downloads at http://mysqltuner.com/ >> Run with '--help' for additional options and output filtering [OK] You have the latest version of MySQLTuner(1.7.13) [OK] Logged in using credentials passed on the command line [OK] Currently running supported MySQL version 5.6.41-log [OK] Operating on 64-bit architecture -------- Log file Recommendations ------------------------------------------------------------------ [--] Log file: /usr/local/mysql/data/mysql.err(43K) [OK] Log file /usr/local/mysql/data/mysql.err exists [OK] Log file /usr/local/mysql/data/mysql.err is readable. [OK] Log file /usr/local/mysql/data/mysql.err is not empty [OK] Log file /usr/local/mysql/data/mysql.err is smaller than 32 Mb [!!] /usr/local/mysql/data/mysql.err contains 34 warning(s). [!!] /usr/local/mysql/data/mysql.err contains 2 error(s). [--] 9 start(s) detected in /usr/local/mysql/data/mysql.err [--] 1) 2018-10-16 16:58:43 1507 [Note] /usr/local/mysql/bin/mysqld: ready for connections. [--] 2) 2018-10-10 14:22:39 14542 [Note] /usr/local/mysql/bin/mysqld: ready for connections. [--] 3) 2018-10-10 14:21:36 13813 [Note] /usr/local/mysql/bin/mysqld: ready for connections. [--] 4) 2018-10-10 13:43:42 12420 [Note] /usr/local/mysql/bin/mysqld: ready for connections. [--] 5) 2018-09-26 16:03:56 15882 [Note] /usr/local/mysql/bin/mysqld: ready for connections. [--] 6) 2018-09-20 17:34:44 14081 [Note] /usr/local/mysql/bin/mysqld: ready for connections. [--] 7) 2018-08-29 09:05:00 1836 [Note] /usr/local/mysql/bin/mysqld: ready for connections. [--] 8) 2018-08-28 11:57:11 23394 [Note] /usr/local/mysql/bin/mysqld: ready for connections. [--] 9) 2018-08-27 16:35:08 17811 [Note] /usr/local/mysql/bin/mysqld: ready for connections. [--] 5 shutdown(s) detected in /usr/local/mysql/data/mysql.err [--] 1) 2018-10-16 16:58:42 14542 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete [--] 2) 2018-10-10 14:22:38 13813 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete [--] 3) 2018-10-10 14:21:35 12420 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete [--] 4) 2018-10-10 13:43:40 15882 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete [--] 5) 2018-08-28 11:55:47 17811 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete -------- Storage Engine Statistics ----------------------------------------------------------------- [--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MEMORY +MRG_MYISAM +MyISAM +PERFORMANCE_SCHEMA [--] Data in InnoDB tables: 6.2G (Tables: 310) [OK] Total fragmented tables: 0 -------- Analysis Performance Metrics -------------------------------------------------------------- [--] innodb_stats_on_metadata: OFF [OK] No stat updates during querying INFORMATION_SCHEMA. -------- Security Recommendations ------------------------------------------------------------------ [OK] There are no anonymous accounts for any database users [OK] All database users have passwords assigned [!!] User '[email protected]' has user name as password. [!!] User 'icinga@localhost' has user name as password. [!!] User 'tpcc@%' has user name as password. [!!] User 'zabbix@%' has user name as password. [!!] User 'zabbix@localhost' has user name as password. [!!] User 'tpcc@%' does not specify hostname restrictions. [!!] User 'zabbix@%' does not specify hostname restrictions. [!!] There is no basic password file list! -------- CVE Security Recommendations -------------------------------------------------------------- [--] Skipped due to --cvefile option undefined -------- Performance Metrics ----------------------------------------------------------------------- [--] Up for: 8d 20h 12m 31s (20M q [26.518 qps], 16K conn, TX: 4G, RX: 4G) [--] Reads / Writes: 62% / 38% [--] Binary logging is enabled (GTID MODE: OFF) [--] Physical Memory : 3.7G [--] Max MySQL memory : 3.6G [--] Other process memory: 123.5M [--] Total buffers: 2.5G global + 4.2M per thread (151 max threads) [--] P_S Max memory usage: 466M [--] Galera GCache Max memory usage: 0B [OK] Maximum reached memory usage: 3.1G (83.72% of installed RAM) [!!] Maximum possible memory usage: 3.6G (96.36% of installed RAM) [OK] Overall possible memory usage with other process is compatible with memory available [OK] Slow queries: 0% (32K/20M) [OK] Highest usage of available connections: 24% (37/151) [OK] Aborted connections: 0.20% (32/16097) [!!] name resolution is active : a reverse name resolution is made for each new connection and can reduce performance [!!] Query cache may be disabled by default due to mutex contention. [!!] Query cache efficiency: 0.0% (0 cached / 12M selects) [OK] Query cache prunes per day: 0 [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 19K sorts) [OK] No joins without indexes [OK] Temporary tables created on disk: 2% (2K on disk / 96K total) [OK] Thread cache hit rate: 99% (85 created / 16K connections) [OK] Table cache hit rate: 90% (444 open / 491 opened) [OK] Open file limit used: 0% (50/65K) [OK] Table locks acquired immediately: 100% (19M immediate / 19M locks) [OK] Binlog cache memory access: 100.00% (719656 Memory / 719656 Total) -------- Performance schema ------------------------------------------------------------------------ [--] Memory used by P_S: 466.5M [--] Sys schema isn't installed. -------- ThreadPool Metrics ------------------------------------------------------------------------ [--] ThreadPool stat is disabled. -------- MyISAM Metrics ---------------------------------------------------------------------------- [!!] Key buffer used: 18.2% (48M used / 268M cache) [OK] Key buffer size / total MyISAM indexes: 256.0M/114.0K [OK] Read Key buffer hit rate: 99.9% (10K cached / 7 reads) [!!] Write Key buffer hit rate: 0.1% (3K cached / 3 writes) -------- InnoDB Metrics ---------------------------------------------------------------------------- [--] InnoDB is enabled. [--] InnoDB Thread Concurrency: 0 [OK] InnoDB File per table is activated [!!] InnoDB buffer pool / data size: 2.0G/6.2G [!!] Ratio InnoDB log file size / InnoDB Buffer pool size (75 %): 512.0M * 3/2.0G should be equal 25% [OK] InnoDB buffer pool instances: 2 [--] InnoDB Buffer Pool Chunk Size not used or defined in your version [OK] InnoDB Read buffer efficiency: 99.93% (254000864 hits/ 254168542 total) [OK] InnoDB Write log efficiency: 96.63% (13673818 hits/ 14150324 total) [OK] InnoDB log waits: 0.00% (0 waits / 476506 writes) -------- AriaDB Metrics ---------------------------------------------------------------------------- [--] AriaDB is disabled. -------- TokuDB Metrics ---------------------------------------------------------------------------- [--] TokuDB is disabled. -------- XtraDB Metrics ---------------------------------------------------------------------------- [--] XtraDB is disabled. -------- Galera Metrics ---------------------------------------------------------------------------- [--] Galera is disabled. -------- Replication Metrics ----------------------------------------------------------------------- [--] Galera Synchronous replication: NO [--] No replication slave(s) for this server. [--] Binlog format: ROW [--] XA support enabled: ON [--] Semi synchronous replication Master: Not Activated [--] Semi synchronous replication Slave: Not Activated [--] This is a standalone server -------- Recommendations --------------------------------------------------------------------------- General recommendations: Control warning line(s) into /usr/local/mysql/data/mysql.err file Control error line(s) into /usr/local/mysql/data/mysql.err file Set up a Secure Password for user@host ( SET PASSWORD FOR 'user'@'SpecificDNSorIp' = PASSWORD('secure_password'); ) Restrict Host for user@% to user@SpecificDNSorIp Reduce your overall MySQL memory footprint for system stability Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1 Consider installing Sys schema from https://github.com/mysql/mysql-sys Before changing innodb_log_file_size and/or innodb_log_files_in_group read this: http://bit.ly/2wgkDvS Variables to adjust: *** MySQL's maximum memory usage is dangerously high *** *** Add RAM before increasing MySQL buffer variables *** query_cache_size (=0) query_cache_type (=0) query_cache_limit (> 1M, or use smaller result sets) innodb_buffer_pool_size (>= 6.2G) if possible. innodb_log_file_size should be (=170M) if possible, so InnoDB total log files size equals to 25% of buffer pool size.
Mysql Database 性能监控工具:mysqltuner.pl
猜你喜欢
转载自blog.51cto.com/13598811/2308733
今日推荐
周排行