{"id":2307,"date":"2021-04-09T11:42:03","date_gmt":"2021-04-09T03:42:03","guid":{"rendered":"http:\/\/localhost\/bpoint\/?p=2307"},"modified":"2021-04-09T12:45:45","modified_gmt":"2021-04-09T04:45:45","slug":"%e8%b3%87%e6%96%99%e5%ba%ab%e4%b8%bb%e5%be%9e%e9%85%8d%e7%bd%ae%e8%a8%ad%e5%ae%9a","status":"publish","type":"post","link":"https:\/\/bpoint.space\/?p=2307","title":{"rendered":"\u8cc7\u6599\u5eab\u4e3b\u5f9e\u914d\u7f6e\u8a2d\u5b9a"},"content":{"rendered":"<p>\u5927\u5bb6\u597d\uff0c\u9019\u6b21\u8981\u4f86\u5206\u4eab\u95dc\u65bc\u8cc7\u6599\u5eab\u4e3b\u5f9e\u8907\u88fd\u7684\u8a2d\u5b9a<\/p>\n<p>\u4f7f\u7528\u7684\u74b0\u5883\u662f\uff0c\u4f5c\u696d\u7cfb\u7d71\u4f7f\u7528Ubuntu 20.10\uff0c\u8cc7\u6599\u5eab\u4f7f\u7528Maribdb 10.3.25<br \/>\n\u5148\u8a2d\u5b9a\u4e3b(master)\u4f3a\u670d\u5668<\/p>\n<p>\u7b2c\u4e00\u6b65\uff1a\u5148\u6539\u8a2d\u5b9a\u6a94<\/p>\n<p>sudo vim \/etc\/mysql\/mariadb.conf.d\/50-server.cnf<\/p>\n<p>1..\u627e\u5230\u9019\u884c\uff0c\u8a3b\u89e3\u6389<\/p>\n<p>bind-address = 127.0.0.1<\/p>\n<p>2..\u627e\u5230\u9019\u884c\uff0c\u628a\u5f8c\u9762\u7684\u6578\u5b57\u6539\u6389\uff0c\u5169\u53f0(\u6216\u591a\u53f0)\u96fb\u8166\u8a18\u5f97\u4e0d\u8981\u8a2d\u4e00\u6a23\u5c31\u597d<br \/>\nserver-id = 1<\/p>\n<p>3..\u627e\u5230\u9019\u884c\uff0c\u4f7f\u5176\u751f\u6548<\/p>\n<p>log_bin = \/var\/log\/mysql\/mysql-bin.log<\/p>\n<p>4..\u91cd\u555fmaribdb<\/p>\n<p>\u7b2c\u4e8c\u6b65\uff1a\u9032\u5165\u8cc7\u6599\u5eab\uff0c\u8a2d\u5b9a\u6709\u6b0a\u9650\u7684\u4f7f\u7528\u8005<\/p>\n<p>1..\u9032\u5165\u8cc7\u6599\u5eab\uff0c\u65b0\u589e\u4f7f\u7528\u8005<br \/>\nsudo mysql -u root -p<br \/>\ncreate user XXX;<\/p>\n<p>2..\u7d66\u4e88\u4f7f\u7528\u8005\u6b0a\u9650<br \/>\ngrant replication slave on *.* to XXX@&#8217;%&#8217; identified by &#8216;AAAA&#8217;;<br \/>\n3..\u67e5\u770bmaster\u7684\u72c0\u614b\uff0c\u4e26\u5c07file\u8ddfposition\u7684\u8cc7\u6599\u8a18\u4e0b\u4f86<br \/>\nfile\uff1amysql-bin.000001<br \/>\nposition\uff1a001<br \/>\n\u518d\u4f86\u8a2d\u5b9a\u5f9e(slave)\u4f3a\u670d\u5668<\/p>\n<p>\u7b2c\u4e09\u6b65\uff1a\u5148\u6539\u8a2d\u5b9a\u6a94<\/p>\n<p>sudo vim \/etc\/mysql\/mariadb.conf.d\/50-server.cnf<\/p>\n<p>1..\u627e\u5230\u9019\u884c\uff0c\u8a3b\u89e3\u6389<\/p>\n<p>bind-address = 127.0.0.1<\/p>\n<p>2.. \u627e\u5230\u9019\u884c\uff0c\u628a\u5f8c\u9762\u7684\u6578\u5b57\u6539\u6389\uff0c\u5169\u53f0(\u6216\u591a\u53f0)\u96fb\u8166\u8a18\u5f97\u4e0d\u8981\u8a2d\u4e00\u6a23\u5c31\u597d<\/p>\n<p>server-id = 1<\/p>\n<p>3..\u627e\u5230\u9019\u884c\uff0c\u4f7f\u5176\u751f\u6548<br \/>\nlog_bin = \/var\/log\/mysql\/mysql-bin.log<\/p>\n<p>4.\u8a2d\u5b9a\u9023\u7dda\u8cc7\u8a0a<\/p>\n<p>change master to<br \/>\nmaster_host=&#8217;master IP&#8217;,<br \/>\nmaster_user=&#8217;XXX&#8217;,<br \/>\nmaster_password=&#8217;AAAA&#8217;,<br \/>\nmaster_log_file=&#8217;mysql-bin.000001&#8242;,<br \/>\nmaster_log_pos=001;<\/p>\n<p>5..\u555f\u52d5slave<br \/>\nstart slave;<\/p>\n<p>6..\u6aa2\u67e5slave\u72c0\u614b<br \/>\nshow slave status\\G;<\/p>\n<p>\u5982\u679c\u6709\u986f\u793a\u4e0b\u9762\u9019\u884c\uff0c\u4ee3\u8868\u9023\u7dda\u6210\u529f\uff0c\u53cd\u4e4b\uff0c\u6709\u932f\u8aa4\u4e5f\u6703\u986f\u793a<br \/>\nSlave_IO_State: Waiting for master to send event<\/p>\n<p>\u53c3\u8003\u4f86\u6e90\uff1ahttps:\/\/www.aiwalls.com\/mysql\/11\/31676.html<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5927\u5bb6\u597d\uff0c\u9019\u6b21\u8981\u4f86\u5206\u4eab\u95dc\u65bc\u8cc7\u6599\u5eab\u4e3b\u5f9e\u8907\u88fd\u7684\u8a2d\u5b9a \u4f7f\u7528\u7684\u74b0\u5883\u662f\uff0c\u4f5c\u696d\u7cfb\u7d71\u4f7f\u7528Ubuntu 20.10\uff0c\u8cc7\u6599\u5eab\u4f7f\u7528M [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-2307","post","type-post","status-publish","format-standard","hentry","category-36"],"_links":{"self":[{"href":"https:\/\/bpoint.space\/index.php?rest_route=\/wp\/v2\/posts\/2307","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bpoint.space\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bpoint.space\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bpoint.space\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/bpoint.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2307"}],"version-history":[{"count":0,"href":"https:\/\/bpoint.space\/index.php?rest_route=\/wp\/v2\/posts\/2307\/revisions"}],"wp:attachment":[{"href":"https:\/\/bpoint.space\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bpoint.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bpoint.space\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}