{"id":5408,"date":"2020-07-30T00:27:37","date_gmt":"2020-07-29T16:27:37","guid":{"rendered":"http:\/\/39.97.231.10\/?p=5408"},"modified":"2020-07-30T00:27:37","modified_gmt":"2020-07-29T16:27:37","slug":"%e5%a6%82%e4%bd%95%e5%bc%80%e5%8f%91%e4%b8%80%e4%b8%aa%e8%87%aa%e5%ae%9a%e4%b9%89%e7%9a%84mysql%e6%8f%92%e4%bb%b6-2","status":"publish","type":"post","link":"http:\/\/www.weijing.co\/?p=5408","title":{"rendered":"\u5982\u4f55\u5f00\u53d1\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684MySQL\u63d2\u4ef6"},"content":{"rendered":"<div>\n<div>\n<span style=\\\"font-size: 1rem;\\\">MySQL\u81ea\u5e26\u4e86\u5f88\u591a\u63d2\u4ef6\uff0c\u6bd4\u5982\u534a\u540c\u6b65\u63d2\u4ef6\u3001\u5ba1\u8ba1\u63d2\u4ef6\u3001\u5bc6\u7801\u9a8c\u8bc1\u63d2\u4ef6\u7b49\u7b49\uff0c\u751a\u81f3MySQL\u5b58\u50a8\u5f15\u64ce\u4e5f\u662f\u4ee5\u63d2\u4ef6\u65b9\u5f0f\u5b9e\u73b0\u7684\u3002MySQL\u5f00\u653e\u7684\u63d2\u4ef6\u63a5\u53e3\uff0c\u4e3a\u5f00\u53d1\u8005\u5f00\u53d1\u81ea\u5b9a\u4e49\u63d2\u4ef6\u63d0\u4f9b\u4e86\u4fbf\u5229\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5feb\u901f\u5f00\u53d1\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684MySQL\u63d2\u4ef6\u3002<\/span>\n<\/div>\n<\/div>\n<div>\n<h4>\u4e00\u3001\u5f00\u53d1\u73af\u5883\u51c6\u5907<\/h4>\n<ol>\n<li>\u4e0b\u8f7dMySQL\u6e90\u7801\uff0c\u672c\u6587\u4f7f\u7528\u7684\u6e90\u7801\u662f Percona Server for MySQL 5.7.19\u3002<\/li>\n<li>\u5b89\u88c5C\/C++\u5f00\u53d1\u73af\u5883\u3001\u4f9d\u8d56\u5305\u7b49\u3002<\/li>\n<li>\u7f16\u8bd1MySQL\u6e90\u7801\uff0c\u4fdd\u8bc1\u5728\u5f00\u53d1\u81ea\u5b9a\u4e49\u63d2\u4ef6\u524d\uff0cMySQL\u6e90\u7801\u80fd\u591f\u88ab\u6b63\u5e38\u7f16\u8bd1\u3002<\/li>\n<\/ol>\n<h4>\u4e8c\u3001\u81ea\u5b9a\u4e49\u63d2\u4ef6my_plugin<\/h4>\n<p>MySQL\u6e90\u7801\u4e2d\u5305\u542b\u4e86\u63d2\u4ef6\u5f00\u53d1\u7684\u4f8b\u5b50\uff0c\u5728\u6e90\u7801\u76ee\u5f55plugin\/daemon_example\uff0c\u8be5\u4f8b\u5b50\u5b9e\u73b0\u7684\u662f\u6bcf\u96945\u79d2\u5411\u6570\u636e\u76ee\u5f55\u7684mysql-heartbeat.log\u6587\u4ef6\u4e2d\u5199\u5165\u5fc3\u8df3\u65f6\u95f4\u6233\uff0c\u5982\u4e0b\uff1a<br \/>\nStarting up at 190809 2:30:26<br \/>\nHeartbeat at 190809 2:30:31<br \/>\nHeartbeat at 190809 2:30:36<br \/>\nHeartbeat at 190809 2:30:41<br \/>\nHeartbeat at 190809 2:30:36<br \/>\nHeartbeat at 190809 2:30:51<br \/>\nShutting down at 190809 2:30:53<br \/>\n\u4ee5daemon_example\u4e3a\u57fa\u7840\uff0c\u5f00\u53d1\u81ea\u5b9a\u4e49\u63d2\u4ef6\u3002\u62f7\u8d1ddaemon_example\u76ee\u5f55\u6539\u540d\u4e3amy_plugin\uff0c\u4f9d\u6b21\u4fee\u6539my_plugin\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\uff0c\u628adaemon_example\u4fee\u6539\u4e3amy_plugin\u3002<\/p>\n<ul>\n<li>my_plugin\/CMakeLists.txt<\/li>\n<li>my_plugin\/my_plugin.cc\uff08daemon_example.cc\u4fee\u6539\u4e3amy_plugin.cc\uff09<\/li>\n<li>my_plugin\/my_plugin.ini\uff08daemon_example.ini\u4fee\u6539\u4e3amy_plugin.ini\uff09<\/li>\n<\/ul>\n<p>\u4e3a\u4e86\u4e0edaemon_example\u6709\u70b9\u533a\u522b\uff0c\u6211\u4eec\u4fee\u6539my_plugin.cc\u6587\u4ef6\uff0c\u4e3b\u8981\u4fee\u6539\u70b9\u5982\u4e0b\uff1a<br \/>\n1. mysql_declare_plugin\uff0c\u4fee\u6539\u63d2\u4ef6\u540d\u79f0\uff0c\u4f5c\u8005\u3002<br \/>\n2. mysql-heartbeat.log \u65e5\u5fd7\u540d\u79f0\u4fee\u6539\u4e3a my_plugin.log\u3002<br \/>\n3. \u5fc3\u8df3\u95f4\u9694\u65f6\u95f4\u75315\u79d2\u8c03\u6574\u4e3a60\u79d2\u3002<\/p>\n<h4>\u4e09\u3001\u7f16\u8bd1\u81ea\u5b9a\u4e49\u63d2\u4ef6<\/h4>\n<p>\u6309\u7167\u6b65\u9aa4\u4e00\u7f16\u8bd1MySQL\u6e90\u7801\u7684\u65b9\u5f0f\uff0c\u518d\u6b21\u7f16\u8bd1\u4e00\u6b21\u3002\u7f16\u8bd1\u6210\u529f\u7684\u8bdd\uff0c\u4f1a\u5728plugin\/my_plugin\u751f\u6210\u63d2\u4ef6my_plugin.so<\/p>\n<h4>\u56db\u3001\u5b89\u88c5\u53ca\u5378\u8f7d\u81ea\u5b9a\u4e49\u63d2\u4ef6<\/h4>\n<p>\u4f7f\u7528\u7f16\u8bd1\u597d\u7684MySQL\u4e8c\u8fdb\u5236\u7a0b\u5e8f\u521d\u59cb\u5316\u6570\u636e\u5e93\uff0c\u542f\u52a8\u6570\u636e\u5e93\uff0c\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff0c\u6267\u884c\u5b89\u88c5\u548c\u5378\u8f7d\u63d2\u4ef6\u7684\u547d\u4ee4\uff0c\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li>\u5b89\u88c5\uff1aINSTALL PLUGIN my_plugin SONAME \\&#8217;my_plugin.so\\&#8217;;<\/li>\n<li>\u5378\u8f7d\uff1aUNINSTALL PLUGIN my_plugin;<\/li>\n<\/ul>\n<p>mysql.plugin \u8868\u8bb0\u5f55\u4e86\u5df2\u7ecf\u5b89\u88c5\u7684\u63d2\u4ef6\uff0c\u901a\u8fc7\u6267\u884cSQL\uff1aselect * from mysql.plugin; \u6765\u83b7\u53d6\u5df2\u5b89\u88c5\u7684\u63d2\u4ef6\u3002<br \/>\nmysql.plugin\u7cfb\u7edf\u8868\u8bb0\u5f55\u7684\u63d2\u4ef6\u5fc5\u987b\u662f\u901a\u8fc7install plugin\u8bed\u53e5\u6765\u5b89\u88c5\u7684\uff0c\u901a\u8fc7 &#8211;plugin-load\u65b9\u5f0f\u5b89\u88c5\u7684\u63d2\u4ef6\uff0c\u4e0d\u4f1a\u8bb0\u5f55\u5230mysql.plugin\u8868\u4e2d\u3002<br \/>\n\u5728\u6570\u636e\u76ee\u5f55\uff0c\u53ef\u4ee5\u67e5\u770b\u5fc3\u8df3\u65e5\u5fd7\u6587\u4ef6my_plugin.log\u662f\u5426\u5b58\u5728\uff0c\u91cc\u9762\u7684\u5fc3\u8df3\u65e5\u5fd7\uff0c\u662f\u5426\u6bcf\u969460\u79d2\u6253\u5370\u4e00\u6b21\uff0c\u5982\u4e0b\uff1a<br \/>\nStarting up at 190809 4:07:52<br \/>\nHeartbeat at 190809 4:08:52<br \/>\nHeartbeat at 190809 4:09:52<br \/>\nHeartbeat at 190809 4:10:52<br \/>\nHeartbeat at 190809 4:11:52<br \/>\nHeartbeat at 190809 4:12:52<br \/>\nShutting down at 190809 4:12:55<\/p>\n<h4>\u4e94\u3001\u6269\u5c55\u63d2\u4ef6\u529f\u80fd<\/h4>\n<p>my_plugin\u63d2\u4ef6\u867d\u7136\u53ea\u662f\u4e00\u4e2a\u6ca1\u6709\u4efb\u4f55\u5b9e\u9645\u529f\u80fd\u7684MySQL\u63d2\u4ef6\uff0c\u4f46\u662f\u53ef\u4ee5\u5728\u6b64\u57fa\u7840\u4e0a\uff0c\u6dfb\u52a0\u66f4\u591a\u7684\u5b9e\u7528\u529f\u80fd\uff0c\u6bd4\u5982\u8bb0\u5f55\u6bcf\u4e2aSQL\u7684\u6267\u884c\u6b21\u6570\uff0c\u6700\u4f4e\u6267\u884c\u65f6\u95f4\uff0c\u6700\u9ad8\u6267\u884c\u65f6\u95f4\u7b49\u7b49\u3002\u5f53\u7136\u8fd9\u4e9b\u9700\u8981\u5bf9MySQL\u6e90\u7801\u8fdb\u4e00\u6b65\u719f\u6089\u7684\u57fa\u7840\u4e0a\uff0c\u624d\u80fd\u8fdb\u884c\u66f4\u5f3a\u5927\u529f\u80fd\u7684\u5f00\u53d1\u3002\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>MySQL\u81ea\u5e26\u4e86\u5f88\u591a\u63d2\u4ef6\uff0c\u6bd4\u5982\u534a\u540c\u6b65\u63d2\u4ef6\u3001\u5ba1\u8ba1\u63d2\u4ef6\u3001\u5bc6\u7801\u9a8c\u8bc1\u63d2\u4ef6\u7b49\u7b49\uff0c\u751a\u81f3MySQL\u5b58\u50a8\u5f15\u64ce\u4e5f\u662f\u4ee5\u63d2\u4ef6\u65b9\u5f0f\u5b9e\u73b0 &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"http:\/\/www.weijing.co\/?p=5408\"> <span class=\"screen-reader-text\">\u5982\u4f55\u5f00\u53d1\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684MySQL\u63d2\u4ef6<\/span> \u67e5\u770b\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":""},"categories":[90,88],"tags":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"mailpoet_newsletter_max":false,"woocommerce_thumbnail":false,"woocommerce_single":false,"woocommerce_gallery_thumbnail":false,"shop_catalog":false,"shop_single":false,"shop_thumbnail":false},"uagb_author_info":{"display_name":"weijing","author_link":"http:\/\/www.weijing.co\/?author=4"},"uagb_comment_info":1,"uagb_excerpt":"MySQL\u81ea\u5e26\u4e86\u5f88\u591a\u63d2\u4ef6\uff0c\u6bd4\u5982\u534a\u540c\u6b65\u63d2\u4ef6\u3001\u5ba1\u8ba1\u63d2\u4ef6\u3001\u5bc6\u7801\u9a8c\u8bc1\u63d2\u4ef6\u7b49\u7b49\uff0c\u751a\u81f3MySQL\u5b58\u50a8\u5f15\u64ce\u4e5f\u662f\u4ee5\u63d2\u4ef6\u65b9\u5f0f\u5b9e\u73b0&hellip;","_links":{"self":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/5408"}],"collection":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5408"}],"version-history":[{"count":0,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/5408\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5408"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}