{"id":1074,"date":"2021-07-30T09:17:40","date_gmt":"2021-07-30T01:17:40","guid":{"rendered":"https:\/\/egonlin.com\/?p=1074"},"modified":"2022-04-26T13:35:46","modified_gmt":"2022-04-26T05:35:46","slug":"1074","status":"publish","type":"post","link":"https:\/\/egonlin.com\/?p=1074","title":{"rendered":"\u76d1\u63a7\u8fdc\u7a0bmysql\u670d\u52a1"},"content":{"rendered":"<h1>\u76d1\u63a7\u8fdc\u7a0bmysql\u670d\u52a1<\/h1>\n<h2>\u4e00\u3001\u88ab\u76d1\u63a7\u70b9\u90e8\u7f72mysql_exporter<\/h2>\n<h3>1\u3001\u4e0b\u8f7d<\/h3>\n<pre><code class=\"language-bash\">[root@web02 \/opt]# wget https:\/\/github.com\/prometheus\/mysqld_exporter\/releases\/download\/v0.12.1\/mysqld_exporter-0.12.1.linux-amd64.tar.gz<\/code><\/pre>\n<h3>2\u3001\u89e3\u538b<\/h3>\n<pre><code class=\"language-bash\">[root@web02 \/opt]# mkdir \/prometheus_mysql\/\n[root@web02 \/opt]# tar xf mysqld_exporter-0.12.1.linux-amd64.tar.gz -C \/prometheus_mysql\/\n[root@web02 \/opt]# cd \/prometheus_mysql\/\n[root@web02 \/prometheus_mysql]# mv mysqld_exporter-0.12.1.linux-amd64\/* .\/\n[root@web02 \/prometheus_mysql]# rm -rf mysqld_exporter-0.12.1.linux-amd64\/<\/code><\/pre>\n<h3>3\u3001mysql\u521b\u5efa\u76d1\u63a7\u7528\u6237\u5e76\u6388\u6743<\/h3>\n<pre><code class=\"language-bash\"># 8.0\u4e4b\u524d\n grant select,replication client,process ON *.* to &#039;mysql_monitor&#039;@&#039;localhost&#039; identified by &#039;abc123&#039;;\n\n# 8.0\u4e4b\u540e\ncreate user &#039;mysql_monitor&#039;@&#039;localhost&#039; identified by &#039;abc123&#039;;\n grant select,replication client,process ON *.* to &#039;mysql_monitor&#039;@&#039;localhost&#039;;\n\n#\u5237\u65b0\u6743\u9650\nflush privileges;\n\n# (\u6ce8\u610f:\u6388\u6743ip\u4e3alocalhost\uff0c\u56e0\u4e3a\u4e0d\u662fprometheus\u670d\u52a1\u5668\u6765\u76f4\u63a5\u627emariadb \u83b7\u53d6\u6570\u636e\uff0c\u2f7d\u662fprometheus\u670d\u52a1\u5668\u627emysql_exporter,mysql_exporter \u518d\u627emariadb\u3002\u6240\u4ee5\u8fd9\u4e2alocalhost\u662f\u6307\u7684mysql_exporter\u7684IP)<\/code><\/pre>\n<h3>4\u3001\u521b\u5efa\u5ba2\u6237\u7aef\u914d\u7f6e\u6587\u4ef6<\/h3>\n<p><\/p><div id=\"rml_readmorelogin_placeholder\" style=\"position:relative;\"><div id=\"rml_fade_content\" style=\"position: absolute;\r\ntop:-10em;\r\nwidth:100%;\r\nheight:10em;\r\nbackground: -webkit-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -moz-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -o-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -ms-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\"><\/div><div class=\"wpf-controller aru_rml_from_in_post\" style=\"background-color:#eeeeee;border:5px solid #cce6ff;\" id=\"ARU_ReadMoreLogin_ReadMoreLoginController\"><h2 id=\"Header\">\u67e5\u770b\u66f4\u591a<\/h2><div id=\"Message\"><p>\u8054\u7cfb\u7ba1\u7406\u5458\u5fae\u4fe1tutu19192010\uff0c\u6ce8\u518c\u8d26\u53f7<\/p>\n<\/div><div id=\"StatusBarHeader\"><\/div><form id=\"ARU_ReadMoreLogin_ReadMoreLoginController\"><input name=\"post_id\" value=\"1074\" type=\"hidden\"\/><input name=\"_init_callback\" value=\"InitLogin\" type=\"hidden\"\/><input name=\"post_id\" value=\"1074\" type=\"hidden\"\/><input name=\"rt_ype\" value=\"1\" type=\"hidden\"\/><input name=\"nonce\" value=\"47ac7922f9\" type=\"hidden\"\/><input name=\"_wpnonce\" value=\"2d1dcda414\" type=\"hidden\"\/><input name=\"_controller\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginController\" type=\"hidden\"\/><input name=\"_proxy_controller\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginController\" type=\"hidden\"\/><input name=\"_view\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginView\" type=\"hidden\"\/><table class=\"wpf-table-placeholder\"><tbody class=\"wpf-table-placeholder\"><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\" width=\"400px\"><table class=\"wpf-table-placeholder\"><tbody class=\"wpf-table-placeholder\"><tr class=\"wpf-table-placeholder\"><th class=\"wpf-table-placeholder-input\"><label class=\"wpf-label\">Username:<\/label><\/th><\/tr><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\"><input class=\"regular-text text_input\" name=\"username\" value=\"\" type=\"text\"\/><\/td><\/tr><tr class=\"wpf-table-placeholder\"><th class=\"wpf-table-placeholder-input\"><label class=\"wpf-label\">Password:<\/label><\/th><\/tr><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\"><input class=\"regular-text text_input\" name=\"password\" value=\"\" type=\"password\"\/><\/td><\/tr><\/tbody><\/table><p class=\"wpf-table-placeholder submit\"><button class=\"wp_plugin_framework_ajax_button\" type=\"button\" style=\"background-color:#4D90FE;;color:#ffffff;;border:1px solid #3079ed;\" name=\"_event\" value=\"ButtonLogin\">Log in<\/button><\/p><\/td><td class=\"wpf-table-placeholder-input\"><\/td><\/tr><\/tbody><\/table><\/form><div id=\"ButtonStartRegister\"><a href=\"https:\/\/egonlin.com\/wp-login.php?action=register\">Register<\/a><\/div><div id=\"Link1\"><a href=\"https:\/\/egonlin.com\/wp-login.php?action=lostpassword\">Forgotten username or password?<\/a><\/div><div id=\"StatusBarFooter\"><\/div><\/div><\/div><div id=aru_remaining_content><\/div>","protected":false},"excerpt":{"rendered":"<p>\u76d1\u63a7\u8fdc\u7a0bmysql\u670d\u52a1 \u4e00\u3001\u88ab\u76d1\u63a7\u70b9\u90e8\u7f72mysql_exporter 1\u3001\u4e0b\u8f7d [root@web02 \/op [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":1076,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[140],"tags":[21,133,135,147,132,100,118,20],"_links":{"self":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/1074"}],"collection":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1074"}],"version-history":[{"count":0,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/1074\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/media\/1076"}],"wp:attachment":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1074"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1074"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1074"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}