[{"data":1,"prerenderedAt":333},["ShallowReactive",2],{"site-data":3,"article-95":143,"article-show-hot-95":167,"article-show-new-95":257},{"settings":4,"categorys":35,"tree":97,"models":118,"search_model_select":128,"nav_list":130},{"changefreq":5,"changyan_app_id":6,"changyan_app_key":6,"copy":7,"description":8,"editor":9,"file":6,"guest_feedback":10,"head_html":6,"icp":11,"index_banner":12,"index_banner_bg":13,"is_excel":14,"is_watermark":10,"keywords":15,"links":16,"logo":17,"lzcms_banner":6,"lzcms_banner_link":18,"member_register_enabled":14,"qq_app_id":6,"qq_app_key":6,"qr_code":6,"search_model":19,"site_closedreason":6,"site_idea":6,"site_idea1":20,"site_idea2":21,"site_idea3":22,"site_name":23,"site_statistice":6,"site_status":14,"site_url":18,"sitemap_model":19,"stationmaster_motto":24,"stationmaster_name":25,"stationmaster_occupation":26,"stationmaster_qq":27,"stationmaster_qqnet":28,"stationmaster_qqnet_code":29,"threshold":14,"title_add":30,"watermark":6,"watermark_alpha":31,"watermark_height":32,"watermark_locate":33,"watermark_width":34},"weekly","","版权所有 © \u003Ca class=\"site_url\" href=\"https://zhl123.com\">2026 zhl123.com\u003C/a>","linux、Python、mysql、docker、k8s技术交流","layedit","0","粤ICP备15054664号-1","/uploads/images/20181109/7a86191de8b8bb60e9c6b54d8b27c5cc.jpg","#xe604","1","linux、Python、mysql、docker、k8s","{\"1\":{\"id\":\"1\",\"link_url\":\"https://linux.org\",\"logo\":\"\",\"name\":\"linux\",\"sort\":\"0\",\"status\":\"1\"}}","/uploads/images/20181109/e7305012448aed257176dd591846f50a.png","https://zhl123.com","2","学无止境\n学习，探索，研究，从不了解到了解，从无知到掌握，到灵活运用，在不断的学习中加深认识。由浅入深，由表及里。","业精于勤\n“业精于勤荒于嬉”，精深的业技靠的是勤学、刻苦努力，靠的是争分夺秒的勤学苦练才会有精深的技术。得在认真，失在随便。","工匠精神\n精益求精，注重细节，追求完美和极致，不惜花费时间精力，孜孜不倦，反复改进产品，把99%提高到99.99%。","linux","业精于勤、学无止境、工匠精神","廖地金","高级Linux运维工程师","1256636645","592958303","\u003Ca target=\"_blank\" href=\"//shang.qq.com/wpa/qunwpa?idkey=09be7d1a682073783fd636102e666393169b8a8aac8f3393da1de57bcaa821a0\">\u003Cimg border=\"0\" src=\"//pub.idqqimg.com/wpa/images/group.png\" alt=\"Linux技术\" title=\"Linux技术\">\u003C/a>"," | Python | mysql | docker | k8s 技术交流","100","300","9","500",{"0":36,"17":51,"18":60,"19":63,"20":67,"21":71,"22":76,"25":80,"26":83,"27":89,"29":94},{"children":37},{"0":38,"25":43,"26":48},[39,40,41,42],25,21,22,26,[44,45,46,47],17,18,19,20,[49,50],27,29,{"create_time":6,"description":6,"id":44,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":23,"parent_id":39,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":53,"subtitle":6,"update_time":6,"url":59},"index",1,"list","article",2,"文章模型","show","/article/lists?category_id=17",{"create_time":6,"description":6,"id":45,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":61,"parent_id":39,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":56,"subtitle":6,"update_time":6,"url":62},"python","/article/lists?category_id=18",{"create_time":6,"description":6,"id":46,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":64,"parent_id":39,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":65,"subtitle":6,"update_time":6,"url":66},"容器技术",3,"/article/lists?category_id=19",{"create_time":6,"description":6,"id":47,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":68,"parent_id":39,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":69,"subtitle":6,"update_time":6,"url":70},"负载均衡",4,"/article/lists?category_id=20",{"create_time":6,"description":6,"id":40,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":72,"parent_id":73,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":74,"subtitle":6,"update_time":6,"url":75},"分享无价",0,5,"/article/lists?category_id=21",{"create_time":6,"description":6,"id":41,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":77,"parent_id":73,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":78,"subtitle":6,"update_time":6,"url":79},"随笔",6,"/article/lists?category_id=22",{"create_time":6,"description":6,"id":39,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":81,"parent_id":73,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":73,"subtitle":6,"update_time":6,"url":82},"学无止境","/article/lists?category_id=25",{"create_time":6,"description":6,"id":42,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":84,"model_id":65,"model_name":85,"name":86,"parent_id":73,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":87,"subtitle":6,"update_time":6,"url":88},"picture","图集模型","关于",8,"/picture/lists?category_id=26",{"create_time":6,"description":6,"id":49,"image_url":6,"index_template":52,"is_cover":53,"is_menu":73,"keywords":6,"list_template":54,"model_code":90,"model_id":53,"model_name":91,"name":92,"parent_id":42,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":47,"subtitle":6,"update_time":6,"url":93},"page","单页模型","关于博主","/page/27",{"create_time":6,"description":6,"id":50,"image_url":6,"index_template":52,"is_cover":73,"is_menu":73,"keywords":6,"list_template":54,"model_id":73,"name":95,"parent_id":42,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":47,"subtitle":6,"update_time":6,"url":96},"留言","/feedback",[98,108,110,112],{"children":99,"create_time":6,"description":6,"id":39,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":81,"parent_id":73,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":73,"subtitle":6,"update_time":6,"url":82},[100,102,104,106],{"children":101,"create_time":6,"description":6,"id":44,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":23,"parent_id":39,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":53,"subtitle":6,"update_time":6,"url":59},[],{"children":103,"create_time":6,"description":6,"id":45,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":61,"parent_id":39,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":56,"subtitle":6,"update_time":6,"url":62},[],{"children":105,"create_time":6,"description":6,"id":46,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":64,"parent_id":39,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":65,"subtitle":6,"update_time":6,"url":66},[],{"children":107,"create_time":6,"description":6,"id":47,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":68,"parent_id":39,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":69,"subtitle":6,"update_time":6,"url":70},[],{"children":109,"create_time":6,"description":6,"id":40,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":72,"parent_id":73,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":74,"subtitle":6,"update_time":6,"url":75},[],{"children":111,"create_time":6,"description":6,"id":41,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":77,"parent_id":73,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":78,"subtitle":6,"update_time":6,"url":79},[],{"children":113,"create_time":6,"description":6,"id":42,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":84,"model_id":65,"model_name":85,"name":86,"parent_id":73,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":87,"subtitle":6,"update_time":6,"url":88},[114,116],{"children":115,"create_time":6,"description":6,"id":49,"image_url":6,"index_template":52,"is_cover":53,"is_menu":73,"keywords":6,"list_template":54,"model_code":90,"model_id":53,"model_name":91,"name":92,"parent_id":42,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":47,"subtitle":6,"update_time":6,"url":93},[],{"children":117,"create_time":6,"description":6,"id":50,"image_url":6,"index_template":52,"is_cover":73,"is_menu":73,"keywords":6,"list_template":54,"model_id":73,"name":95,"parent_id":42,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":47,"subtitle":6,"update_time":6,"url":96},[],{"1":119,"2":120,"3":121,"4":122,"5":125},{"id":53,"index_template":52,"list_template":54,"name":91,"show_template":58,"status":73,"tablename":90},{"id":56,"index_template":52,"list_template":54,"name":57,"show_template":58,"status":73,"tablename":55},{"id":65,"index_template":52,"list_template":54,"name":85,"show_template":58,"status":73,"tablename":84},{"id":69,"index_template":52,"list_template":54,"name":123,"show_template":58,"status":73,"tablename":124},"链接模型","link",{"id":74,"index_template":52,"list_template":54,"name":126,"show_template":58,"status":73,"tablename":127},"下载模型","download",[129],{"id":56,"name":57,"tablename":55},[131,137,139,141],{"children":132,"create_time":6,"description":6,"id":39,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":81,"parent_id":73,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":73,"subtitle":6,"update_time":6,"url":82},[133,134,135,136],{"create_time":6,"description":6,"id":44,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":23,"parent_id":39,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":53,"subtitle":6,"update_time":6,"url":59},{"create_time":6,"description":6,"id":45,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":61,"parent_id":39,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":56,"subtitle":6,"update_time":6,"url":62},{"create_time":6,"description":6,"id":46,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":64,"parent_id":39,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":65,"subtitle":6,"update_time":6,"url":66},{"create_time":6,"description":6,"id":47,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":68,"parent_id":39,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":69,"subtitle":6,"update_time":6,"url":70},{"children":138,"create_time":6,"description":6,"id":40,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":72,"parent_id":73,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":74,"subtitle":6,"update_time":6,"url":75},[],{"children":140,"create_time":6,"description":6,"id":41,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":77,"parent_id":73,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":78,"subtitle":6,"update_time":6,"url":79},[],{"children":142,"create_time":6,"description":6,"id":42,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":84,"model_id":65,"model_name":85,"name":86,"parent_id":73,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":87,"subtitle":6,"update_time":6,"url":88},[],{"article":144,"breadcrumb":155,"category":158,"next":159,"prev":162,"second_categorys":165,"seo":166},{"id":145,"category_id":40,"title":146,"keywords":147,"description":148,"image_url":6,"content":149,"content_md":150,"url":151,"hits":152,"is_recommend":73,"is_top":73,"create_time":153,"update_time":154},95,"MySQL高性能优化实战总结","MYSQL，MYSQL优化技巧","MySQL 对于很多 Linux 从业者而言，是一个非常棘手的问题，多数情况都是因为对数据库出现问题的情况和处理思路不清晰。在进行 MySQL 的优化之前必须要了解的就是 MySQL 的查询过程，很多的查询优化工作实际上就是遵循一些原则让 MySQL 的优化器能够按照预想的合理方式运行而已。优化的哲学注：优化有风险，修改需谨慎。优化可能带来的问题：优化不总是对一个单纯的环境进行，还很可能是一个复杂的已投产的系统。优化手段本来就有很大的风险，只不过你没能力意识到和预见到。任何的技术可以解决一个问题","\u003Cp style=\"text-align: justify;\">MySQL 对于很多 Linux 从业者而言，是一个非常棘手的问题，多数情况都是因为对数据库出现问题的情况和处理思路不清晰。\u003C/p>\u003Cp style=\"text-align: justify;\">在进行 MySQL 的优化之前必须要了解的就是 MySQL 的查询过程，很多的查询优化工作实际上就是遵循一些原则让 MySQL 的优化器能够按照预想的合理方式运行而已。\u003C/p>\u003Cp style=\"text-align: justify;\">\u003Cimg src=\"/uploads/layedit/20190123/a0a6c0c50646986cbe521e5d06253e04.jpg\" alt=\"mysql.jpg\">\u003Cbr>\u003C/p>\u003Ch2 style=\"text-align: justify;\">优化的哲学\u003C/h2>\u003Cp style=\"text-align: justify;\">注：优化有风险，修改需谨慎。\u003C/p>\u003Cp style=\"text-align: justify;\">优化可能带来的问题：\u003C/p>\u003Cul class=\"list-paddingleft-2\" style=\"text-align: justify;\">\u003Cli>\u003Cp>优化不总是对一个单纯的环境进行，还很可能是一个复杂的已投产的系统。\u003C/p>\u003C/li>\u003Cli>\u003Cp>优化手段本来就有很大的风险，只不过你没能力意识到和预见到。\u003C/p>\u003C/li>\u003Cli>\u003Cp>任何的技术可以解决一个问题，但必然存在带来一个问题的风险。\u003C/p>\u003C/li>\u003Cli>\u003Cp>对于优化来说解决问题而带来的问题，控制在可接受的范围内才是有成果。\u003C/p>\u003C/li>\u003Cli>\u003Cp>保持现状或出现更差的情况都是失败。\u003C/p>\u003C/li>\u003C/ul>\u003Cp style=\"text-align: justify;\">优化的需求：\u003C/p>\u003Cul class=\"list-paddingleft-2\" style=\"text-align: justify;\">\u003Cli>\u003Cp>稳定性和业务可持续性，通常比性能更重要。\u003C/p>\u003C/li>\u003Cli>\u003Cp>优化不可避免涉及到变更，变更就有风险。\u003C/p>\u003C/li>\u003Cli>\u003Cp>优化使性能变好，维持和变差是等概率事件。\u003C/p>\u003C/li>\u003Cli>\u003Cp>切记优化，应该是各部门协同，共同参与的工作，任何单一部门都不能对数据库进行优化。\u003C/p>\u003C/li>\u003C/ul>\u003Cp style=\"text-align: justify;\">\u003Cspan>所以优化工作，是由业务需求驱使的！\u003C/span>\u003Cbr>\u003C/p>\u003Cp style=\"text-align: justify;\">优化由谁参与？在进行数据库优化时，应由数据库管理员、业务部门代表、应用程序架构师、应用程序设计人员、应用程序开发人员、硬件及系统管理员、存储管理员等，业务相关人员共同参与。\u003C/p>\u003Ch2 style=\"text-align: justify;\">优化思路\u003C/h2>\u003Ch3 style=\"text-align: justify;\">优化什么\u003C/h3>\u003Cp style=\"text-align: justify;\">在数据库优化上有两个主要方面：\u003C/p>\u003Cul class=\"list-paddingleft-2\" style=\"text-align: justify;\">\u003Cli>\u003Cp>安全：数据可持续性。\u003C/p>\u003C/li>\u003Cli>\u003Cp>性能：数据的高性能访问。\u003C/p>\u003C/li>\u003C/ul>\u003Ch3 style=\"text-align: justify;\">优化的范围有哪些\u003C/h3>\u003Cp style=\"text-align: justify;\">存储、主机和操作系统方面：\u003C/p>\u003Cul class=\"list-paddingleft-2\" style=\"text-align: justify;\">\u003Cli>\u003Cp>主机架构稳定性\u003C/p>\u003C/li>\u003Cli>\u003Cp>I/O 规划及配置\u003C/p>\u003C/li>\u003Cli>\u003Cp>Swap 交换分区\u003C/p>\u003C/li>\u003Cli>\u003Cp>OS 内核参数和网络问题\u003C/p>\u003C/li>\u003C/ul>\u003Cp style=\"text-align: justify;\">应用程序方面：\u003C/p>\u003Cul class=\"list-paddingleft-2\" style=\"text-align: justify;\">\u003Cli>\u003Cp>应用程序稳定性\u003C/p>\u003C/li>\u003Cli>\u003Cp>SQL 语句性能\u003C/p>\u003C/li>\u003Cli>\u003Cp>串行访问资源\u003C/p>\u003C/li>\u003Cli>\u003Cp>性能欠佳会话管理\u003C/p>\u003C/li>\u003Cli>\u003Cp>这个应用适不适合用 MySQL\u003C/p>\u003C/li>\u003C/ul>\u003Cp style=\"text-align: justify;\">数据库优化方面：\u003C/p>\u003Cul class=\"list-paddingleft-2\" style=\"text-align: justify;\">\u003Cli>\u003Cp>内存\u003C/p>\u003C/li>\u003Cli>\u003Cp>数据库结构（物理&amp;逻辑）\u003C/p>\u003C/li>\u003Cli>\u003Cp>实例配置\u003C/p>\u003C/li>\u003C/ul>\u003Cp style=\"text-align: justify;\">说明：不管是设计系统、定位问题还是优化，都可以按照这个顺序执行。\u003C/p>\u003Ch3 style=\"text-align: justify;\">优化维度\u003C/h3>\u003Cp>\u003Cimg src=\"/uploads/layedit/20190123/e4cffb68fc4567e5c58c6c75c7c1af77.jpg\" alt=\"mysql-2.jpg\">\u003C/p>\u003Cp style=\"text-align: justify;\">数据库优化维度有如下四个：\u003C/p>\u003Cul class=\"list-paddingleft-2\" style=\"text-align: justify;\">\u003Cli>\u003Cp>硬件\u003C/p>\u003C/li>\u003Cli>\u003Cp>系统配置\u003C/p>\u003C/li>\u003Cli>\u003Cp>数据库表结构\u003C/p>\u003C/li>\u003Cli>\u003Cp>SQL 及索引\u003C/p>\u003C/li>\u003C/ul>\u003Cp style=\"text-align: justify;\">优化选择：\u003C/p>\u003Cul class=\"list-paddingleft-2\" style=\"text-align: justify;\">\u003Cli>\u003Cp>优化成本：硬件&gt;系统配置&gt;数据库表结构&gt;SQL 及索引。\u003C/p>\u003C/li>\u003Cli>\u003Cp>优化效果：硬件&lt;系统配置&lt;数据库表结构&lt;SQL 及索引。\u003C/p>\u003C/li>\u003C/ul>\u003Ch2 style=\"text-align: justify;\">优化工具有啥\u003C/h2>\u003Ch3 style=\"text-align: justify;\">数据库层面\u003C/h3>\u003Cp style=\"text-align: justify;\">检查问题常用的 12 个工具：\u003C/p>\u003Cul class=\"list-paddingleft-2\" style=\"text-align: justify;\">\u003Cli>\u003Cp>MySQL\u003C/p>\u003C/li>\u003Cli>\u003Cp>mysqladmin：MySQL 客户端，可进行管理操作\u003C/p>\u003C/li>\u003Cli>\u003Cp>mysqlshow：功能强大的查看 shell 命令\u003C/p>\u003C/li>\u003Cli>\u003Cp>SHOW [SESSION | GLOBAL] variables：查看数据库参数信息\u003C/p>\u003C/li>\u003Cli>\u003Cp>SHOW [SESSION | GLOBAL] STATUS：查看数据库的状态信息\u003C/p>\u003C/li>\u003Cli>\u003Cp>information_schema：获取元数据的方法\u003C/p>\u003C/li>\u003Cli>\u003Cp>SHOW ENGINE INNODB STATUS：Innodb 引擎的所有状态\u003C/p>\u003C/li>\u003Cli>\u003Cp>SHOW PROCESSLIST：查看当前所有连接的 session 状态\u003C/p>\u003C/li>\u003Cli>\u003Cp>explain：获取查询语句的执行计划\u003C/p>\u003C/li>\u003Cli>\u003Cp>show index：查看表的索引信息\u003C/p>\u003C/li>\u003Cli>\u003Cp>slow-log：记录慢查询语句\u003C/p>\u003C/li>\u003Cli>\u003Cp>mysqldumpslow：分析 slowlog 文件的工具\u003C/p>\u003C/li>\u003C/ul>\u003Cp style=\"text-align: justify;\">不常用但好用的 7 个工具：\u003C/p>\u003Cul class=\"list-paddingleft-2\" style=\"text-align: justify;\">\u003Cli>\u003Cp>Zabbix：监控主机、系统、数据库（部署 Zabbix 监控平台）\u003C/p>\u003C/li>\u003Cli>\u003Cp>pt-query-digest：分析慢日志\u003C/p>\u003C/li>\u003Cli>\u003Cp>MySQL slap：分析慢日志\u003C/p>\u003C/li>\u003Cli>\u003Cp>sysbench：压力测试工具\u003C/p>\u003C/li>\u003Cli>\u003Cp>MySQL profiling：统计数据库整体状态工具\u003C/p>\u003C/li>\u003Cli>\u003Cp>Performance Schema：MySQL 性能状态统计的数据\u003C/p>\u003C/li>\u003Cli>\u003Cp>workbench：管理、备份、监控、分析、优化工具（比较费资源）\u003C/p>\u003C/li>\u003C/ul>\u003Ch3 style=\"text-align: justify;\">数据库层面问题解决思路\u003C/h3>\u003Cp style=\"text-align: justify;\">一般应急调优的思路：针对突然的业务办理卡顿，无法进行正常的业务处理，需要马上解决的场景。\u003C/p>\u003Cpre style=\"text-align: justify;\">\u003Cp>show processlist\n2、explain &nbsp;select id ,name from stu where name='clsn'; # ALL &nbsp;id name age &nbsp;sex\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;select id,name from stu &nbsp;where id=2-1 函数 结果集&gt;30;\n　　　 show index from table;\n3、通过执行计划判断，索引问题（有没有、合不合理）或者语句本身问题\n4、show status &nbsp;like '%lock%'; &nbsp; &nbsp;# 查询锁状态\n　　kill SESSION_ID; &nbsp; # 杀掉有问题的session\u003C/p>\u003C/pre>\u003Cp style=\"text-align: justify;\">常规调优思路：针对业务周期性的卡顿，例如在每天 10-11 点业务特别慢，但是还能够使用，过了这段时间就好了。\u003C/p>\u003Cpre style=\"text-align: justify;\">\u003Cp>1）查看slowlog，分析slowlog，分析出查询慢的语句；\n2）按照一定优先级，一个一个排查所有慢语句；\n3）分析top SQL，进行explain调试，查看语句执行时间；\n4）调整索引或语句本身。\u003C/p>\u003C/pre>\u003Ch3 style=\"text-align: justify;\">系统层面\u003C/h3>\u003Cp style=\"text-align: justify;\">CPU方面：vmstat、sar top、htop、nmon、mpstat。\u003C/p>\u003Cp style=\"text-align: justify;\">内存：free、ps-aux。\u003C/p>\u003Cp style=\"text-align: justify;\">IO 设备（磁盘、网络）：iostat、ss、netstat、iptraf、iftop、lsof。\u003C/p>\u003Cp style=\"text-align: justify;\">vmstat 命令说明：\u003C/p>\u003Cul class=\"list-paddingleft-2\" style=\"text-align: justify;\">\u003Cli>\u003Cp>Procs：r 显示有多少进程正在等待 CPU 时间。b 显示处于不可中断的休眠的进程数量。在等待 I/O。\u003C/p>\u003C/li>\u003Cli>\u003Cp>Memory：swpd 显示被交换到磁盘的数据块的数量。未被使用的数据块，用户缓冲数据块，用于操作系统的数据块的数量。\u003C/p>\u003C/li>\u003Cli>\u003Cp>Swap：操作系统每秒从磁盘上交换到内存和从内存交换到磁盘的数据块的数量。s1 和 s0 最好是 0。\u003C/p>\u003C/li>\u003Cli>\u003Cp>IO：每秒从设备中读入 b1 的写入到设备 b0 的数据块的数量。反映了磁盘 I/O。\u003C/p>\u003C/li>\u003Cli>\u003Cp>System：显示了每秒发生中断的数量（in）和上下文交换（cs）的数量。\u003C/p>\u003C/li>\u003Cli>\u003Cp>CPU：显示用于运行用户代码，系统代码，空闲，等待 I/O 的 CPU 时间。\u003C/p>\u003C/li>\u003C/ul>\u003Cp style=\"text-align: justify;\">iostat 命令说明：\u003C/p>\u003Cul class=\"list-paddingleft-2\" style=\"text-align: justify;\">\u003Cli>\u003Cp>实例命令：iostat -dk 1 5；iostat -d -k -x 5 （查看设备使用率（%util）和响应时间（await））。\u003C/p>\u003C/li>\u003Cli>\u003Cp>TPS：该设备每秒的传输次数。“一次传输”意思是“一次 I/O 请求”。多个逻辑请求可能会被合并为“一次 I/O 请求”。\u003C/p>\u003C/li>\u003Cli>\u003Cp>iops ：硬件出厂的时候，厂家定义的一个每秒最大的 IO 次数。\u003Cbr>“一次传输”请求的大小是未知的。\u003C/p>\u003C/li>\u003Cli>\u003Cp>KB_read/s：每秒从设备（drive expressed）读取的数据量。\u003C/p>\u003C/li>\u003Cli>\u003Cp>KB_wrtn/s：每秒向设备（drive expressed）写入的数据量。\u003C/p>\u003C/li>\u003Cli>\u003Cp>KB_read：读取的总数据量。\u003C/p>\u003C/li>\u003Cli>\u003Cp>KB_wrtn：写入的总数量数据量；这些单位都为 Kilobytes。\u003C/p>\u003C/li>\u003C/ul>\u003Ch3 style=\"text-align: justify;\">系统层面问题解决办法\u003C/h3>\u003Cp style=\"text-align: justify;\">你认为到底负载高好，还是低好呢？在实际的生产中，一般认为 CPU 只要不超过 90% 都没什么问题。当然不排除下面这些特殊情况。\u003C/p>\u003Cp style=\"text-align: justify;\">CPU 负载高，IO 负载低：\u003C/p>\u003Cul class=\"list-paddingleft-2\" style=\"text-align: justify;\">\u003Cli>\u003Cp>内存不够\u003C/p>\u003C/li>\u003Cli>\u003Cp>磁盘性能差\u003C/p>\u003C/li>\u003Cli>\u003Cp>SQL 问题：去数据库层，进一步排查 SQL 问题\u003C/p>\u003C/li>\u003Cli>\u003Cp>IO 出问题了（磁盘到临界了、raid 设计不好、raid 降级、锁、在单位时间内 TPS 过高）\u003C/p>\u003C/li>\u003Cli>\u003Cp>TPS 过高：大量的小数据 IO、大量的全表扫描\u003C/p>\u003C/li>\u003C/ul>\u003Cp style=\"text-align: justify;\">IO 负载高，CPU 负载低：\u003C/p>\u003Cul class=\"list-paddingleft-2\" style=\"text-align: justify;\">\u003Cli>\u003Cp>大量小的 IO 写操作\u003C/p>\u003C/li>\u003Cli>\u003Cp>autocommit，产生大量小 - - IO；IO/PS，磁盘的一个定值，硬件出厂的时候，厂家定义的一个每秒最大的 IO 次数。\u003C/p>\u003C/li>\u003Cli>\u003Cp>大量大的 IO 写操作：SQL 问题的几率比较大\u003C/p>\u003C/li>\u003C/ul>\u003Cp style=\"text-align: justify;\">IO和 CPU 负载都很高：\u003C/p>\u003Cul class=\"list-paddingleft-2\" style=\"text-align: justify;\">\u003Cli>\u003Cp>硬件不够了或 SQL 存在问题\u003C/p>\u003C/li>\u003C/ul>\u003Ch2 style=\"text-align: justify;\">基础优化\u003C/h2>\u003Ch3 style=\"text-align: justify;\">优化思路\u003C/h3>\u003Cp style=\"text-align: justify;\">定位问题点吮吸：硬件&gt;系统&gt;应用&gt;数据库&gt;架构（高可用、读写分离、分库分表）。\u003C/p>\u003Cp style=\"text-align: justify;\">处理方向：明确优化目标、性能和安全的折中、防患未然。\u003C/p>\u003Ch3 style=\"text-align: justify;\">硬件优化\u003C/h3>\u003Cp style=\"text-align: justify;\">①主机方面\u003Cbr>根据数据库类型，主机 CPU 选择、内存容量选择、磁盘选择：\u003Cbr>平衡内存和磁盘资源\u003Cbr>随机的 I/O 和顺序的 I/O\u003Cbr>主机 RAID 卡的 BBU（Battery Backup Unit）关闭\u003C/p>\u003Cp style=\"text-align: justify;\">②CPU 的选择\u003Cbr>CPU 的两个关键因素：核数、主频。根据不同的业务类型进行选择：\u003Cbr>CPU 密集型：计算比较多，OLTP 主频很高的 CPU、核数还要多。\u003Cbr>IO 密集型：查询比较，OLAP 核数要多，主频不一定高的。\u003C/p>\u003Cp style=\"text-align: justify;\">③内存的选择\u003C/p>\u003Cp style=\"text-align: justify;\">OLAP 类型数据库，需要更多内存，和数据获取量级有关。OLTP 类型数据一般内存是 CPU 核心数量的 2 倍到 4 倍，没有最佳实践。\u003C/p>\u003Cp style=\"text-align: justify;\">④存储方面\u003C/p>\u003Cp style=\"text-align: justify;\">根据存储数据种类的不同，选择不同的存储设备，配置合理的 RAID 级别（raid5、raid10、热备盘）。\u003C/p>\u003Cp style=\"text-align: justify;\">对于操作系统来讲，不需要太特殊的选择，最好做好冗余（raid1）（ssd、sas、sata）。\u003C/p>\u003Cp style=\"text-align: justify;\">主机 raid 卡选择：\u003C/p>\u003Cul class=\"list-paddingleft-2\" style=\"text-align: justify;\">\u003Cli>\u003Cp>实现操作系统磁盘的冗余（raid1）\u003C/p>\u003C/li>\u003Cli>\u003Cp>平衡内存和磁盘资源\u003C/p>\u003C/li>\u003Cli>\u003Cp>随机的 I/O 和顺序的 I/O\u003C/p>\u003C/li>\u003Cli>\u003Cp>\u003Cspan>主机 raid 卡的 BBU（Battery Backup Unit）要关闭\u003C/span>\u003C/p>\u003C/li>\u003C/ul>\u003Cp style=\"text-align: justify;\">\u003Cspan>\u003C/span>\u003C/p>\u003Cp style=\"text-align: justify;\">⑤网络设备方面\u003C/p>\u003Cp style=\"text-align: justify;\">使用流量支持更高的网络设备（交换机、路由器、网线、网卡、HBA 卡）。注意：以上这些规划应该在初始设计系统时就应该考虑好。\u003C/p>\u003Ch3 style=\"text-align: justify;\">服务器硬件优化\u003C/h3>\u003Cp style=\"text-align: justify;\">服务器硬件优化关键点：\u003C/p>\u003Cul class=\"list-paddingleft-2\" style=\"text-align: justify;\">\u003Cli>\u003Cp>物理状态灯\u003C/p>\u003C/li>\u003Cli>\u003Cp>自带管理设备：远程控制卡（FENCE设备：ipmi ilo idarc）、开关机、硬件监控\u003C/p>\u003C/li>\u003Cli>\u003Cp>\u003Cspan>第三方的监控软件、设备（snmp、agent）对物理设施进行监控。\u003C/span>\u003C/p>\u003C/li>\u003Cli>\u003Cp>存储设备：自带的监控平台。EMC2（HP 收购了）、 日立（HDS）、IBM 低端 OEM HDS、高端存储是自己技术，华为存储。\u003C/p>\u003C/li>\u003C/ul>\u003Ch3 style=\"text-align: justify;\">系统优化\u003C/h3>\u003Cp style=\"text-align: justify;\">CPU：基本不需要调整，在硬件选择方面下功夫即可。\u003C/p>\u003Cp style=\"text-align: justify;\">内存：基本不需要调整，在硬件选择方面下功夫即可。\u003C/p>\u003Cp style=\"text-align: justify;\">SWAP：MySQL 尽量避免使用 Swap。阿里云的服务器中默认 swap 为 0。\u003C/p>\u003Cp style=\"text-align: justify;\">IO ：raid、no lvm、ext4 或 xfs、ssd、IO 调度策略。\u003C/p>\u003Cp style=\"text-align: justify;\">Swap 调整(不使用 swap 分区)：\u003C/p>\u003Cpre style=\"text-align: justify;\">\u003Cp>/proc/sys/vm/swappiness的内容改成0（临时），/etc/sysctl. conf上添加vm.swappiness=0（永久）\u003C/p>\u003C/pre>\u003Cp style=\"text-align: justify;\">IO 调度策略：\u003C/p>\u003Cpre style=\"text-align: justify;\">\u003Cp>#echo deadline&gt;/sys/block/sda/queue/scheduler &nbsp; 临时修改为deadline\u003C/p>\u003C/pre>\u003Cp style=\"text-align: justify;\">永久修改：\u003C/p>\u003Cpre style=\"text-align: justify;\">\u003Cp>vi /boot/grub/grub.conf\n更改到如下内容:\nkernel /boot/vmlinuz-2.6.18-8.el5 ro root=LABEL=/ elevator=deadline rhgb quiet\u003C/p>\u003C/pre>\u003Ch3 style=\"text-align: justify;\">系统参数调整\u003C/h3>\u003Cp style=\"text-align: justify;\">Linux 系统内核参数优化：\u003C/p>\u003Cpre style=\"text-align: justify;\">\u003Cp>vim/etc/sysctl.conf\nnet.ipv4.ip_local_port_range = 1024 65535：# 用户端口范围\nnet.ipv4.tcp_max_syn_backlog = 4096 \nnet.ipv4.tcp_fin_timeout = 30 \nfs.file-max=65535：# 系统最大文件句柄，控制的是能打开文件最大数量\u003C/p>\u003C/pre>\u003Cp style=\"text-align: justify;\">用户限制参数（MySQL 可以不设置以下配置）：\u003C/p>\u003Cpre style=\"text-align: justify;\">\u003Cp>vim/etc/security/limits.conf \n* soft nproc 65535\n* hard nproc 65535\n* soft nofile 65535\n* hard nofile 65535\u003C/p>\u003C/pre>\u003Ch3 style=\"text-align: justify;\">应用优化\u003C/h3>\u003Cp style=\"text-align: justify;\">业务应用和数据库应用独立。\u003C/p>\u003Cp style=\"text-align: justify;\">防火墙：iptables、selinux 等其他无用服务（关闭）：\u003C/p>\u003Cpre style=\"text-align: justify;\">\u003Cp>chkconfig --level 23456 acpid off\n &nbsp; &nbsp;chkconfig --level 23456 anacron off\n &nbsp; &nbsp;chkconfig --level 23456 autofs off\n &nbsp; &nbsp;chkconfig --level 23456 avahi-daemon off\n &nbsp; &nbsp;chkconfig --level 23456 bluetooth off\n &nbsp; &nbsp;chkconfig --level 23456 cups off\n &nbsp; &nbsp;chkconfig --level 23456 firstboot off\n &nbsp; &nbsp;chkconfig --level 23456 haldaemon off\n &nbsp; &nbsp;chkconfig --level 23456 hplip off\n &nbsp; &nbsp;chkconfig --level 23456 ip6tables off\n &nbsp; &nbsp;chkconfig --level 23456 iptables &nbsp;off\n &nbsp; &nbsp;chkconfig --level 23456 isdn off\n &nbsp; &nbsp;chkconfig --level 23456 pcscd off\n &nbsp; &nbsp;chkconfig --level 23456 sendmail &nbsp;off\n &nbsp; &nbsp;chkconfig --level 23456 yum-updatesd &nbsp;off\u003C/p>\u003C/pre>\u003Cp style=\"text-align: justify;\">安装图形界面的服务器不要启动图形界面 runlevel 3。\u003C/p>\u003Cp style=\"text-align: justify;\">另外，思考将来我们的业务是否真的需要 MySQL，还是使用其他种类的数据库。用数据库的最高境界就是不用数据库。\u003C/p>\u003Ch2 style=\"text-align: justify;\">数据库优化\u003C/h2>\u003Cp style=\"text-align: justify;\">SQL 优化方向：\u003C/p>\u003Cul class=\"list-paddingleft-2\" style=\"text-align: justify;\">\u003Cli>\u003Cp>执行计划\u003C/p>\u003C/li>\u003Cli>\u003Cp>索引\u003C/p>\u003C/li>\u003Cli>\u003Cp>SQL 改写\u003C/p>\u003C/li>\u003C/ul>\u003Cp style=\"text-align: justify;\">架构优化方向：\u003C/p>\u003Cul class=\"list-paddingleft-2\" style=\"text-align: justify;\">\u003Cli>\u003Cp>高可用架构\u003C/p>\u003C/li>\u003Cli>\u003Cp>高性能架构\u003C/p>\u003C/li>\u003Cli>\u003Cp>分库分表\u003C/p>\u003C/li>\u003C/ul>\u003Ch3 style=\"text-align: justify;\">数据库参数优化\u003C/h3>\u003Cp style=\"text-align: justify;\">①调整\u003C/p>\u003Cp style=\"text-align: justify;\">实例整体（高级优化，扩展）：\u003C/p>\u003Cpre style=\"text-align: justify;\">\u003Cp>thread_concurrency：# 并发线程数量个数\nsort_buffer_size：# 排序缓存\nread_buffer_size：# 顺序读取缓存\nread_rnd_buffer_size：# 随机读取缓存\nkey_buffer_size：# 索引缓存\nthread_cache_size：# (1G—&gt;8, 2G—&gt;16, 3G—&gt;32, &gt;3G—&gt;64)\u003C/p>\u003C/pre>\u003Cp style=\"text-align: justify;\">②连接层（基础优化）\u003C/p>\u003Cp style=\"text-align: justify;\">设置合理的连接客户和连接方式：\u003C/p>\u003Cpre style=\"text-align: justify;\">\u003Cp>max_connections &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 最大连接数，看交易笔数设置 &nbsp; &nbsp;\nmax_connect_errors &nbsp; &nbsp; &nbsp; &nbsp;# 最大错误连接数，能大则大\nconnect_timeout &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 连接超时\nmax_user_connections &nbsp; &nbsp; &nbsp;# 最大用户连接数\nskip-name-resolve &nbsp; &nbsp; &nbsp; &nbsp; # 跳过域名解析\nwait_timeout &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 等待超时\nback_log &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 可以在堆栈中的连接数量\u003C/p>\u003C/pre>\u003Cp style=\"text-align: justify;\">③SQL 层（基础优化）\u003C/p>\u003Cp style=\"text-align: justify;\">query_cache_size： 查询缓存 &nbsp;&gt;&gt;&gt; &nbsp;OLAP 类型数据库，需要重点加大此内存缓存，但是一般不会超过 GB。\u003C/p>\u003Cp style=\"text-align: justify;\">对于经常被修改的数据，缓存会马上失效。我们可以使用内存数据库（redis、memecache），替代它的功能。\u003C/p>\u003Ch3 style=\"text-align: justify;\">存储引擎层优化\u003C/h3>\u003Cp style=\"text-align: justify;\">innodb 基础优化参数：\u003C/p>\u003Cpre style=\"text-align: justify;\">\u003Cp>default-storage-engine\ninnodb_buffer_pool_size &nbsp; &nbsp; &nbsp; # 没有固定大小，50%测试值，看看情况再微调。但是尽量设置不要超过物理内存70%\ninnodb_file_per_table=(1,0)\ninnodb_flush_log_at_trx_commit=(0,1,2) # 1是最安全的，0是性能最高，2折中\nbinlog_sync\nInnodb_flush_method=(O_DIRECT, fdatasync)\ninnodb_log_buffer_size &nbsp; &nbsp; &nbsp; &nbsp;# 100M以下\ninnodb_log_file_size &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 100M 以下\ninnodb_log_files_in_group &nbsp; &nbsp; # 5个成员以下,一般2-3个够用（iblogfile0-N）\ninnodb_max_dirty_pages_pct &nbsp; # 达到百分之75的时候刷写 内存脏页到磁盘。\nlog_bin\nmax_binlog_cache_size &nbsp; &nbsp; &nbsp; &nbsp; # 可以不设置\nmax_binlog_size &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 可以不设置\ninnodb_additional_mem_pool_size &nbsp; &nbsp;#小于2G内存的机器，推荐值是20M。32G内存以上100M\u003C/p>\u003C/pre>","MySQL 对于很多 Linux 从业者而言，是一个非常棘手的问题，多数情况都是因为对数据库出现问题的情况和处理思路不清晰。\n\n在进行 MySQL 的优化之前必须要了解的就是 MySQL 的查询过程，很多的查询优化工作实际上就是遵循一些原则让 MySQL 的优化器能够按照预想的合理方式运行而已。\n\n![mysql.jpg](/uploads/layedit/20190123/a0a6c0c50646986cbe521e5d06253e04.jpg)\n\n## 优化的哲学\n\n注：优化有风险，修改需谨慎。\n\n优化可能带来的问题：\n\n- 优化不总是对一个单纯的环境进行，还很可能是一个复杂的已投产的系统。\n- 优化手段本来就有很大的风险，只不过你没能力意识到和预见到。\n- 任何的技术可以解决一个问题，但必然存在带来一个问题的风险。\n- 对于优化来说解决问题而带来的问题，控制在可接受的范围内才是有成果。\n- 保持现状或出现更差的情况都是失败。\n\n优化的需求：\n\n- 稳定性和业务可持续性，通常比性能更重要。\n- 优化不可避免涉及到变更，变更就有风险。\n- 优化使性能变好，维持和变差是等概率事件。\n- 切记优化，应该是各部门协同，共同参与的工作，任何单一部门都不能对数据库进行优化。\n\n所以优化工作，是由业务需求驱使的！\n\n优化由谁参与？在进行数据库优化时，应由数据库管理员、业务部门代表、应用程序架构师、应用程序设计人员、应用程序开发人员、硬件及系统管理员、存储管理员等，业务相关人员共同参与。\n\n## 优化思路\n\n### 优化什么\n\n在数据库优化上有两个主要方面：\n\n- 安全：数据可持续性。\n- 性能：数据的高性能访问。\n\n### 优化的范围有哪些\n\n存储、主机和操作系统方面：\n\n- 主机架构稳定性\n- I/O 规划及配置\n- Swap 交换分区\n- OS 内核参数和网络问题\n\n应用程序方面：\n\n- 应用程序稳定性\n- SQL 语句性能\n- 串行访问资源\n- 性能欠佳会话管理\n- 这个应用适不适合用 MySQL\n\n数据库优化方面：\n\n- 内存\n- 数据库结构（物理&逻辑）\n- 实例配置\n\n说明：不管是设计系统、定位问题还是优化，都可以按照这个顺序执行。\n\n### 优化维度\n\n![mysql-2.jpg](/uploads/layedit/20190123/e4cffb68fc4567e5c58c6c75c7c1af77.jpg)\n\n数据库优化维度有如下四个：\n\n- 硬件\n- 系统配置\n- 数据库表结构\n- SQL 及索引\n\n优化选择：\n\n- 优化成本：硬件>系统配置>数据库表结构>SQL 及索引。\n- 优化效果：硬件\n\n## 优化工具有啥\n\n### 数据库层面\n\n检查问题常用的 12 个工具：\n\n- MySQL\n- mysqladmin：MySQL 客户端，可进行管理操作\n- mysqlshow：功能强大的查看 shell 命令\n- SHOW [SESSION | GLOBAL] variables：查看数据库参数信息\n- SHOW [SESSION | GLOBAL] STATUS：查看数据库的状态信息\n- information_schema：获取元数据的方法\n- SHOW ENGINE INNODB STATUS：Innodb 引擎的所有状态\n- SHOW PROCESSLIST：查看当前所有连接的 session 状态\n- explain：获取查询语句的执行计划\n- show index：查看表的索引信息\n- slow-log：记录慢查询语句\n- mysqldumpslow：分析 slowlog 文件的工具\n\n不常用但好用的 7 个工具：\n\n- Zabbix：监控主机、系统、数据库（部署 Zabbix 监控平台）\n- pt-query-digest：分析慢日志\n- MySQL slap：分析慢日志\n- sysbench：压力测试工具\n- MySQL profiling：统计数据库整体状态工具\n- Performance Schema：MySQL 性能状态统计的数据\n- workbench：管理、备份、监控、分析、优化工具（比较费资源）\n\n### 数据库层面问题解决思路\n\n一般应急调优的思路：针对突然的业务办理卡顿，无法进行正常的业务处理，需要马上解决的场景。\n\n```\nshow processlist\n2、explain  select id ,name from stu where name='clsn'; # ALL  id name age  sex\n            select id,name from stu  where id=2-1 函数 结果集>30;\n　　　 show index from table;\n3、通过执行计划判断，索引问题（有没有、合不合理）或者语句本身问题\n4、show status  like '%lock%';    # 查询锁状态\n　　kill SESSION_ID;   # 杀掉有问题的session\n```\n\n常规调优思路：针对业务周期性的卡顿，例如在每天 10-11 点业务特别慢，但是还能够使用，过了这段时间就好了。\n\n```\n1）查看slowlog，分析slowlog，分析出查询慢的语句；\n2）按照一定优先级，一个一个排查所有慢语句；\n3）分析top SQL，进行explain调试，查看语句执行时间；\n4）调整索引或语句本身。\n```\n\n### 系统层面\n\nCPU方面：vmstat、sar top、htop、nmon、mpstat。\n\n内存：free、ps-aux。\n\nIO 设备（磁盘、网络）：iostat、ss、netstat、iptraf、iftop、lsof。\n\nvmstat 命令说明：\n\n- Procs：r 显示有多少进程正在等待 CPU 时间。b 显示处于不可中断的休眠的进程数量。在等待 I/O。\n- Memory：swpd 显示被交换到磁盘的数据块的数量。未被使用的数据块，用户缓冲数据块，用于操作系统的数据块的数量。\n- Swap：操作系统每秒从磁盘上交换到内存和从内存交换到磁盘的数据块的数量。s1 和 s0 最好是 0。\n- IO：每秒从设备中读入 b1 的写入到设备 b0 的数据块的数量。反映了磁盘 I/O。\n- System：显示了每秒发生中断的数量（in）和上下文交换（cs）的数量。\n- CPU：显示用于运行用户代码，系统代码，空闲，等待 I/O 的 CPU 时间。\n\niostat 命令说明：\n\n- 实例命令：iostat -dk 1 5；iostat -d -k -x 5 （查看设备使用率（%util）和响应时间（await））。\n- TPS：该设备每秒的传输次数。“一次传输”意思是“一次 I/O 请求”。多个逻辑请求可能会被合并为“一次 I/O 请求”。\n- iops ：硬件出厂的时候，厂家定义的一个每秒最大的 IO 次数。“一次传输”请求的大小是未知的。\n- KB_read/s：每秒从设备（drive expressed）读取的数据量。\n- KB_wrtn/s：每秒向设备（drive expressed）写入的数据量。\n- KB_read：读取的总数据量。\n- KB_wrtn：写入的总数量数据量；这些单位都为 Kilobytes。\n\n### 系统层面问题解决办法\n\n你认为到底负载高好，还是低好呢？在实际的生产中，一般认为 CPU 只要不超过 90% 都没什么问题。当然不排除下面这些特殊情况。\n\nCPU 负载高，IO 负载低：\n\n- 内存不够\n- 磁盘性能差\n- SQL 问题：去数据库层，进一步排查 SQL 问题\n- IO 出问题了（磁盘到临界了、raid 设计不好、raid 降级、锁、在单位时间内 TPS 过高）\n- TPS 过高：大量的小数据 IO、大量的全表扫描\n\nIO 负载高，CPU 负载低：\n\n- 大量小的 IO 写操作\n- autocommit，产生大量小 - - IO；IO/PS，磁盘的一个定值，硬件出厂的时候，厂家定义的一个每秒最大的 IO 次数。\n- 大量大的 IO 写操作：SQL 问题的几率比较大\n\nIO和 CPU 负载都很高：\n\n- 硬件不够了或 SQL 存在问题\n\n## 基础优化\n\n### 优化思路\n\n定位问题点吮吸：硬件>系统>应用>数据库>架构（高可用、读写分离、分库分表）。\n\n处理方向：明确优化目标、性能和安全的折中、防患未然。\n\n### 硬件优化\n\n①主机方面\n根据数据库类型，主机 CPU 选择、内存容量选择、磁盘选择：\n平衡内存和磁盘资源\n随机的 I/O 和顺序的 I/O\n主机 RAID 卡的 BBU（Battery Backup Unit）关闭\n\n②CPU 的选择\nCPU 的两个关键因素：核数、主频。根据不同的业务类型进行选择：\nCPU 密集型：计算比较多，OLTP 主频很高的 CPU、核数还要多。\nIO 密集型：查询比较，OLAP 核数要多，主频不一定高的。\n\n③内存的选择\n\nOLAP 类型数据库，需要更多内存，和数据获取量级有关。OLTP 类型数据一般内存是 CPU 核心数量的 2 倍到 4 倍，没有最佳实践。\n\n④存储方面\n\n根据存储数据种类的不同，选择不同的存储设备，配置合理的 RAID 级别（raid5、raid10、热备盘）。\n\n对于操作系统来讲，不需要太特殊的选择，最好做好冗余（raid1）（ssd、sas、sata）。\n\n主机 raid 卡选择：\n\n- 实现操作系统磁盘的冗余（raid1）\n- 平衡内存和磁盘资源\n- 随机的 I/O 和顺序的 I/O\n- 主机 raid 卡的 BBU（Battery Backup Unit）要关闭\n\n⑤网络设备方面\n\n使用流量支持更高的网络设备（交换机、路由器、网线、网卡、HBA 卡）。注意：以上这些规划应该在初始设计系统时就应该考虑好。\n\n### 服务器硬件优化\n\n服务器硬件优化关键点：\n\n- 物理状态灯\n- 自带管理设备：远程控制卡（FENCE设备：ipmi ilo idarc）、开关机、硬件监控\n- 第三方的监控软件、设备（snmp、agent）对物理设施进行监控。\n- 存储设备：自带的监控平台。EMC2（HP 收购了）、 日立（HDS）、IBM 低端 OEM HDS、高端存储是自己技术，华为存储。\n\n### 系统优化\n\nCPU：基本不需要调整，在硬件选择方面下功夫即可。\n\n内存：基本不需要调整，在硬件选择方面下功夫即可。\n\nSWAP：MySQL 尽量避免使用 Swap。阿里云的服务器中默认 swap 为 0。\n\nIO ：raid、no lvm、ext4 或 xfs、ssd、IO 调度策略。\n\nSwap 调整(不使用 swap 分区)：\n\n```\n/proc/sys/vm/swappiness的内容改成0（临时），/etc/sysctl. conf上添加vm.swappiness=0（永久）\n```\n\nIO 调度策略：\n\n```\n#echo deadline>/sys/block/sda/queue/scheduler   临时修改为deadline\n```\n\n永久修改：\n\n```\nvi /boot/grub/grub.conf\n更改到如下内容:\nkernel /boot/vmlinuz-2.6.18-8.el5 ro root=LABEL=/ elevator=deadline rhgb quiet\n```\n\n### 系统参数调整\n\nLinux 系统内核参数优化：\n\n```\nvim/etc/sysctl.conf\nnet.ipv4.ip_local_port_range = 1024 65535：# 用户端口范围\nnet.ipv4.tcp_max_syn_backlog = 4096\nnet.ipv4.tcp_fin_timeout = 30\nfs.file-max=65535：# 系统最大文件句柄，控制的是能打开文件最大数量\n```\n\n用户限制参数（MySQL 可以不设置以下配置）：\n\n```\nvim/etc/security/limits.conf\n* soft nproc 65535\n* hard nproc 65535\n* soft nofile 65535\n* hard nofile 65535\n```\n\n### 应用优化\n\n业务应用和数据库应用独立。\n\n防火墙：iptables、selinux 等其他无用服务（关闭）：\n\n```\nchkconfig --level 23456 acpid off\n    chkconfig --level 23456 anacron off\n    chkconfig --level 23456 autofs off\n    chkconfig --level 23456 avahi-daemon off\n    chkconfig --level 23456 bluetooth off\n    chkconfig --level 23456 cups off\n    chkconfig --level 23456 firstboot off\n    chkconfig --level 23456 haldaemon off\n    chkconfig --level 23456 hplip off\n    chkconfig --level 23456 ip6tables off\n    chkconfig --level 23456 iptables  off\n    chkconfig --level 23456 isdn off\n    chkconfig --level 23456 pcscd off\n    chkconfig --level 23456 sendmail  off\n    chkconfig --level 23456 yum-updatesd  off\n```\n\n安装图形界面的服务器不要启动图形界面 runlevel 3。\n\n另外，思考将来我们的业务是否真的需要 MySQL，还是使用其他种类的数据库。用数据库的最高境界就是不用数据库。\n\n## 数据库优化\n\nSQL 优化方向：\n\n- 执行计划\n- 索引\n- SQL 改写\n\n架构优化方向：\n\n- 高可用架构\n- 高性能架构\n- 分库分表\n\n### 数据库参数优化\n\n①调整\n\n实例整体（高级优化，扩展）：\n\n```\nthread_concurrency：# 并发线程数量个数\nsort_buffer_size：# 排序缓存\nread_buffer_size：# 顺序读取缓存\nread_rnd_buffer_size：# 随机读取缓存\nkey_buffer_size：# 索引缓存\nthread_cache_size：# (1G—>8, 2G—>16, 3G—>32, >3G—>64)\n```\n\n②连接层（基础优化）\n\n设置合理的连接客户和连接方式：\n\n```\nmax_connections           # 最大连接数，看交易笔数设置    \nmax_connect_errors        # 最大错误连接数，能大则大\nconnect_timeout           # 连接超时\nmax_user_connections      # 最大用户连接数\nskip-name-resolve         # 跳过域名解析\nwait_timeout              # 等待超时\nback_log                  # 可以在堆栈中的连接数量\n```\n\n③SQL 层（基础优化）\n\nquery_cache_size： 查询缓存  >>>  OLAP 类型数据库，需要重点加大此内存缓存，但是一般不会超过 GB。\n\n对于经常被修改的数据，缓存会马上失效。我们可以使用内存数据库（redis、memecache），替代它的功能。\n\n### 存储引擎层优化\n\ninnodb 基础优化参数：\n\n```\ndefault-storage-engine\ninnodb_buffer_pool_size       # 没有固定大小，50%测试值，看看情况再微调。但是尽量设置不要超过物理内存70%\ninnodb_file_per_table=(1,0)\ninnodb_flush_log_at_trx_commit=(0,1,2) # 1是最安全的，0是性能最高，2折中\nbinlog_sync\nInnodb_flush_method=(O_DIRECT, fdatasync)\ninnodb_log_buffer_size        # 100M以下\ninnodb_log_file_size          # 100M 以下\ninnodb_log_files_in_group     # 5个成员以下,一般2-3个够用（iblogfile0-N）\ninnodb_max_dirty_pages_pct   # 达到百分之75的时候刷写 内存脏页到磁盘。\nlog_bin\nmax_binlog_cache_size         # 可以不设置\nmax_binlog_size               # 可以不设置\ninnodb_additional_mem_pool_size    #小于2G内存的机器，推荐值是20M。32G内存以上100M\n```","/article/95",6717,"2019-01-23 10:02:15","2019-01-23 10:04:27",[156,157],{"id":40,"name":72,"url":75},{"id":145,"name":146,"url":151},{"create_time":6,"description":6,"id":40,"image_url":6,"index_template":52,"is_cover":53,"is_menu":53,"keywords":6,"list_template":54,"model_code":55,"model_id":56,"model_name":57,"name":72,"parent_id":73,"seo_description":6,"seo_keywords":6,"seo_title":6,"show_template":58,"sort":74,"subtitle":6,"update_time":6,"url":75},{"title":160,"url":161},"主流典型各类应用服务器硬件配置分析","/article/96",{"title":163,"url":164},"10 个 MySQL 经典错误","/article/91",[],{"description":148,"keywords":147,"title":146},[168,177,186,195,204,213,222,231,240,248],{"id":169,"category_id":44,"title":170,"keywords":171,"description":172,"image_url":6,"url":173,"hits":174,"is_recommend":73,"is_top":73,"create_time":175,"update_time":176},101,"开启 HTTPS 并获得 ssllabs 满分的过程","开启,获得,满分,过程","准备工作确保你要申请证书的域名都解析到了这台服务器上，且能直接通过域名访问。使用官网推荐的CertBot获取证书。在CertBot官网选择一下环境(比如我选Nginx on Ubuntu 17.04)就可以看到入门教程了。安装CertBot12345apt-get updateapt-get install software-properties-commonadd-apt-repository ppa:certbot/certbotapt-get updateapt-get","/article/101",18546,"2019-11-26 16:12:11","2019-11-26 16:23:16",{"id":178,"category_id":44,"title":179,"keywords":180,"description":181,"image_url":6,"url":182,"hits":183,"is_recommend":73,"is_top":73,"create_time":184,"update_time":185},113,"在CentOS 7中添加命令自动补全功能","命令自动补全,centos","在CentOS 7中，默认情况下并不会安装命令补全包，需要手动安装才能使用命令补全功能。以下是在CentOS 7中安装命令补全包的方法：1. bash-completion：这是一个针对Bash shell的命令补全软件包，可以提供对系统命令、用户自定义命令和文件路径的自动补全功能。可以通过以下命令安装：```sudo yum install bash-completion```安装完成后，需要在/etc/profile配置文件中添加以下内容：```if [ -f /etc/bash_compl","/article/113",14948,"2023-05-16 10:54:01","2023-05-16 10:57:28",{"id":187,"category_id":44,"title":188,"keywords":189,"description":190,"image_url":6,"url":191,"hits":192,"is_recommend":53,"is_top":73,"create_time":193,"update_time":194},94,"Centos7 安装 openvas ","openvas,开放式漏洞评估系统，installing openvas centos-7","一、描述OpenVAS，即开放式漏洞评估系统，是一个用于评估目标漏洞的杰出框架。功能十分强大，最重要的是，它是“开源”的——就是免费的意思啦～它与著名的Nessus“本是同根生”，在Nessus商业化之后仍然坚持开源，号称“当前最好用的开源漏洞扫描工具”。最新版的Kali Linux(kali 3.0)不再自带OpenVAS了，所以我们要自己部署OpenVAS漏洞检测系统。其核心部件是一个服务器，包括一套网络漏洞测试程序，可以检测远程系统和应用程序中的安全问题。但是它的最常用用途是检测目标网络或","/article/94",14690,"2019-01-14 17:43:42","2019-01-14 18:16:36",{"id":196,"category_id":44,"title":197,"keywords":198,"description":199,"image_url":6,"url":200,"hits":201,"is_recommend":73,"is_top":73,"create_time":202,"update_time":203},99,"Centos7 利用iptables防止nmap工具防端口扫描","iptables","一、Nmap介绍       Nmap（NetworkMapper）是一款开放源代码的网络探测和安全审核工具。它用于快速扫描一个网络和一台主机开放的端口，还能使用TCP/IP协议栈特征探测远程主机的操作系统类型。nmap支持很多扫描技术，例如：UDP、TCPconnect()、TCPSYN(半开扫描)、ftp代理(bounce攻击)、反向标志、ICMP、FIN、ACK扫描、圣诞树(XmasTree)、SYN扫描和null扫描。Nmap最初是用于Unix系统","/article/99",14415,"2019-07-09 21:27:00","2019-07-09 21:57:53",{"id":205,"category_id":46,"title":206,"keywords":207,"description":208,"image_url":6,"url":209,"hits":210,"is_recommend":73,"is_top":73,"create_time":211,"update_time":212},61,"Docker 推荐的启动方式","推荐,启动,方式","# cat DockerfileFROM openjdk:8-alpineWORKDIR /ADD ./target/*.jar app.jarEXPOSE 9999COPY docker-entrypoint.sh /RUN chmod +x /docker-entrypoint.shENTRYPOINT [“/docker-entrypoint.sh”]CMD [“java”,”-server”,”-Duser.timezone=GMT+08″,”-jar”,”/app.jar”]# cat","/article/61",14347,"2018-10-22 13:55:47","2018-10-22 13:56:10",{"id":214,"category_id":44,"title":215,"keywords":216,"description":217,"image_url":6,"url":218,"hits":219,"is_recommend":73,"is_top":73,"create_time":220,"update_time":221},107,"Acme.sh 给 SSL 证书自动续期失败的解决方法","HTTP/1.1 200 OK,Server: Bayou Tech Web Srv 1.0,Content-Encoding: none,Content-Length: 5,Content-Type","一、Acme.sh 自动续期失败的症状问题描述如下，续期的时候，提示如下错误：root@dc:~# \"/data/acme.sh\"/acme.sh --cron --home \"/data/acme.sh\" &gt; /dev/null[Sun Nov 10 23:52:17 CST 2020] Error, can not get domain token entry example.com[Sun Nov 10 23:52:17 CST 2020] Please check log file","/article/107",12618,"2021-09-03 10:44:18","2021-09-03 10:46:23",{"id":223,"category_id":44,"title":224,"keywords":225,"description":226,"image_url":6,"url":227,"hits":228,"is_recommend":53,"is_top":73,"create_time":229,"update_time":230},93,"ELK+Filebeat+Kafka+ZooKeeper 构建海量日志分析平台","Filebeat,Kafka","一、说明1.Filebeat是一个日志文件托运工具，在你的服务器上安装客户端后，filebeat会监控日志目录或者指定的日志文件，追踪读取这些文件（追踪文件的变化，不停的读）2.Kafka是一种高吞吐量的分布式发布订阅消息系统，它可以处理消费者规模的网站中的所有动作流数据3.Logstash是一根具备实时数据传输能力的管道，负责将数据信息从管道的输入端传输到管道的输出端；与此同时这根管道还可以让你根据自己的需求在中间加上滤网，Logstash提供里很多功能强大的滤网以满足你的各种应用场景4.El","/article/93",12190,"2018-12-24 16:40:08","2018-12-26 11:53:38",{"id":232,"category_id":46,"title":233,"keywords":234,"description":235,"image_url":6,"url":236,"hits":237,"is_recommend":53,"is_top":73,"create_time":238,"update_time":239},81,"kubernetes 1.12.1 高可用安装之部署Dashboard","安装Dashboard","创建Dashboard需要CoreDNS部署成功之后再安装Dashboard。[root@master01 ~]# wget https://zhl123.com/download/k8s/Dashboard.tgz[root@master01 ~]# tar xf Dashboard.tgz[root@master01 ~]# kubectl create -f Dashboard/[root@master01 Dashboard]# kubectl get svc -n kube-syste","/article/81",12037,"2018-10-26 09:54:41","2018-10-26 16:59:19",{"id":241,"category_id":44,"title":242,"keywords":6,"description":243,"image_url":6,"url":244,"hits":245,"is_recommend":73,"is_top":73,"create_time":246,"update_time":247},100,"用 Nginx 给 Cookie 增加 Secure 和 HttpOnly","在 nginx 的 location 中配置12# 只支持 proxy 模式下设置，SameSite 不需要可删除，如果想更安全可以把 SameSite 设置为 Strictproxy_cookie_path / \"/; httponly; secure; SameSite=Lax\";示例1234567891011121314151617181920212223242526server {    listen 443 ssl http2;    server_name www.zhl123.cn","/article/100",11848,"2019-11-26 16:10:57","2019-11-26 16:23:45",{"id":249,"category_id":44,"title":250,"keywords":251,"description":252,"image_url":6,"url":253,"hits":254,"is_recommend":73,"is_top":73,"create_time":255,"update_time":256},41,"Tomcat 安全配置与性能优化","tomcat，性能优化","1. JVM&nbsp;1.1. 使用 Server JRE 替代JDK。&nbsp;服务器上不要安装JDK，请使用 Server JRE. 服务器上根本不需要编译器，代码应该在Release服务器上完成编译打包工作。&nbsp;理由：一旦服务器被控制，可以防止在其服务器上编译其他恶意代码并植入到你的程序中。&nbsp;1.2. JAVA_OPTS&nbsp;export JAVA_OPTS=\"-server -Xms512m -Xmx4096m &nbsp;-XX:PermSize=64M -","/article/41",11623,"2016-09-01 17:06:36","2018-10-18 17:06:58",[258,266,274,282,290,298,306,314,323,332],{"id":259,"category_id":40,"title":260,"keywords":6,"description":261,"image_url":6,"url":262,"hits":263,"is_recommend":73,"is_top":73,"create_time":264,"update_time":265},123,"Agent Skill 精选集：最值得收藏的 Agent Skills Top 10","如果你正在用 Claude Code 或 Codex，一定对&nbsp;Agent Skills&nbsp;不陌生。通过安装&nbsp;Agent Skills，你可以让这些 AI 助手变得更强——不用每次都解释你的需求，它们直接就知道该怎么做。最近有人在 GitHub 上做了一个采样调查，统计了哪些 Skills 的质量最佳和最受欢迎。我整理了这份&nbsp;Top 10 榜单，加上使用场景和适合人群，帮你快速找到最有用的那几个。Top 10 最受欢迎的 Agent Skills1. Skil","/article/123",270,"2026-01-19 18:49:12","2026-01-19 18:52:01",{"id":267,"category_id":44,"title":268,"keywords":6,"description":269,"image_url":6,"url":270,"hits":271,"is_recommend":73,"is_top":73,"create_time":272,"update_time":273},122,"Nginx性能调优18条黄金法则：支撑10万并发的配置模板","一、概述1.1 背景介绍说实话，Nginx调优这事儿我踩过无数坑。记得2019年双11，我们电商平台流量暴涨，Nginx直接扛不住了，QPS从平时的2万飙升到8万，响应时间从50ms飙到了2秒，最后还是靠临时加机器扛过去的。那次事故之后，我花了大半年时间专门研究Nginx的性能极限，总结出了这20条黄金法则。Nginx作为目前最流行的Web服务器和反向代理，官方数据显示单机可以轻松处理10万+的并发连接。但实际生产环境中，很多同学拿到默认配置就直接上了，结果发现连1万并发都扛不住。问题不在Ngi","/article/122",337,"2026-01-12 11:11:50","2026-01-12 11:12:28",{"id":275,"category_id":46,"title":276,"keywords":6,"description":277,"image_url":6,"url":278,"hits":279,"is_recommend":73,"is_top":73,"create_time":280,"update_time":281},121,"Docker 镜像优化与安全扫描：将镜像体积压缩 70%","1. 适用场景 & 前置条件项目要求适用场景容器化应用镜像体积过大（> 500MB），构建时间长（> 10分钟），存在安全漏洞（CVE高危）OSRHEL/CentOS 7.9+ 或 Ubuntu 20.04+内核Linux Kernel 3.10+软件版本Docker 20.10+ 或 Podman 3.0+，Trivy 0.40+（安全扫描工具）资源规格2C4G（最小）/ 4C8G（推荐），磁盘 50GB+（存储镜像与缓存）网络可访问 Docker Hub/阿里云镜像仓库（","/article/121",309,"2026-01-06 11:54:35","2026-01-06 12:01:59",{"id":283,"category_id":44,"title":284,"keywords":6,"description":285,"image_url":6,"url":286,"hits":287,"is_recommend":73,"is_top":73,"create_time":288,"update_time":289},120,"用 Prometheus Recording Rules 把告警噪声砍掉 70%(二)","五、故障排查和监控5.1 故障排查◆ 5.1.1 日志查看# 查看 Prometheus 日志中的规则评估错误journalctl -u prometheus | grep -i&nbsp;\"rule\"&nbsp;|&nbsp;tail&nbsp;-50# 查看规则评估耗时curl -s http://localhost:9090/api/v1/rules | jq&nbsp;'.data.groups[].rules[] | select(.health != \"ok\")'# Kubernet","/article/120",282,"2026-01-06 11:53:50","2026-01-06 11:54:33",{"id":291,"category_id":44,"title":292,"keywords":6,"description":293,"image_url":6,"url":294,"hits":295,"is_recommend":73,"is_top":73,"create_time":296,"update_time":297},119,"用 Prometheus Recording Rules 把告警噪声砍掉 70%(一)","一、概述1.1 背景介绍在大规模微服务架构下，Prometheus 告警系统往往会陷入一个尴尬的境地：告警太多，运维团队开始选择性忽略；告警太少，真正的故障又可能漏掉。我在某电商平台负责监控体系建设时，团队每天要处理超过 2000 条告警，其中 70% 以上是重复的、关联的或者短暂抖动产生的噪声。Recording Rules 是 Prometheus 提供的预计算机制，可以将复杂的查询表达式预先计算并存储为新的时间序列。通过合理设计 Recording Rules，我们不仅能显著降低 Prom","/article/119",301,"2026-01-06 11:51:58","2026-01-06 11:53:45",{"id":299,"category_id":44,"title":300,"keywords":6,"description":301,"image_url":6,"url":302,"hits":303,"is_recommend":73,"is_top":73,"create_time":304,"update_time":305},118,"GitOps 落地实践：ArgoCD + Kustomize 实现声明式基础设施管理(二)","四、最佳实践和注意事项4.1 最佳实践4.1.1 性能优化优化点一：减少 Git 轮询频率# argocd-cm ConfigMapapiVersion:&nbsp;v1kind:&nbsp;ConfigMapmetadata:&nbsp;&nbsp;name:&nbsp;argocd-cm&nbsp;&nbsp;namespace:&nbsp;argocddata:&nbsp;&nbsp;timeout.reconciliation:&nbsp;300s&nbsp;&nbsp;# 默认 180","/article/118",305,"2026-01-06 11:49:00","2026-01-06 11:49:34",{"id":307,"category_id":44,"title":308,"keywords":6,"description":309,"image_url":6,"url":310,"hits":311,"is_recommend":73,"is_top":73,"create_time":312,"update_time":313},117,"GitOps 落地实践：ArgoCD + Kustomize 实现声明式基础设施管理(一)","一、概述1.1 背景介绍GitOps 作为云原生时代的运维范式，将 Git 作为基础设施和应用配置的单一事实来源，通过声明式配置和自动化同步机制，实现了配置管理的版本控制、审计追溯和快速回滚。ArgoCD 作为 CNCF 毕业项目，提供了完整的 GitOps 工作流，支持多集群管理、RBAC 权限控制、SSO 集成等企业级特性。结合 Kustomize 的配置管理能力，能够优雅地解决多环境配置差异、敏感信息管理、配置复用等问题。在传统的 CI/CD 流程中，往往由 CI 工具直接执行 kubec","/article/117",310,"2026-01-06 11:45:03","2026-01-06 11:48:56",{"id":315,"category_id":40,"title":316,"keywords":317,"description":318,"image_url":6,"url":319,"hits":320,"is_recommend":73,"is_top":73,"create_time":321,"update_time":322},116,"运维部门年度2025工作总结与2026工作规划应该如何写？","运维部门年度2025工作总结,2026工作规划","2025年，运维部在公司“数字化转型深化”战略引领下，以“稳定为基、效率为纲、安全为盾、创新为翼”为核心导向，全面支撑核心业务系统运行、推动技术架构迭代、强化团队能力建设。 全年实现核心业务系统可用性99.985%，较2024年提升0.02个百分点；故障平均恢复时间（MTTR）从42分钟压缩至29分钟，下降31%；云资源成本同比降低16.8%，自动化运维覆盖率从65%提升至83%，未发生重大生产安全事故，圆满完成年度目标。现将全年工作及2026年规划汇报如下：2025年核心工作成果（数","/article/116",297,"2026-01-06 11:20:58","2026-01-06 11:44:04",{"id":324,"category_id":40,"title":325,"keywords":326,"description":327,"image_url":6,"url":328,"hits":329,"is_recommend":73,"is_top":73,"create_time":330,"update_time":331},115,"Kubernetes 100个常用命令","100 个 Kubectl 命令","这篇文章是关于使用 Kubectl 进行 Kubernetes 诊断的指南。列出了 100 个 Kubectl 命令，这些命令对于诊断 Kubernetes 集群中的问题非常有用。这些问题包括但不限于：•&nbsp;集群信息•&nbsp;Pod 诊断•&nbsp;服务诊断•&nbsp;部署诊断•&nbsp;网络诊断•&nbsp;持久卷和持久卷声明诊断•&nbsp;资源使用情况•&nbsp;安全和授权•&nbsp;节点故障排除•&nbsp;其他诊断命令：文章还提到了许多其他命令，如资源扩展和自动扩","/article/115",3642,"2023-11-02 14:09:30","2023-11-02 14:10:05",{"id":178,"category_id":44,"title":179,"keywords":180,"description":181,"image_url":6,"url":182,"hits":183,"is_recommend":73,"is_top":73,"create_time":184,"update_time":185},1784716028641]