Mariadb MySQL Tuner 报告令人困惑

use*_*791 7 mysql innodb mariadb optimization mysqltuner

我想请您澄清 mysqltuner 关于 MariaDB 数据库的报告。mysqltuner 是用 --nogood 标志调用的!

 >>  MySQLTuner 1.7.1 - Major Hayden <major@mhtx.net>
 >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 >>  Run with '--help' for additional options and output filtering

[--] Skipped version check for MySQLTuner script
[!!] Currently running unsupported MySQL version 10.0.29-MariaDB-0ubuntu0.16.04.1

-------- Log file Recommendations ------------------------------------------------------------------
[--] Log file: (0B)
[!!] Log file  doesn't exist
[!!] Log file  isn't readable.

-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +ARCHIVE +Aria +BLACKHOLE +CSV +FEDERATED +InnoDB +MEMORY +MRG_MyISAM +MyISAM +PERFORMANCE_SCHEMA 
[--] Data in InnoDB tables: 380M (Tables: 417)

-------- Security Recommendations ------------------------------------------------------------------
[--] There are 605 basic passwords in the list.

-------- CVE Security Recommendations --------------------------------------------------------------
[--] Skipped due to --cvefile option undefined

-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 15s (812 q [54.133 qps], 275 conn, TX: 258K, RX: 108K)
[--] Reads / Writes: 100% / 0%
[--] Binary logging is disabled
[--] Physical Memory     : 31.3G
[--] Max MySQL memory    : 10.0G
[--] Other process memory: 1.2G
[--] Total buffers: 8.4G global + 10.7M per thread (150 max threads)
[--] P_S Max memory usage: 34M
[--] Galera GCache Max memory usage: 0B
[!!] Slow queries: 27% (221/812)
[!!] Query cache may be disabled by default due to mutex contention.
[!!] Query cache efficiency: 0.0% (0 cached / 521 selects)

-------- Performance schema ------------------------------------------------------------------------
[--] Memory used by P_S: 35.0M
[--] Sys schema isn't installed.

-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is enabled.
[--] Thread Pool Size: 8 thread(s).
[--] Using default value is good enough for your version (10.0.29-MariaDB-0ubuntu0.16.04.1)

-------- MyISAM Metrics ----------------------------------------------------------------------------
[!!] Key buffer used: 18.2% (24M used / 134M cache)
[!!] Read Key buffer hit rate: 80.0% (10 cached / 2 reads)

-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[!!] Ratio InnoDB log file size / InnoDB Buffer pool size (12.5 %): 512.0M * 2/8.0G should be equal 25%
[--] InnoDB Buffer Pool Chunk Size not used or defined in your version
[!!] InnoDB Write Log efficiency: 0% (2 hits/ 0 total)

-------- AriaDB Metrics ----------------------------------------------------------------------------
[--] AriaDB is enabled.

-------- TokuDB Metrics ----------------------------------------------------------------------------
[--] TokuDB is disabled.

-------- XtraDB Metrics ----------------------------------------------------------------------------
[--] XtraDB is disabled.

-------- RocksDB Metrics ---------------------------------------------------------------------------
[--] RocksDB is disabled.

-------- Spider Metrics ----------------------------------------------------------------------------
[--] Spider is disabled.

-------- Connect Metrics ---------------------------------------------------------------------------
[--] Connect is disabled.

-------- Galera Metrics ----------------------------------------------------------------------------
[--] Galera is disabled.

-------- Replication Metrics -----------------------------------------------------------------------
[--] Galera Synchronous replication: NO
[--] No replication slave(s) for this server.
[--] This is a standalone server.

-------- Recommendations ---------------------------------------------------------------------------
General recommendations:
    MySQL started within last 24 hours - recommendations may be inaccurate
    Consider installing Sys schema from https://github.com/mysql/mysql-sys
Variables to adjust:
    query_cache_type (=0)
    query_cache_limit (> 256K, or use smaller result sets)
    innodb_log_file_size * innodb_log_files_in_group should be equals to 1/4 of buffer pool size (=4G) if possible.
Run Code Online (Sandbox Code Playgroud)

让我感到困惑的是“日志文件建议”部分。我真的不知道该怎么办。然后还有这一行:

[!!] Query cache may be disabled by default due to mutex contention.
Run Code Online (Sandbox Code Playgroud)

我也很好奇为什么它会建议我将 query_cache_type 更改为 0 并增加 query_cache_limit?

我知道它至少已经运行了 24 小时,那是因为我已经调整了配置并重新启动了我的数据库。我根据我对 MariaDB 的了解做了一些调整,但对这几件事我感到困惑。

Rol*_*DBA 7

我可以解释这一行

[!!] Query cache may be disabled by default due to mutex contention.
Run Code Online (Sandbox Code Playgroud)

InnoDB 存储引擎和查询缓存一直处于战争状态(请参阅我 1.5 年前的帖子为什么从 MySQL 5.6 开始默认禁用 query_cache_type?

mysqltuner被建议设置query_cache_type的为0,因此您明确禁用查询缓存。请不要忘记将query_cache_size也设置为 0。否则,互斥行为无论如何都会被动发生。

正如我在我的旧帖子 中所说,如果您合理地知道最常见结果集的大小,则不必禁用查询缓存。如果你能算出这个大小,那么你可以将query_cache_limitquery_cache_min_res_unit作为结果集大小的上限和下限。只有这样,您才能将query_cache_type设置为 1。

至于您的日志文件建议

[--] Log file: (0B)
[!!] Log file  doesn't exist
[!!] Log file  isn't readable.
Run Code Online (Sandbox Code Playgroud)

也许这可以解释它

[!!] Currently running unsupported MySQL version 10.0.29-MariaDB-0ubuntu0.16.04.1
Run Code Online (Sandbox Code Playgroud)

mysqltuner 可能无法与此版本的 MariaDB 中的日志文件相关联,就像与支持的版本一样。