{"id":715,"date":"2022-10-25T17:23:17","date_gmt":"2022-10-25T09:23:17","guid":{"rendered":"https:\/\/www.luyouli.com\/?p=715"},"modified":"2022-10-27T11:14:47","modified_gmt":"2022-10-27T03:14:47","slug":"%e5%9c%a8kubernetes%e4%b8%8a%e4%bd%bf%e7%94%a8ob-operator%e9%83%a8%e7%bd%b2oceanbase-ce-3-1-3","status":"publish","type":"post","link":"https:\/\/www.luyouli.com\/?p=715","title":{"rendered":"\u5728kubernetes\u4e0a\u4f7f\u7528ob-operator\u90e8\u7f72OceanBase-ce 3.1.3"},"content":{"rendered":"\n<p>\u73af\u5883\uff1a<\/p>\n\n\n\n<p>\u7cfb\u7edf\uff1aUbuntu 20.04<\/p>\n\n\n\n<p>\u5185\u6838\uff1a5.15<\/p>\n\n\n\n<p>OceanBase\u7248\u672c\uff1a3.1.3-OceanBase CE<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>1\u3001\u57fa\u7840\u73af\u5883<\/p>\n\n\n\n<p>\u5b89\u88c5kubernetes 1.25.2\uff0ccontainerd 1.6.8\uff0c\u5e76\u521d\u59cb\u5316\u4e00\u4e2a\u4e09\u4e3b\uff08master\uff09\u516d\u4ece\uff08slave\uff09\u7684\u96c6\u7fa4<\/p>\n\n\n\n<p>\u8fd9\u5904\u64cd\u4f5c\uff0c\u7565<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>2\u3001\u62c9\u53d6ob-operator\u4ee3\u7801<\/p>\n\n\n\n<p># git clone <a href=\"https:\/\/github.com\/oceanbase\/ob-operator.git\">https:\/\/github.com\/oceanbase\/ob-operator.git<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>3\u3001\u5b89\u88c5OceanBase\u7684\u5b58\u50a8\u73af\u5883<\/p>\n\n\n\n<p>\u56e0\u4e3aobcluster.yaml\u4e2d\u4f7f\u7528\u7684\u8def\u5f84\u662flocal-path<\/p>\n\n\n\n<p>\u8be6\u60c5\u8bf7\u770b\u6587\u6863\uff1a<a href=\"https:\/\/github.com\/oceanbase\/ob-operator\/issues\/5\">https:\/\/github.com\/oceanbase\/ob-operator\/issues\/5<\/a><\/p>\n\n\n\n<p># kubectl apply -f https:\/\/raw.githubusercontent.com\/rancher\/local-path-provisioner\/v0.0.22\/deploy\/local-path-storage.yaml<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"813\" height=\"144\" src=\"https:\/\/www.luyouli.com\/wp-content\/uploads\/2022\/10\/1.jpg\" alt=\"\" class=\"wp-image-716\"\/><\/figure>\n\n\n\n<p># kubectl get sc<\/p>\n\n\n\n<p>NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE<\/p>\n\n\n\n<p>local-path rancher.io\/local-path Delete WaitForFirstConsumer false 2m50s<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>4\u3001\u914d\u7f6e\u8282\u70b9label<\/p>\n\n\n\n<p># kubectl label nodes slave-1 topology.kubernetes.io\/zone=zone1<\/p>\n\n\n\n<p># kubectl label nodes slave-2 topology.kubernetes.io\/zone=zone1<\/p>\n\n\n\n<p># kubectl label nodes slave-3 topology.kubernetes.io\/zone=zone2<\/p>\n\n\n\n<p># kubectl label nodes slave-4 topology.kubernetes.io\/zone=zone2<\/p>\n\n\n\n<p># kubectl label nodes slave-5 topology.kubernetes.io\/zone=zone3<\/p>\n\n\n\n<p># kubectl label nodes slave-6 topology.kubernetes.io\/zone=zone3<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>5\u3001\u521b\u5efaobcluster\u7684namespace\uff08\u4e0d\u77e5\u9053\u4e3a\u5565crd\u548coperator\u91cc\u90fd\u6ca1\u6709\uff09<\/p>\n\n\n\n<p>kubectl create namespace obcluster<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>6\u3001\u90e8\u7f72ob-operator<\/p>\n\n\n\n<p># cd ob-operator\/deploy\/<\/p>\n\n\n\n<p># kubectl apply -f crd.yaml<\/p>\n\n\n\n<p># kubectl apply -f operator.yaml<\/p>\n\n\n\n<p># kubectl apply -f obcluster.yaml<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>7\u3001\u90e8\u7f72obproxy<\/p>\n\n\n\n<p># cd obproxy\/<\/p>\n\n\n\n<p># kubectl apply -f deployment.yaml -f service.yaml<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>8\u3001\u67e5\u770b\u548c\u8fde\u63a5\u96c6\u7fa4<\/p>\n\n\n\n<p># kubectl -n oceanbase-system get pods -o wide # \u67e5\u770bob-operator<\/p>\n\n\n\n<p># kubectl -n obcluster get pods -o wide<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"815\" height=\"141\" src=\"https:\/\/www.luyouli.com\/wp-content\/uploads\/2022\/10\/2.jpg\" alt=\"\" class=\"wp-image-717\"\/><\/figure>\n\n\n\n<p># kubectl -n obcluster get svc<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"998\" height=\"96\" src=\"https:\/\/www.luyouli.com\/wp-content\/uploads\/2022\/10\/3.jpg\" alt=\"\" class=\"wp-image-718\"\/><\/figure>\n\n\n\n<p># mysql -u root@sys -p -h 10.96.80.26 -A -c -P 2881<\/p>\n\n\n\n<p>Enter password:<\/p>\n\n\n\n<p>Welcome to the MySQL monitor. Commands end with ; or \\g.<\/p>\n\n\n\n<p>Your MySQL connection id is 3222146325<\/p>\n\n\n\n<p>Server version: 5.7.25 OceanBase 3.1.3 (r10100042022051821-a09d3134c10665f03fd56d7f8bdd413b2b771977) (Built May 18 2022 21:42:24)<\/p>\n\n\n\n<p>Copyright (c) 2000, 2022, Oracle and\/or its affiliates.<\/p>\n\n\n\n<p>Oracle is a registered trademark of Oracle Corporation and\/or its<\/p>\n\n\n\n<p>affiliates. Other names may be trademarks of their respective<\/p>\n\n\n\n<p>owners.<\/p>\n\n\n\n<p>Type &#8216;help;&#8217; or &#8216;\\h&#8217; for help. Type &#8216;\\c&#8217; to clear the current input statement.<\/p>\n\n\n\n<p>mysql&gt; SELECT version();<\/p>\n\n\n\n<p>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<\/p>\n\n\n\n<p>| version() |<\/p>\n\n\n\n<p>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<\/p>\n\n\n\n<p>| 3.1.3-OceanBase CE |<\/p>\n\n\n\n<p>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<\/p>\n\n\n\n<p>1 row in set (0.01 sec)<\/p>\n\n\n\n<p>mysql&gt;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1301\" height=\"363\" src=\"https:\/\/www.luyouli.com\/wp-content\/uploads\/2022\/10\/4.jpg\" alt=\"\" class=\"wp-image-719\"\/><\/figure>\n\n\n\n<p>\u5269\u4e0b\u7684\u5185\u5bb9\uff0c\u53bb\u770b\u5b98\u7f51\u5427\uff0c\u5b98\u7f51\u5730\u5740\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p><a href=\"https:\/\/www.oceanbase.com\/docs\/community-tutorials-cn-10000000000012249\">https:\/\/www.oceanbase.com\/docs\/community-tutorials-cn-10000000000012249<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/www.oceanbase.com\/docs\/community-observer-cn-10000000000449661\">https:\/\/www.oceanbase.com\/docs\/community-observer-cn-10000000000449661<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u95ee\u9898\uff1a<\/p>\n\n\n\n<p>\u76ee\u524d\u6709\u4e00\u4e2a\u5927\u95ee\u9898\uff0c\u5982\u679c\u5220\u9664\u2018sapp-ob-test-cn-zone*\u2019\u7684pod\uff0c\u90a3\u4e48\u8be5pod\u5c31\u4f1a\u88ab\u53cd\u590d\u91cd\u5efa\uff0c\u800c\u4e14\u2018ob-operator-controller-manager\u2019\u5c45\u7136\u6ca1\u6709\u65e5\u5fd7\u8f93\u51fa\uff0c\u5c45\u7136\u6ca1\u6709\u65e5\u5fd7\u8f93\u51fa\uff0c\u5c45\u7136\u6ca1\u6709\u65e5\u5fd7\u8f93\u51fa<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u73af\u5883\uff1a \u7cfb\u7edf\uff1aUbuntu 20.04 \u5185\u6838\uff1a5.15 OceanBase\u7248\u672c\uff1a3.1.3-OceanBase [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-715","post","type-post","status-publish","format-standard","hentry","category-kubernetes"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"views":2309,"_links":{"self":[{"href":"https:\/\/www.luyouli.com\/index.php?rest_route=\/wp\/v2\/posts\/715","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.luyouli.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.luyouli.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.luyouli.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.luyouli.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=715"}],"version-history":[{"count":3,"href":"https:\/\/www.luyouli.com\/index.php?rest_route=\/wp\/v2\/posts\/715\/revisions"}],"predecessor-version":[{"id":722,"href":"https:\/\/www.luyouli.com\/index.php?rest_route=\/wp\/v2\/posts\/715\/revisions\/722"}],"wp:attachment":[{"href":"https:\/\/www.luyouli.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=715"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.luyouli.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=715"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.luyouli.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=715"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}