{"id":8066,"date":"2022-03-31T20:39:22","date_gmt":"2022-03-31T12:39:22","guid":{"rendered":"https:\/\/nj.transwarp.cn:8180\/?p=8066"},"modified":"2022-12-30T17:51:49","modified_gmt":"2022-12-30T09:51:49","slug":"txsql-binlog-%e6%97%a5%e5%bf%97%e6%b8%85%e7%90%86%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/kbwp.transwarp.cn\/?p=8066","title":{"rendered":"TxSQL binlog \u65e5\u5fd7\u6e05\u7406\u65b9\u6cd5"},"content":{"rendered":"<h3>\u6982\u8981\u63cf\u8ff0<\/h3>\n<hr \/>\n<p>TxSQL \u6570\u636e\u76ee\u5f55\u7a7a\u95f4\u5360\u7528\u9ad8\uff0c\u5b58\u5728\u5927\u91cf binlog \u6587\u4ef6\uff0c\u662f\u5426\u53ef\u4ee5\u8fdb\u884c\u6e05\u7406\uff0c\u5982\u4f55\u8fdb\u884c\u6e05\u7406\uff1f<br \/>\n\u672c\u6587\u4e3b\u8981\u4ecb\u7ecd\u6e05\u7406 TxSQL binlog \u65e5\u5fd7\u6587\u4ef6\u7684\u65b9\u6cd5\u3002<\/p>\n<h3>\u8be6\u7ec6\u8bf4\u660e<\/h3>\n<hr \/>\n<ol>\n<li>\nTxSQL \u6570\u636e\u76ee\u5f55\u67e5\u770b<\/p>\n<pre><code>$ grep DATA_DIR \/etc\/txsql1\/conf\/install_conf.sh\n DATA_DIR=\/vdir\/mnt\/disk1\/hadoop\/txsql1<\/code><\/pre>\n<p>\u4ee5\u4e0a\u8f93\u51fa\u4e3a TxSQL \u5bb9\u5668\u6570\u636e\u76ee\u5f55\uff0c\u7269\u7406\u8282\u70b9 hostPath \u5219\u4e3a\u53bb\u6389 \/vdir \u7684\u90e8\u5206 <code>\/mnt\/disk1\/hadoop\/txsql1<\/code>\n<\/li>\n<li>\n\u8fdb\u5165\u6570\u636e\u76ee\u5f55\u67e5\u770b\u6587\u4ef6\u5360\u7528\u60c5\u51b5<br \/>\n<code>$ cd \/mnt\/disk1\/hadoop\/txsql1\/percona.workspace\/binlog\/  && ls -lrt<\/code><br \/>\n<img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2022\/03\/image-1648728889046.png\" alt=\"file\" \/>\n<\/li>\n<li>\n\u627e\u5230\u5f53\u524d\u8282\u70b9\u7684 TxSQL pod\uff0c\u5e76\u8fdb\u5165 pod <\/p>\n<pre><code class=\"language-bash\">$ kubectl get po -o wide | grep txsql1\n$ kubectl exec -it txsql-server-txsql1-997564c5c-457hp  bash  # txsql-server-txsql1-997564c5c-457hp \u4e3a\u4e0a\u9762\u83b7\u53d6\u5230\u7684 pod name<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2022\/03\/image-1648729117790.png\" alt=\"file\" \/>\n<\/li>\n<li>\n\u8fdb\u5165\u5f53\u524d TxSQL \u7684 mysql \u5ba2\u6237\u7aef<br \/>\n<code>$ \/usr\/bin\/txsql\/tools\/txsql.sh localshell<\/code>\n<\/li>\n<li>\n\u67e5\u770b binlog \u6587\u4ef6<\/p>\n<pre><code class=\"language-sql\">mysql> show master status\\G;  -- \u67e5\u770b\u5f53\u524d\u4f7f\u7528\u7684 binlog \u6587\u4ef6\nmysql> show binary logs;  -- \u67e5\u770b\u6240\u6709\u7684 binlog \u6587\u4ef6<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2022\/03\/image-1648729514027.png\" alt=\"file\" \/><br \/>\n<img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2022\/03\/image-1648729497039.png\" alt=\"file\" \/>\n<\/li>\n<li>\n\u4f7f\u7528 purge \u547d\u4ee4\uff0c\u628a mysql-bin.XXXXXX \u4e4b\u524d\u7684\u6240\u6709\u6587\u4ef6\u90fd\u6e05\u7406\u6389<br \/>\nmysql-bin.XXXXXX \u8fd9\u4e2a\u53c2\u6570\u4e00\u822c\u5e94\u8be5\u5199\u4e0a\u4e00\u6b65\u5217\u51fa\u7684\u7f16\u53f7\u6700\u5927\u7684\u6587\u4ef6\uff1b<br \/>\n\u5982\u679c\u6587\u4ef6\u8f83\u591a\uff0c\u5efa\u8bae\u5206\u6279\u6b21\u6267\u884c\uff0c\u907f\u514d\u4e00\u6b21\u6027\u6e05\u7406 IO \u8fc7\u5927\u3002<\/p>\n<pre><code class=\"language-sql\">mysql> purge binary logs to 'mysql-bin.000054';\nmysql> purge binary logs to 'mysql-bin.000057'; <\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2022\/03\/image-1648729742080.png\" alt=\"file\" \/>\n<\/li>\n<li>\n\u68c0\u67e5\u662f\u5426\u6e05\u7406\u6210\u529f<br \/>\n\u518d\u6b21\u6267\u884c <code>show binary logs; <\/code><br \/>\n<img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2022\/03\/image-1648729874380.png\" alt=\"file\" \/><br \/>\n\u9000\u51fa\u5bb9\u5668\uff0c\u67e5\u770b\u8282\u70b9\u6570\u636e\u76ee\u5f55 <code>cd \/mnt\/disk1\/hadoop\/txsql1\/percona.workspace\/binlog\/  && ls -lrt<\/code>\uff0c\u4e4b\u524d\u7684\u6587\u4ef6\u5df2\u7ecf\u88ab\u6e05\u7406<br \/>\n<img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2022\/03\/image-1648729927979.png\" alt=\"file\" \/>\n<\/li>\n<li>\n\u540c\u6837\u7684\u6b65\u9aa4\u6e05\u7406\u5176\u4f59 TxSQL \u8282\u70b9<br \/>\n\u5982\u679c\u5176\u4ed6 TxSQL \u8282\u70b9\u4e5f\u5b58\u5728\u5360\u7528\u95ee\u9898\uff0c\u53c2\u8003\u4e4b\u524d\u7684\u6b65\u9aa4\u8fdb\u884c\u6e05\u7406\u5373\u53ef\n<\/li>\n<li>\n\u5168\u90e8\u6e05\u7406\u5b8c\u6bd5\uff0c\u68c0\u67e5 TxSQL \u72b6\u6001<br \/>\n\u6bcf\u4e2a TxSQL \u8282\u70b9\u90fd\u6e05\u7406\u5b8c\u6bd5\u540e\uff0c\u53c2\u8003\u7b2c 3 \u6b65\u7684\u547d\u4ee4\u8fde\u63a5\u5230\u4efb\u610f\u5065\u5eb7\u7684 TxSQL pod\uff0c\u6267\u884c\u547d\u4ee4\u68c0\u67e5\u72b6\u6001\uff0c\u6b63\u5e38\u4f1a\u8f93\u51fa  ok \u548c master \u8282\u70b9\u4fe1\u606f<br \/>\n<code>$ \/usr\/bin\/txsql\/tools\/txsql.sh status<\/code><br \/>\n<img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2022\/03\/image-1648730229452.png\" alt=\"file\" \/>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981\u63cf\u8ff0 TxSQL \u6570\u636e\u76ee\u5f55\u7a7a\u95f4\u5360\u7528\u9ad8\uff0c\u5b58\u5728\u5927\u91cf binlog \u6587\u4ef6\uff0c\u662f\u5426\u53ef\u4ee5\u8fdb\u884c\u6e05\u7406\uff0c\u5982\u4f55\u8fdb\u884c\u6e05\u7406\uff1f \u672c\u6587 ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/kbwp.transwarp.cn\/?p=8066\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-8066","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"acf":[],"_links":{"self":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/8066","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8066"}],"version-history":[{"count":3,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/8066\/revisions"}],"predecessor-version":[{"id":9227,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/8066\/revisions\/9227"}],"wp:attachment":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8066"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8066"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}