zoukankan      html  css  js  c++  java
  • MySQL日常巡检

    查看版本
    mysqladmin -uroot -p123456 version
    mysqladmin -uroot -p123456 version|sed -n '/Server/,/Uptime/p'
    查看目录basedir 和 datadir,端口
    ps -ef |grep mysqld 
    检查MySQL数据库连接(包括打开的连接数、中止的连接数及中止的客户端数)
    show status;
    Aborted_clients 由于客户没有正确关闭连接已经死掉,已经放弃的连接数量。
    Aborted_connects 尝试已经失败的MySQL服务器的连接的次数。
    Threads_connected 当前打开的连接的数量。
    Max_used_connections 同时使用的连接的最大数目,以 Max_used_connections 远小于my.cnf中的最大连接数目则正常。如果接近则考虑增大最大数目。
    检查MySQL数据库线程明细(包括使用线程数、缓冲内线程数及线程缓冲大小)
    show [full] processlist
    show status like 'Threads%';
    Threads_cached
    Threads_connected
    Threads_created
    Threads_running
    查看my.cnf中的sort_buffer_size
    检查MySQL数据库明细(包括数据库名及数据库大小)
    show databases;
    show table status from 数据库名;
    检查MySQL数据库表锁统计(包括立即锁及等待锁)
    show status like 'key_read%';
    检查 Key_read_requests和Key_reads,
    key_reads / key_read_requests应该尽可能的低,至少是1:100,最好是1:1000
    查看对应的my.cnf文件中key_buffer_size
    检查MySQL数据库请求缓存命中(包括请求缓存命中、请求缓存大小及请求缓存限制)
    show status like 'Qcache%';
    检查Qcache_lowmem_prune,
    Qcache_hits,
    Qcache_total_blocks
    Qcache_free_blocks
    Qcache_lowmem_prunes的值非常大,则表明经常出现缓冲不够的情况,如果Qcache_hits的值也非常大,则表明查询缓冲使用非常频繁,此时需要增加缓冲大小;如果Qcache_hits的值不大,则表明你的查询重复率很低,这种情况下使用查询缓冲反而会影响效率,那么可以考虑不用查询缓冲。Qcache_free_blocks,如果该值非常大,则表明缓冲区中碎片很多,这就表明查询结果都比较小,此时需要减小query_cache_min_res_unit。
    临时表
    show status like '%tmp%';
    Created_tmp_disk_tables
    Created_tmp_files
    Created_tmp_tables
    Created_tmp_disk_tables 服务器执行语句时在硬盘上自动创建的临时表的数量(如果这个数值较大,要相应增加tmp_table_size值使临时表基于内存,尽量减少在磁盘的操作 最好Created_tmp_disk_tables / Created_tmp_tables * 100% <= 25%
    备份情况检查
    检查是否有备份机制,以有备份机制,且最后一个备份成功为正常
     
  • 相关阅读:
    idea中,引用不到项目中的类
    java代码中获取spring容器
    SpringBoot--ApplicationRunner接口
    二、Kafka 快速入门-linux命令行操作
    iOS
    文本输入框默认弹出中文的复制粘贴
    AppleId
    WeChat
    Universal Links在Swift上的应用
    协程的原理以及与线程的区别
  • 原文地址:https://www.cnblogs.com/williamwan/p/10388708.html
Copyright © 2011-2022 走看看