{"id":2577,"date":"2021-10-14T16:21:24","date_gmt":"2021-10-14T23:21:24","guid":{"rendered":"https:\/\/www.xh86.me\/?p=2577"},"modified":"2021-10-14T16:21:24","modified_gmt":"2021-10-14T23:21:24","slug":"mysql-%e6%95%b0%e6%8d%ae%e5%ba%93%e8%af%bb%e5%86%99%e5%88%86%e7%a6%bb","status":"publish","type":"post","link":"https:\/\/www.xh86.me\/?p=2577","title":{"rendered":"MySQL \u6570\u636e\u5e93\u8bfb\u5199\u5206\u79bb"},"content":{"rendered":"<h3>MySQL \u914d\u7f6e\u4e3b\u5907\u6a21\u5f0f<\/h3>\n<p>\u57fa\u4e8e\u4e00\u53f0\u670d\u52a1\u5668\u7684\u6570\u636e\u590d\u5236,\u6545\u5f97\u540d\u5355\u673a\u70ed\u5907,\u4e3b-\u5907 Active-Standby<br \/>\n\u4e3b-\u5907\u65b9\u5f0f,\u5373\u6307\u7684\u662f\u4e00\u53f0\u670d\u52a1\u5668\u5904\u4e8e\u67d0\u79cd\u4e1a\u52a1\u7684\u6fc0\u6d3b\u72b6\u6001(\u5373Active\u72b6\u6001),\u53e6\u4e00\u53f0\u670d\u52a1\u5668\u5904\u4e8e\u8be5\u4e1a\u52a1\u7684\u5907\u7528\u72b6\u6001(\u5373Standby\u72b6\u6001),\u4e3b\u6570\u636e\u5e93\u6570\u636e\u66f4\u65b0\u540e,\u5907\u4efd\u670d\u52a1\u5668\u540c\u6b65\u6570\u636e\u53ea\u672c\u673a<\/p>\n<p><strong>\u4e24\u53f0\u540c\u6b65\u6267\u884c:<\/strong>\u00a0\u5b89\u88c5Mariadb,\u8bbe\u7f6e\u521d\u59cb\u5bc6\u7801,\u542f\u52a8\u670d\u52a1,\u5e76\u8bbe\u7f6e\u5f00\u673a\u81ea\u542f\u52a8,\u8fd9\u91cc\u7684\u914d\u7f6e\u6b65\u9aa4\u5e94\u5728\u4e24\u53f0\u4e3b\u673a\u4e0a\u540c\u6b65\u6267\u884c<\/p>\n<p>yum install -y mariadb mariadb-server<\/p>\n<p>systemctl restart mariadb<\/p>\n<p>mysql_secure_installation<\/p>\n<p>\u4fee\u6539MariaDB\u4e3b\u914d\u7f6e\u6587\u4ef6,\u5199\u5165log-bin\u53c2\u6570\u5f00\u542f\u4e8c\u8fdb\u5236\u65e5\u5fd7\u6587\u4ef6,\u7136\u540e\u5199\u5165server-id\u6307\u5b9a\u672c\u53f0MariaDB\u670d\u52a1\u5668\u7684ID\u53f7(\u6ce8\u610f\uff1a\u8fd9\u91cc\u4e3b\u4ece\u4e0d\u8981\u91cd\u590d)<\/p>\n<p>vim \/etc\/my.cnf<\/p>\n<p>[mysqld]<\/p>\n<p>log-bin=mysql-bin #\u5f00\u542f\u4e8c\u8fdb\u5236\u65e5\u5fd7\u6587\u4ef6<\/p>\n<p>server-id=12 #\u672c\u53f0MySQL\u670d\u52a1\u5668ID(\u4e3b\u4ece\u4e0d\u80fd\u91cd\u590d)<\/p>\n<p>systemctl restart mariadb #\u91cd\u542f\u751f\u6548<\/p>\n<p><strong>\u4e3b\u6570\u636e\u5e93\u6267\u884c:<\/strong>\u00a0\u8fdb\u5165\u4e3bMariaDB\u6570\u636e\u5e93,\u6388\u6743\u7ed9\u4ece\u6570\u636e\u5e93\u767b\u9646\u7684\u8d26\u53f7,\u8fd9\u91cc\u663e\u793a\u4e8c\u8fdb\u5236\u65e5\u5fd7\u6587\u4ef6\u5927\u5c0f\u5e76\u8bb0\u5f55\u4e0b\u6765<\/p>\n<p>grant replication slave on *.* to &#8220;\u7528\u6237\u540d&#8221;@&#8217;%&#8217; identified by &#8220;\u5bc6\u7801&#8221;; #\u521b\u5efa\u7528\u4e8e\u4ece\u670d\u52a1\u5668\u767b\u9646\u7684\u8d26\u53f7<\/p>\n<p>show master status; #\u663e\u793a\u65e5\u5fd7\u72b6\u6001<\/p>\n<p>MariaDB [(none)]&gt; show master status;<\/p>\n<p>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<\/p>\n<p>| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |<\/p>\n<p>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<\/p>\n<p>| mysql-bin.000002 | 245 | | |<\/p>\n<p>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<\/p>\n<p>row in set (0.00 sec)<\/p>\n<p><strong>\u4ece\u6570\u636e\u5e93\u6267\u884c:<\/strong>\u00a0\u8fdb\u5165\u4eceMariaDB\u6570\u636e\u5e93,\u4f7f\u7528\u4e3b\u6570\u636e\u5e93\u6388\u6743\u7684\u7528\u6237\u540d,\u5bc6\u7801,\u4ee5\u53ca\u76f8\u5e94\u7684\u65e5\u5fd7\u6587\u4ef6\u540d\u79f0 master_log_file,\u548c\u65e5\u5fd7\u6587\u4ef6\u4f4d\u7f6e master_log_pos,\u6b64\u5904\u5728\u4e3b\u6570\u636e\u5e93\u4e0a\u83b7\u53d6\u5373\u53ef<\/p>\n<p>change master to master_host=&#8217;\u670d\u52a1\u5668IP&#8217;,master_user=&#8217;\u6388\u6743\u8d26\u53f7&#8217;,master_password=&#8217;\u5bc6\u7801&#8217;,master_log_file=&#8217;\u65e5\u5fd7\u6587\u4ef6&#8217;,master_log_pos=\u6587\u4ef6\u4f4d\u7f6e;<\/p>\n<p>start slave; #\u542f\u7528\u540c\u6b65<\/p>\n<p>show slave status\\G; #\u67e5\u770b\u540c\u6b65\u72b6\u6001<\/p>\n<p>\u6ce8\u610f\uff1a\u4e24\u4e2a\u72b6\u6001\u540c\u65f6\u5f00\u542f\u5373\u53ef<\/p>\n<p>Slave_IO_Running: Yes<\/p>\n<p>Slave_SQL_Running: Yes<\/p>\n<p>&nbsp;<\/p>\n<h3>MySQL \u914d\u7f6e\u4e3b\u4e3b\u6a21\u5f0f<\/h3>\n<p>\u57fa\u4e8e\u4e24\u53f0\u670d\u52a1\u5668\u7684\u590d\u5236\u65b9\u5f0f\u8f83\u591a,\u6545\u5f97\u540d\u53cc\u673a\u70ed\u5907,\u53cc\u4e3b\u673a\u65b9\u5f0f\u5373\u6307\u4e24\u79cd\u4e0d\u540c\u4e1a\u52a1\u5206\u522b\u5728\u4e24\u53f0\u670d\u52a1\u5668\u4e0a\u4e92\u4e3a\u4e3b\u5907\u72b6\u6001(\u5373 Active-Standby\u548cStandby-Active\u72b6\u6001),\u8fd9\u91cc\u9700\u8981\u6ce8\u610f\u7684\u662f\u4e3b-\u4e3b\u540c\u6b65\u914d\u7f6e,\u5176\u5b9e\u5c31\u662f\u4e24\u53f0MariaDB\u6570\u636e\u5e93\u4e92\u4e3a\u4e3b\u4ece,\u6240\u4ee5,\u8981\u5728\u4e24\u53f0\u4e3b\u673a\u95f4\u4f5c\u4e24\u6b21\u76f8\u540c\u7684\u64cd\u4f5c<\/p>\n<p><strong>\u4e24\u53f0\u540c\u6b65\u6267\u884c:<\/strong>\u00a0\u5b89\u88c5MariaDB,\u8bbe\u7f6e\u521d\u59cb\u5bc6\u7801,\u542f\u52a8\u670d\u52a1,\u5e76\u8bbe\u7f6e\u5f00\u673a\u81ea\u542f\u52a8,\u8fd9\u91cc\u7684\u914d\u7f6e\u6b65\u9aa4\u5e94\u5728\u4e24\u53f0\u4e3b\u673a\u4e0a\u540c\u6b65\u6267\u884c<\/p>\n<p>yum install -y mariadb mariadb-server<\/p>\n<p>systemctl restart mariadb<\/p>\n<p>mysql_secure_installation<\/p>\n<p>\u5c06MariaDB1\u7684\u6570\u636e\u62f7\u8d1d\u5230MariaDB2\u4e0a,\u5b9e\u73b0\u6570\u636e\u7684\u4e00\u81f4\u6027,(\u6ce8\u610f\uff1a\u8fd9\u91cc\u5e94\u5148\u9501\u5b9a\u8868\u7ed3\u6784,\u9632\u6b62\u6570\u636e\u4e0d\u4e00\u81f4)<\/p>\n<p>flush tables with read lock; #\u9501\u5b9a\u6570\u636e\u8868\u4e3a\u53ea\u8bfb\u6a21\u5f0f<\/p>\n<p>mysqldump -u root -p &#8211;all-databases &gt;back.sql #\u5907\u4efd\u6570\u636e\u5e93<\/p>\n<p>scp back.sql root@192.168.1.13:\/root #\u5c06\u6570\u636e\u4f20\u9012\u5230\u8fdc\u7a0b\u4e3b\u673a<\/p>\n<p>unlock tables; #\u89e3\u9664\u8868\u9501\u5b9a<\/p>\n<p>mysql -uroot -p &lt;back.sql #\u4ece\u6570\u636e\u5e93\u6062\u590d\u6570\u636e<\/p>\n<p>\u4fee\u6539MariaDB\u4e3b\u914d\u7f6e\u6587\u4ef6(\u6ce8\u610f\uff1a\u4e24\u53f0\u90fd\u8981\u4fee\u6539),\u5f00\u542f\u4e8c\u8fdb\u5236\u65e5\u5fd7\u548c\u5236\u5b9a\u670d\u52a1\u5668ID\u53f7<\/p>\n<p>vim \/etc\/my.cnf<\/p>\n<p>[mysqld]<\/p>\n<p>log-bin=mysql-bin #\u5f00\u542f\u4e8c\u8fdb\u5236\u65e5\u5fd7<\/p>\n<p>server-id=10 #\u6307\u5b9a\u670d\u52a1\u5668ID\u53f7(\u4e24\u53f0\u4e0d\u5141\u8bb8\u91cd\u590d)<\/p>\n<p>replicate-do-db=test #\u8981\u540c\u6b65\u7684\u6570\u636e\u5e93<\/p>\n<p>binlog-ignore-db=mysql #\u4e0d\u9700\u8981\u540c\u6b65\u7684\u6570\u636e\u5e93<\/p>\n<p>binlog-ignore-db=information_schema #\u4e0d\u9700\u8981\u540c\u6b65\u7684\u6570\u636e\u5e93<\/p>\n<p>auto-increment-increment=2 #\u6bcf\u6b21\u81ea\u589e\u957f2<\/p>\n<p>auto-increment-offset=1 #\u81ea\u589e\u957f\u4ece1\u5f00\u59cb<\/p>\n<p>systemctl restart mariadb<\/p>\n<p><strong>MySQL1\u6267\u884c:<\/strong>\u00a0\u8fdb\u5165 MariaDB1 \u6570\u636e\u5e93,\u521b\u5efa\u7528\u4e8e\u4ece\u6570\u636e\u5e93\u767b\u9646\u7684\u8d26\u53f7\u548c\u5bc6\u7801<\/p>\n<p>grant replication slave on *.* to &#8216;\u7528\u6237\u540d&#8217;@&#8217;%&#8217; identified by &#8216;\u5bc6\u7801&#8217;; #\u521b\u5efa\u7528\u4e8e\u4ece\u6570\u636e\u5e93\u767b\u9646\u7684\u7528\u6237<\/p>\n<p>show master status; #\u67e5\u770b\u4e8c\u8fdb\u5236\u6587\u4ef6\u540d<\/p>\n<p>\u8fdb\u5165 MariaDB2 \u6570\u636e\u5e93,\u540c\u6b65\u6570\u636e<\/p>\n<p>change master to master_host=&#8217;\u4e3b\u670d\u52a1\u5668IP&#8217;,master_user=&#8217;\u6388\u6743\u8d26\u53f7&#8217;,master_password=&#8217;\u5bc6\u7801&#8217;,master_log_file=&#8217;\u4e8c\u8fdb\u5236\u6587\u540d&#8217;,master_log_pos=\u6587\u4ef6\u7a7a\u95f4\u5927\u5c0f;<\/p>\n<p>start slave; #\u542f\u52a8\u540c\u6b65\u529f\u80fd<\/p>\n<p>show slave status\\G; #\u67e5\u770b\u540c\u6b65\u72b6\u6001<\/p>\n<p><strong>MySQL2\u6267\u884c:<\/strong>\u00a0\u8fdb\u5165 MariaDB2 \u6570\u636e\u5e93,\u521b\u5efa\u7528\u4e8e\u4ece\u6570\u636e\u5e93\u767b\u9646\u7684\u8d26\u53f7\u548c\u5bc6\u7801<\/p>\n<p>grant replication slave on *.* to &#8216;\u7528\u6237\u540d&#8217;@&#8217;%&#8217; identified by &#8216;\u5bc6\u7801&#8217;; #\u521b\u5efa\u7528\u4e8e\u4ece\u6570\u636e\u5e93\u767b\u9646\u7684\u7528\u6237<\/p>\n<p>show master status; #\u67e5\u770b\u4e8c\u8fdb\u5236\u6587\u4ef6\u540d<\/p>\n<p>\u8fdb\u5165 MariaDB1 \u6570\u636e\u5e93,\u540c\u6b65\u6570\u636e<\/p>\n<p>change master to master_host=&#8217;\u4e3b\u670d\u52a1\u5668IP&#8217;,master_user=&#8217;\u6388\u6743\u8d26\u53f7&#8217;,master_password=&#8217;\u5bc6\u7801&#8217;,master_log_file=&#8217;\u4e8c\u8fdb\u5236\u6587\u540d&#8217;,master_log_pos=\u6587\u4ef6\u7a7a\u95f4\u5927\u5c0f;<\/p>\n<p>start slave; #\u542f\u52a8\u540c\u6b65\u529f\u80fd<\/p>\n<p>show slave status\\G; #\u67e5\u770b\u540c\u6b65\u72b6\u6001<\/p>\n<p>&nbsp;<\/p>\n<h3>MySQL \u914d\u7f6e\u4e3b\u4e3b\u4ece\u6a21\u5f0f<\/h3>\n<p>\u4e3b-\u4e3b-\u4ece,\u5b57\u9762\u610f\u601d\u5c31\u662f,\u4e24\u4e2a\u4e3b\u4e00\u4e2a\u4ece,\u4e3b\u8981\u7528\u4e8e\u6570\u636e\u5907\u4efd,\u4e00\u6b21\u6027\u5907\u4efd\u4e24\u4e2a\u4e3b\u6570\u636e\u5e93\u8d44\u6e90,\u8fd9\u6837\u4e00\u4e2a\u4ece\u6570\u636e\u5e93,\u5c31\u53ef\u4ee5\u540c\u65f6\u5907\u4efd\u591a\u4e2a\u4e3b\u6570\u636e\u5e93\u4e86,\u8282\u7ea6\u4e86\u5b9d\u8d35\u7684\u670d\u52a1\u5668\u8d44\u6e90<\/p>\n<p><strong>\u4e24\u53f0\u4e3b\u6570\u636e\u5e93\u6267\u884c:<\/strong>\u00a0\u4e24\u53f0\u4e3b\u670d\u52a1\u5668\u90fd\u9700\u8981\u5b89\u88c5MySQL\u521d\u59cb\u5316\u5e76\u8bbe\u7f6e\u5bc6\u7801<\/p>\n<p>yum install -y mariadb mariadb-server<\/p>\n<p>systemctl restart mariadb<\/p>\n<p>mysql_secure_installation<\/p>\n<p>\u4e24\u53f0\u4e3b\u670d\u52a1\u5668\u90fd\u5e94\u914d\u7f6e\u4ee5\u4e0b\u5185\u5bb9\uff08\u4e24\u53f0\u4e3bMySQL\u90fd\u9700\u8981\u914d\u7f6e\uff09<\/p>\n<p>vim \/etc\/my.cnf #\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/p>\n<p>\u5199\u5165\u4ee5\u4e0b\u5185\u5bb9\u2193<\/p>\n<p>log-bin=mysql-bin #\u5f00\u542f\u4e8c\u8fdb\u5236\u65e5\u5fd7<\/p>\n<p>server-id=147 #\u670d\u52a1\u5668ID\u53f7<\/p>\n<p>systemctl restart mariadb #\u91cd\u542f\u670d\u52a1<\/p>\n<p>\u767b\u9646\u4e3bMySQL\u5e76\u521b\u5efa\u7528\u6237\u4ece\u670d\u52a1\u5668\u767b\u9646\u7684\u7528\u6237 \uff08\u4e24\u53f0\u4e3bMySQL\u90fd\u9700\u8981\u914d\u7f6e\uff09<\/p>\n<p>mysql -uroot \u2013p #\u767b\u9646MySQL<\/p>\n<p>grant replication slave on *.* to &#8216;\u6388\u6743\u7528\u6237&#8217;@&#8217;%&#8217; identified by &#8216;\u5bc6\u7801&#8217;; #\u521b\u5efa\u4ece\u670d\u52a1\u5668\u7528\u6237<\/p>\n<p>show master status; #\u663e\u793a\u65e5\u5fd7\u72b6\u6001<\/p>\n<p><strong>\u4ece\u6570\u636e\u5e93\u6267\u884c:<\/strong>\u00a0\u5207\u8bb0\u4eceMariaDB\u6570\u636e\u5e93\u4e0d\u80fd\u542f\u52a8,\u4fee\u6539\u4eceMySQL\u4e3b\u914d\u7f6e\u6587\u4ef6<\/p>\n<p>vim \/etc\/my.cnf<\/p>\n<p>\u5199\u5165\u4ee5\u4e0b\u5185\u5bb9\u2193<\/p>\n<p>[mysqld_multi]<\/p>\n<p>mysqld=\/usr\/bin\/mysqld_safe<\/p>\n<p>mysqladmin=\/usr\/bin\/mysqladmin<\/p>\n<p>log=\/tmp\/multi.log<\/p>\n<p>[mysqld147] #\u540d\u79f0\u540e\u9762\u52a0\u6570\u5b57,\u540e\u671f\u542f\u52a8\u7528(\u4e0d\u5e94\u76f8\u540c)<\/p>\n<p>port=3306 #\u7aef\u53e3\u53f7(\u4e0d\u5e94\u76f8\u540c)<\/p>\n<p>pid-file=\/var\/lib\/mysqla\/mysqld.pid #MySQL\u8fdb\u7a0b\u53f7\u4fdd\u5b58\u4f4d\u7f6e<\/p>\n<p>datadir=\/var\/lib\/mysqla #\u6570\u636e\u6587\u4ef6\u4fdd\u5b58\u4f4d\u7f6e<\/p>\n<p>socket=\/var\/lib\/mysqla\/mysql.sock #\u6307\u5b9a\u767b\u9646\u5957\u63a5\u5b57<\/p>\n<p>server-id=110 #ID\u53f7,\u540c\u4e00\u4e3b\u4ece\u73af\u5883\u4e0d\u80fd\u76f8\u540c<\/p>\n<p>user=mysql #MySQL\u767b\u9646\u7528\u6237\u540d<\/p>\n<p>[mysqld148] #\u540d\u79f0\u540e\u9762\u52a0\u6570\u5b57,\u540e\u671f\u542f\u52a8\u7528(\u4e0d\u5e94\u76f8\u540c)<\/p>\n<p>port=3307 #\u7aef\u53e3\u53f7(\u4e0d\u5e94\u76f8\u540c)<\/p>\n<p>pid-file=\/var\/lib\/mysqlb\/mysqld.pid #MySQL\u8fdb\u7a0b\u53f7\u4fdd\u5b58\u4f4d\u7f6e<\/p>\n<p>datadir=\/var\/lib\/mysqlb #\u6570\u636e\u6587\u4ef6\u4fdd\u5b58\u4f4d\u7f6e<\/p>\n<p>socket=\/var\/lib\/mysqlb\/mysql.sock #\u6307\u5b9a\u767b\u9646\u5957\u63a5\u5b57<\/p>\n<p>server-id=110 #ID\u53f7,\u540c\u4e00\u4e3b\u4ece\u73af\u5883\u4e0d\u80fd\u76f8\u540c<\/p>\n<p>user=mysql #MySQL\u767b\u9646\u7528\u6237\u540d<\/p>\n<p>\u521d\u59cb\u5316\u6570\u636e\u5e93<\/p>\n<p>mysql_install_db &#8211;datadir=\/var\/lib\/mysqla &#8211;user=mysql #\u521d\u59cb\u5316\u6570\u636e\u5e93a<\/p>\n<p>mysql_install_db &#8211;datadir=\/var\/lib\/mysqlb &#8211;user=mysql #\u521d\u59cb\u5316\u6570\u636e\u5e93b<\/p>\n<p>\u7ed9\u76f8\u5e94\u76ee\u5f55\u8d4b\u4e88\u6743\u9650<\/p>\n<p>cd \/var\/lib\/<\/p>\n<p>chown -R mysql:mysql \/var\/lib\/mysqla\/ #\u4fee\u6539a\u6587\u4ef6\u6743\u9650<\/p>\n<p>chown -R mysql:mysql \/var\/lib\/mysqlb\/ #\u4fee\u6539b\u6587\u4ef6\u6743\u9650<\/p>\n<p>\u542f\u52a8\u76f8\u5e94\u670d\u52a1\u5668<\/p>\n<p>mysqld_multi &#8211;defaults-file=\/etc\/my.cnf start 147 #\u5f00\u542f147\u670d\u52a1\u5668<\/p>\n<p>mysqld_multi &#8211;defaults-file=\/etc\/my.cnf start 148 #\u5f00\u542f148\u670d\u52a1\u5668<\/p>\n<p>\u767b\u9646147\u548c148\u6570\u636e\u5e93\u786e\u5b9a\u4e3b\u4ece\u5173\u7cfb<\/p>\n<p>mysql -P 3306 -S \/var\/lib\/mysqla\/mysql.sock #\u767b\u9646147\u6570\u636e\u5e93<\/p>\n<p>mysql -P 3306 -S \/var\/lib\/mysqlb\/mysql.sock #\u767b\u9646148\u6570\u636e\u5e93<\/p>\n<p>change master to master_host=&#8217;\u670d\u52a1\u5668IP&#8217;,master_user=&#8217;\u6388\u6743\u8d26\u53f7&#8217;,master_password=&#8217;\u5bc6\u7801&#8217;,master_log_file=&#8217;\u65e5\u5fd7\u6587\u4ef6&#8217;,master_log_pos=\u6587\u4ef6\u4f4d\u7f6e;<\/p>\n<p>start slave; #\u542f\u7528\u540c\u6b65<\/p>\n<p>show slave status\\G; #\u67e5\u770b\u540c\u6b65\u72b6\u6001<\/p>\n<p>&nbsp;<\/p>\n<h3>MySQL \u5b9e\u73b0\u8bfb\u5199\u5206\u79bb<\/h3>\n<p>MyCat\u662f\u4e00\u4e2a\u5f00\u6e90\u7684,\u9762\u5411\u4f01\u4e1a\u5e94\u7528\u5f00\u53d1\u7684\u5927\u6570\u636e\u5e93\u96c6\u7fa4,\u652f\u6301\u4e8b\u52a1\u3001ACID\u3001\u53ef\u4ee5\u66ff\u4ee3MySQL\u7684\u52a0\u5f3a\u7248\u6570\u636e\u5e93,<br \/>\n\u5176\u529f\u80fd\u6709\u53ef\u4ee5\u89c6\u4e3aMySQL\u96c6\u7fa4\u7684\u4f01\u4e1a\u7ea7\u6570\u636e\u5e93,\u7528\u6765\u66ff\u4ee3\u6602\u8d35\u7684Oracle\u96c6\u7fa4.\u878d\u5408\u4e86\u5185\u5b58\u7f13\u5b58\u6280\u672f\u3001NoSQL\u6280\u672f\u3001HDFS\u5927\u6570\u636e\u7684\u65b0\u578bSQLServer,\u7ed3\u5408\u4f20\u7edf\u6570\u636e\u5e93\u548c\u65b0\u578b\u5206\u5e03\u5f0f\u6570\u636e\u4ed3\u5e93\u7684\u65b0\u4e00\u4ee3\u4f01\u4e1a\u7ea7\u6570\u636e\u5e93\u4ea7\u54c1.<\/p>\n<p>192.168.1.5 MyCat Server<\/p>\n<p>192.168.1.11 Master \u4e3bMariaDB<\/p>\n<p>192.168.1.12 Slave1 \u4ece1<\/p>\n<p>192.168.1.13 Slave2 \u4ece2<\/p>\n<p>1.\u5728\u914d\u7f6e\u8bfb\u5199\u5206\u79bb\u524d\u8bf7\u786e\u4fdd\u4f60\u7684\u4e3b\u673a\u6709\u56db\u53f0,\u5206\u522b\u5728\u6bcf\u53f0\u4e3b\u673a\u5b89\u88c5MariaDB\u6570\u636e\u5e93,\u5e76\u521d\u59cb\u5316,\u9700\u8981\u6ce8\u610f\u7684\u662fMyCat\u670d\u52a1\u7aef\u7684MariaDB\u4e0d\u9700\u8981\u521d\u59cb\u5316.<\/p>\n<p>[root@localhost ~]# yum install -y mariadb mariadb-server<\/p>\n<p>[root@localhost ~]# systemctl start mariadb<\/p>\n<p>[root@localhost ~]# systemctl enable mariadb<\/p>\n<p>2.\u5728MyCat\u670d\u52a1\u7aef\u5b89\u88c5JDK\u73af\u5883,\u7531\u4e8eMyCat\u662f\u4f7f\u7528Java\u5f00\u53d1\u7684,\u5728\u8fd9\u91cc\u6211\u4eec\u8981\u5148\u914d\u7f6e\u4e00\u4e0bJDK\u73af\u5883.<\/p>\n<p>[root@localhost ~]# tar -xzvf jdk-8u171-linux-x64.tar.gz -C \/usr\/local\/<\/p>\n<p>[root@localhost ~]# mv \/usr\/local\/jdk1.8.0_171\/ \/usr\/local\/jdk<\/p>\n<p>[root@localhost ~]# vim \/etc\/profile<\/p>\n<p>#&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>#JAVA-JDK-PATH<\/p>\n<p>export JAVA_HOME=\/usr\/local\/jdk<\/p>\n<p>export JAVA_BIN=\/usr\/local\/jdk\/bin<\/p>\n<p>export PATH=$PATH:$JAVA_HOME\/bin<\/p>\n<p>export CLASSPATH=.:$JAVA_HOME\/lib\/dt.jar:$JAVA_HOME\/lib\/tools.jar<\/p>\n<p>export JAVA_HOME JAVA_BIN PATH CLASSPATH<\/p>\n<p>#&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>[root@localhost ~]# source \/etc\/profile<\/p>\n<p>[root@localhost ~]# java -version<\/p>\n<p>java version &#8220;1.8.0_171&#8221;<\/p>\n<p>Java(TM) SE Runtime Environment (build 1.8.0_171-b11)<\/p>\n<p>Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)<\/p>\n<p>3.\u6b64\u6b65\u9aa4\u9700\u8981\u8fdb\u5165\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u521b\u5efa\u6388\u6743\u7528\u6237,\u4e5f\u5c31\u662f\u7ed9MyCAT\u51c6\u5907\u7684\u4f7f\u7528\u6570\u636e\u5e93\u7684\u6388\u6743\u7528\u6237.<\/p>\n<p>[root@localhost ~]# mysql -uroot -p<\/p>\n<p>Welcome to the MariaDB monitor. Commands end with ; or \\g.<\/p>\n<p>Your MariaDB connection id is 10<\/p>\n<p>Server version: 5.5.60-MariaDB MariaDB Server<\/p>\n<p>Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.<\/p>\n<p>Type &#8216;help;&#8217; or &#8216;\\h&#8217; for help. Type &#8216;\\c&#8217; to clear the current input statement.<\/p>\n<p>MariaDB [(none)]&gt; create database MyCatDB;<\/p>\n<p>Query OK, 1 row affected (0.00 sec)<\/p>\n<p>MariaDB [(none)]&gt; grant all on MyCatDB.* to &#8220;MyCat&#8221;@&#8221;%&#8221; identified by &#8220;123123&#8221;;<\/p>\n<p>Query OK, 0 rows affected (0.01 sec)<\/p>\n<p>MariaDB [(none)]&gt; grant all on MyCatDB.* to &#8220;MyCat&#8221;@&#8221;localhost&#8221; identified by &#8220;123123&#8221;;<\/p>\n<p>Query OK, 0 rows affected (0.00 sec)<\/p>\n<p>4.\u89e3\u538bMyCat\u5de5\u5177,\u5e76\u4fee\u6539MyCat\u7528\u6237\u6388\u6743\u6587\u4ef6,\u5199\u5165MyCat\u767b\u9646\u8d26\u6237,\u8fd9\u91cc\u914d\u7f6e\u6587\u4ef6\u6709\u5f88\u591a\u9009\u9879,\u6211\u4eec\u4e0d\u9700\u8981\u52a8,\u53ea\u9700\u8981\u4fee\u6539\u4ee5\u4e0b\u51e0\u4e2a\u5730\u65b9\u5c31\u884c.<\/p>\n<p>[root@localhost ~]# wget http:\/\/dl.mycat.io\/1.6.5\/Mycat-server-1.6.5-release-20180122220033-linux.tar.gz<\/p>\n<p>[root@localhost ~]# tar -xzvf Mycat-server-1.6.5-release-20180122220033-linux.tar.gz -C \/usr\/local\/<\/p>\n<p>[root@localhost ~]# vim \/usr\/local\/mycat\/conf\/server.xml<\/p>\n<p>&lt;user name=&#8221;root&#8221; defaultAccount=&#8221;true&#8221;&gt; #\u6307\u5b9aMyCat\u767b\u9646\u7528\u6237\u540d<\/p>\n<p>&lt;property name=&#8221;password&#8221;&gt;12345<strong>6<\/strong>&lt;\/property&gt; #\u6307\u5b9a\u5bc6\u7801<\/p>\n<p>&lt;property name=&#8221;schemas&#8221;&gt;MyCatDB&lt;\/property&gt; #\u6307\u5b9a\u540c\u6b65\u6570\u636e\u5e93<\/p>\n<p>&lt;\/user&gt;<\/p>\n<p>&lt;user name=&#8221;user&#8221;&gt; #\u6307\u5b9aMyCat\u767b\u9646\u7528\u6237\u540d<\/p>\n<p>&lt;property name=&#8221;password&#8221;&gt;12345<strong>6<\/strong>&lt;\/property&gt; #\u6307\u5b9a\u5bc6\u7801<\/p>\n<p>&lt;property name=&#8221;schemas&#8221;&gt;MyCatDB&lt;\/property&gt; #\u6307\u5b9a\u540c\u6b65\u6570\u636e\u5e93<\/p>\n<p>&lt;property name=&#8221;readOnly&#8221;&gt;true&lt;\/property&gt; #\u6307\u5b9a\u53ea\u8bfb<\/p>\n<p>&lt;\/user&gt;<\/p>\n<p>5.\u4fee\u6539MyCat\u8bfb\u5199\u5206\u79bb\u7b56\u7565,\u8fd9\u91cc\u6211\u4eec\u5220\u9664\u6e90\u6587\u4ef6,\u5e76\u81ea\u5df1\u521b\u5efa\u4e00\u4e2a,\u5199\u5165\u4ee5\u4e0b\u5185\u5bb9.<\/p>\n<p>[root@localhost ~]# vim \/usr\/local\/mycat\/conf\/schema.xml<\/p>\n<p>&lt;?xml version=&#8221;1.0&#8243;?&gt;<\/p>\n<p>&lt;!DOCTYPE mycat:schema SYSTEM &#8220;schema.dtd&#8221;&gt;<\/p>\n<p>&lt;mycat:schema xmlns:mycat=&#8221;http:\/\/io.mycat\/&#8221;&gt;<\/p>\n<p>&lt;schema name=&#8221;MyCatDB&#8221; checkSQLschema=&#8221;false&#8221; sqlMaxLimit=&#8221;100&#8243; dataNode=&#8221;dn_test&#8221;&gt; &lt;\/schema&gt;<\/p>\n<p>&lt;dataNode name=&#8221;dn_test&#8221; dataHost=&#8221;localhost&#8221; database=&#8221;MyCatDB&#8221; \/&gt;<\/p>\n<p>&lt;dataHost name=&#8221;localhost&#8221; maxCon=&#8221;1000&#8243; minCon=&#8221;10&#8243; balance=&#8221;1&#8243; writeType=&#8221;0&#8243; dbType=&#8221;mysql&#8221; dbDriver=&#8221;native&#8221; switchType=&#8221;1&#8243; slaveThreshold=&#8221;100&#8243;&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>&lt;heartbeat&gt;select user()&lt;\/heartbeat&gt;<\/p>\n<p>&lt;writeHost host=&#8221;Master1&#8243; url=&#8221;192.168.1.11:3306&#8243; user=&#8221;MyCat&#8221; password=&#8221;123123&#8243;&gt; #\u914d\u7f6e\u5199\u4e3b\u673a<\/p>\n<p>&lt;readHost host=&#8221;Slave1&#8243; url=&#8221;192.168.1.12:3306&#8243; user=&#8221;MyCat&#8221; password=&#8221;123123&#8243; \/&gt; #\u914d\u7f6e\u8bfb\u4e3b\u673a<\/p>\n<p>&lt;readHost host=&#8221;Slave2&#8243; url=&#8221;192.168.1.13:3306&#8243; user=&#8221;MyCat&#8221; password=&#8221;123123&#8243; \/&gt; #\u914d\u7f6e\u8bfb\u4e3b\u673a<\/p>\n<p>&lt;\/writeHost&gt;<\/p>\n<p>&lt;\/dataHost&gt;<\/p>\n<p>&lt;\/mycat:schema&gt;<\/p>\n<p>6.\u542f\u52a8MyCat\u82e5\u65e0\u62a5\u9519\u5219\u8bf4\u660e\u542f\u52a8\u6210\u529f,\u67e5\u770b\u7aef\u53e3\u770b\u865a\u62df\u7aef\u53e3\u662f\u5426\u5f00\u542f\u6210\u529f.<\/p>\n<p>[root@localhost ~]# \/usr\/local\/mycat\/bin\/mycat start<\/p>\n<p>[root@localhost ~]# netstat -an |grep &#8220;9066&#8221; #\u865a\u62dfschema\u7ba1\u7406\u7aef\u53e3<\/p>\n<p>[root@localhost ~]# netstat -an |grep &#8220;8066&#8221; #\u865a\u62dfschema\u767b\u9646\u7aef\u53e3<\/p>\n<p>7.\u5728MyCat\u670d\u52a1\u4e3b\u673a\u767b\u9646\u6570\u636e\u5e93,\u6d4b\u8bd5\u540c\u6b65\u6548\u679c.<\/p>\n<p>[root@localhost ~]# mysql -uroot -p123456 -h 127.0.0.1 -P 9066<\/p>\n<p>Welcome to the MariaDB monitor. Commands end with ; or \\g.<\/p>\n<p>Your MySQL connection id is 2<\/p>\n<p>Server version: 5.6.29-mycat-1.6.5-release-20180122220033 MyCat Server (monitor)<\/p>\n<p>Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.<\/p>\n<p>Type &#8216;help;&#8217; or &#8216;\\h&#8217; for help. Type &#8216;\\c&#8217; to clear the current input statement.<\/p>\n<p>MySQL [(none)]&gt; show @@heartbeat; #RS_CODE\u4e3a1\u8868\u793a\u5fc3\u8df3\u6b63\u5e38<\/p>\n<p>+&#8212;&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+<\/p>\n<p>| NAME | TYPE | HOST | PORT | RS_CODE | RETRY | STATUS | TIMEOUT | EXECUTE_TIME | LAST_ACTIVE_TIME | STOP |<\/p>\n<p>+&#8212;&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+<\/p>\n<p>| Master1 | mysql | 192.168.1.11 | 3306 | -1 | 0 | idle | 0 | 0,16,16 | 2018-12-21 01:29:43 | false |<\/p>\n<p>| Slave1 | mysql | 192.168.1.12 | 3306 | -1 | 0 | idle | 0 | 34,31,31 | 2018-12-21 01:29:43 | false |<\/p>\n<p>| Slave2 | mysql | 192.168.1.13 | 3306 | -1 | 0 | idle | 0 | 1,16,16 | 2018-12-21 01:29:43 | false |<\/p>\n<p>+&#8212;&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+<\/p>\n<p>3 rows in set (0.00 sec)<\/p>\n<p>MySQL [(none)]&gt; show @@datasource; #\u67e5\u770b\u8bfb\u5199\u5206\u79bb\u7684\u673a\u5668\u914d\u7f6e\u60c5\u51b5<\/p>\n<p>+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;+<\/p>\n<p>| DATANODE | NAME | TYPE | HOST | PORT | W\/R | ACTIVE | IDLE | SIZE | EXECUTE | READ_LOAD | WRITE_LOAD |<\/p>\n<p>+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;+<\/p>\n<p>| dn_test | Master1 | mysql | 192.168.1.11 | 3306 | W | 0 | 0 | 1000 | 0 | 0 | 0 |<\/p>\n<p>| dn_test | Slave1 | mysql | 192.168.1.12 | 3306 | R | 0 | 0 | 1000 | 0 | 0 | 0 |<\/p>\n<p>| dn_test | Slave2 | mysql | 192.168.1.13 | 3306 | R | 0 | 0 | 1000 | 0 | 0 | 0 |<\/p>\n<p>+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;+<\/p>\n<p>3 rows in set (0.01 sec)<\/p>\n<p>MySQL [(none)]&gt;<\/p>\n<p>8.\u767b\u5f55MyCat\u4ee3\u7406\u7aef,\u6d4b\u8bd5\u8bfb\u5199\u5206\u79bb\u670d\u52a1.<\/p>\n<p>[root@localhost ~]# mysql -uroot -p123456 -h127.0.0.1 -P 8066<\/p>\n<p>Welcome to the MariaDB monitor. Commands end with ; or \\g.<\/p>\n<p>Your MySQL connection id is 3<\/p>\n<p>Server version: 5.6.29-mycat-1.6.5-release-20180122220033 MyCat Server (OpenCloundDB)<\/p>\n<p>Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.<\/p>\n<p>Type &#8216;help;&#8217; or &#8216;\\h&#8217; for help. Type &#8216;\\c&#8217; to clear the current input statement.<\/p>\n<p>MySQL [(none)]&gt;<\/p>\n<p>MySQL [(none)]&gt;<\/p>\n<p>MySQL [(none)]&gt;<\/p>\n<p>MySQL [(none)]&gt; show databases;<\/p>\n<p>+&#8212;&#8212;&#8212;-+<\/p>\n<p>| DATABASE |<\/p>\n<p>+&#8212;&#8212;&#8212;-+<\/p>\n<p>| MyCatDB |<\/p>\n<p>+&#8212;&#8212;&#8212;-+<\/p>\n<p>1 row in set (0.00 sec)<\/p>\n<p>MySQL [(none)]&gt;<\/p>\n<p>&nbsp;<\/p>\n<h3>MySQL \u589e\u52a0\u76d1\u63a7<\/h3>\n<p>1.\u9996\u5148\u6211\u4eec\u5148\u6765\u4e0b\u8f7dMyCat\u4ee5\u53caZookeeper.<\/p>\n<p>[root@localhost ~]# wget http:\/\/www-eu.apache.org\/dist\/zookeeper\/zookeeper-3.4.12\/zookeeper-3.4.12.tar.gz<\/p>\n<p>[root@localhost ~]# wget http:\/\/dl.mycat.io\/mycat-web-1.0\/Mycat-web-1.0-SNAPSHOT-20170102153329-linux.tar.gz<\/p>\n<p>2.\u5728MyCat\u670d\u52a1\u7aef\u5b89\u88c5JDK\u73af\u5883,\u7531\u4e8eMyCat\u662f\u4f7f\u7528Java\u5f00\u53d1\u7684,\u5728\u8fd9\u91cc\u6211\u4eec\u8981\u5148\u914d\u7f6e\u4e00\u4e0bJDK\u73af\u5883.<\/p>\n<p>[root@localhost ~]# tar -xzvf jdk-8u171-linux-x64.tar.gz -C \/usr\/local\/<\/p>\n<p>[root@localhost ~]# mv \/usr\/local\/jdk1.8.0_171\/ \/usr\/local\/jdk<\/p>\n<p>[root@localhost ~]# vim \/etc\/profile<\/p>\n<p>#&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>#JAVA-JDK-PATH<\/p>\n<p>export JAVA_HOME=\/usr\/local\/jdk<\/p>\n<p>export JAVA_BIN=\/usr\/local\/jdk\/bin<\/p>\n<p>export PATH=$PATH:$JAVA_HOME\/bin<\/p>\n<p>export CLASSPATH=.:$JAVA_HOME\/lib\/dt.jar:$JAVA_HOME\/lib\/tools.jar<\/p>\n<p>export JAVA_HOME JAVA_BIN PATH CLASSPATH<\/p>\n<p>#&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>[root@localhost ~]# source \/etc\/profile<\/p>\n<p>[root@localhost ~]# java -version<\/p>\n<p>java version &#8220;1.8.0_171&#8221;<\/p>\n<p>Java(TM) SE Runtime Environment (build 1.8.0_171-b11)<\/p>\n<p>Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)<\/p>\n<p>3.\u914d\u7f6eMariaDB\u5f00\u542flower_case_table_names\u9009\u9879,\u6bcf\u53f0\u90fd\u8981\u5f00\u542f.<\/p>\n<p>[root@localhost ~]# yum install -y mariadb mariadb-server<\/p>\n<p>[root@localhost ~]# vim \/etc\/my.cnf<\/p>\n<p>[mysqld]<\/p>\n<p>lower_case_table_names = 1<\/p>\n<p>[root@localhost ~]# systemctl restart mariadb<\/p>\n<p>4.\u5b89\u88c5zookeeper,\u5176\u4e3b\u8981\u7528\u6765\u7edf\u8ba1\u6570\u636e.<\/p>\n<p>[root@localhost ~]# tar -xzvf zookeeper-3.4.12.tar.gz -C \/usr\/local\/<\/p>\n<p>[root@localhost ~]# cd \/usr\/local\/zookeeper-3.4.12\/conf\/<\/p>\n<p>[root@localhost ~]# cp zoo_sample.cfg zoo.cfg<\/p>\n<p>[root@localhost ~]# vim zoo.cfg<\/p>\n<p>dataDir=\/usr\/local\/&#8230;<\/p>\n<p>dataLogDir=\/usr\/local\/&#8230;<\/p>\n<p>5.\u8fd0\u884czookeeper<\/p>\n<p>[root@localhost ~]# cd \/usr\/local\/zookeeper-3.4.12\/bin\/<\/p>\n<p>[root@localhost ~]# .\/zkServer.sh start<\/p>\n<p>[root@localhost ~]# netstat -ant | grep 2181<\/p>\n<p>tcp 0 0 :::2181 :::* LISTEN<\/p>\n<p>\u5982\u679c\u51fa\u73b0\u9519\u8bef\uff1anohup: failed to run command `java\u2019: No such file or directory<\/p>\n<p>\u53ef\u4ee5\u5728zkServer.sh\u4e2d\u7684\u9996\u884c\u6dfb\u52a0\u5982\u4e0b\u4ee3\u7801<\/p>\n<p>export JAVA_HOME=\/usr\/lib\/jdk<\/p>\n<p>export PATH=$JAVA_HOME\/bin:$PATH<\/p>\n<p>6.\u6700\u540e\u4e00\u6b65,\u5b89\u88c5\u5e76\u8fd0\u884cMycat-Web<\/p>\n<p>[root@localhost ~]# tar -xzvf Mycat-web-1.0-SNAPSHOT-20170102153329-linux.tar.gz -C \/usr\/local<\/p>\n<p>[root@localhost ~]# cd \/usr\/local\/mycat-web<\/p>\n<p>[root@localhost ~]# .\/start.sh &amp;<\/p>\n<p>[root@localhost ~]# netstat -an | grep &#8220;8082&#8221;<\/p>\n<p>tcp 0 0 :::8082 :::* LISTEN<\/p>\n<p>[root@localhost ~]# curl http:\/\/localhost:8082\/mycat<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL \u914d\u7f6e\u4e3b\u5907\u6a21\u5f0f \u57fa\u4e8e\u4e00\u53f0\u670d\u52a1\u5668\u7684\u6570\u636e\u590d\u5236,\u6545\u5f97\u540d\u5355\u673a\u70ed\u5907,\u4e3b-\u5907 Active-Standby \u4e3b- [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-2577","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/2577","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2577"}],"version-history":[{"count":1,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/2577\/revisions"}],"predecessor-version":[{"id":2578,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/2577\/revisions\/2578"}],"wp:attachment":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2577"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2577"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}