{"id":160605,"date":"2024-11-03T23:29:18","date_gmt":"2024-11-03T15:29:18","guid":{"rendered":"https:\/\/server.hk\/cnblog\/160605\/"},"modified":"2024-11-03T23:29:19","modified_gmt":"2024-11-03T15:29:19","slug":"oceanbase-%e6%95%99%e7%a8%8b%ef%bc%9aoceanbase-%e6%96%b0%e5%bb%ba%e7%a7%9f%e6%88%b6","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/160605\/","title":{"rendered":"OceanBase \u6559\u7a0b\uff1aOceanBase \u65b0\u5efa\u79df\u6236"},"content":{"rendered":"<h1 id=\"oceanbase-%e6%95%99%e7%a8%8b%ef%bc%9aoceanbase-%e6%96%b0%e5%bb%ba%e7%a7%9f%e6%88%b6-yWZHLWISEe\">OceanBase \u6559\u7a0b\uff1aOceanBase \u65b0\u5efa\u79df\u6236<\/h1>\n<p>OceanBase \u662f\u4e00\u6b3e\u7531\u963f\u91cc\u5df4\u5df4\u958b\u767c\u7684\u5206\u4f48\u5f0f\u95dc\u4fc2\u578b\u6578\u64da\u5eab\uff0c\u65e8\u5728\u63d0\u4f9b\u9ad8\u53ef\u7528\u6027\u548c\u9ad8\u64f4\u5c55\u6027\u7684\u6578\u64da\u5b58\u5132\u89e3\u6c7a\u65b9\u6848\u3002\u96a8\u8457\u6578\u64da\u91cf\u7684\u6fc0\u589e\uff0c\u8d8a\u4f86\u8d8a\u591a\u7684\u4f01\u696d\u9078\u64c7\u4f7f\u7528 OceanBase \u4f86\u6eff\u8db3\u5176\u6578\u64da\u7ba1\u7406\u9700\u6c42\u3002\u5728\u9019\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u5011\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 OceanBase \u4e2d\u65b0\u5efa\u79df\u6236\uff0c\u5e6b\u52a9\u7528\u6236\u5feb\u901f\u4e0a\u624b\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af%e7%a7%9f%e6%88%b6%ef%bc%9f-yWZHLWISEe\">\u4ec0\u9ebc\u662f\u79df\u6236\uff1f<\/h2>\n<p>\u5728 OceanBase \u4e2d\uff0c\u79df\u6236\u662f\u6578\u64da\u5eab\u7684\u908a\u754c\uff0c\u985e\u4f3c\u65bc\u50b3\u7d71\u6578\u64da\u5eab\u4e2d\u7684\u6578\u64da\u5eab\u5be6\u4f8b\u3002\u6bcf\u500b\u79df\u6236\u53ef\u4ee5\u64c1\u6709\u81ea\u5df1\u7684\u6578\u64da\u3001\u7528\u6236\u548c\u6b0a\u9650\uff0c\u9019\u4f7f\u5f97\u591a\u79df\u6236\u74b0\u5883\u7684\u7ba1\u7406\u8b8a\u5f97\u66f4\u52a0\u9748\u6d3b\u548c\u9ad8\u6548\u3002\u79df\u6236\u7684\u8a2d\u8a08\u4f7f\u5f97 OceanBase \u80fd\u5920\u652f\u6301\u591a\u500b\u696d\u52d9\u7cfb\u7d71\u5728\u540c\u4e00\u500b\u6578\u64da\u5eab\u96c6\u7fa4\u4e2d\u904b\u884c\u3002<\/p>\n<h2 id=\"%e6%96%b0%e5%bb%ba%e7%a7%9f%e6%88%b6%e7%9a%84%e6%ad%a5%e9%a9%9f-yWZHLWISEe\">\u65b0\u5efa\u79df\u6236\u7684\u6b65\u9a5f<\/h2>\n<p>\u4ee5\u4e0b\u662f\u65b0\u5efa\u79df\u6236\u7684\u5177\u9ad4\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-1%ef%bc%9a%e9%80%a3%e6%8e%a5%e5%88%b0-oceanbase-yWZHLWISEe\">\u6b65\u9a5f 1\uff1a\u9023\u63a5\u5230 OceanBase<\/h3>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u9023\u63a5\u5230 OceanBase \u6578\u64da\u5eab\u3002\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u6216\u4efb\u4f55\u652f\u6301 SQL \u7684\u5ba2\u6236\u7aef\u5de5\u5177\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u9023\u63a5\u7684\u793a\u4f8b\uff1a<\/p>\n<pre><code>obclient -h  -P  -u  -p<\/code><\/pre>\n<p>\u8acb\u5c07 \u3001 \u548c  \u66ff\u63db\u70ba\u60a8\u7684 OceanBase \u670d\u52d9\u5668\u7684\u5be6\u969b\u5730\u5740\u3001\u7aef\u53e3\u548c\u7528\u6236\u540d\u3002<\/p>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-2%ef%bc%9a%e5%89%b5%e5%bb%ba%e7%a7%9f%e6%88%b6-yWZHLWISEe\">\u6b65\u9a5f 2\uff1a\u5275\u5efa\u79df\u6236<\/h3>\n<p>\u9023\u63a5\u6210\u529f\u5f8c\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b SQL \u8a9e\u53e5\u4f86\u5275\u5efa\u65b0\u7684\u79df\u6236\uff1a<\/p>\n<pre><code>CREATE TENANT tenant_name;<\/code><\/pre>\n<p>\u5728\u9019\u88e1\uff0c<code>tenant_name<\/code> \u662f\u60a8\u5e0c\u671b\u5275\u5efa\u7684\u79df\u6236\u540d\u7a31\u3002\u8acb\u6ce8\u610f\uff0c\u79df\u6236\u540d\u7a31\u5fc5\u9808\u662f\u552f\u4e00\u7684\u3002<\/p>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-3%ef%bc%9a%e8%a8%ad%e7%bd%ae%e7%a7%9f%e6%88%b6%e5%8f%83%e6%95%b8-yWZHLWISEe\">\u6b65\u9a5f 3\uff1a\u8a2d\u7f6e\u79df\u6236\u53c3\u6578<\/h3>\n<p>\u5275\u5efa\u79df\u6236\u5f8c\uff0c\u60a8\u53ef\u4ee5\u8a2d\u7f6e\u4e00\u4e9b\u53c3\u6578\uff0c\u4f8b\u5982\u79df\u6236\u7684\u8cc7\u6e90\u914d\u984d\u3002\u4ee5\u4e0b\u662f\u8a2d\u7f6e\u79df\u6236\u53c3\u6578\u7684\u793a\u4f8b\uff1a<\/p>\n<pre><code>ALTER TENANT tenant_name SET (max_connections = 100, max_cpu = 4);<\/code><\/pre>\n<p>\u9019\u88e1\u7684 <code>max_connections<\/code> \u548c <code>max_cpu<\/code> \u5206\u5225\u8868\u793a\u6700\u5927\u9023\u63a5\u6578\u548c\u6700\u5927 CPU \u914d\u984d\u3002<\/p>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-4%ef%bc%9a%e5%89%b5%e5%bb%ba%e7%94%a8%e6%88%b6%e4%b8%a6%e6%8e%88%e6%ac%8a-yWZHLWISEe\">\u6b65\u9a5f 4\uff1a\u5275\u5efa\u7528\u6236\u4e26\u6388\u6b0a<\/h3>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u9700\u8981\u70ba\u65b0\u79df\u6236\u5275\u5efa\u7528\u6236\u4e26\u6388\u6b0a\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b SQL \u8a9e\u53e5\u4f86\u5275\u5efa\u7528\u6236\uff1a<\/p>\n<pre><code>CREATE USER 'user_name'@'%' IDENTIFIED BY 'password';<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u6388\u6b0a\u7528\u6236\u8a2a\u554f\u79df\u6236\uff1a<\/p>\n<pre><code>GRANT ALL PRIVILEGES ON tenant_name.* TO 'user_name'@'%';<\/code><\/pre>\n<p>\u9019\u88e1\u7684 <code>user_name<\/code> \u662f\u60a8\u5e0c\u671b\u5275\u5efa\u7684\u7528\u6236\u540d\uff0c<code>password<\/code> \u662f\u7528\u6236\u7684\u5bc6\u78bc\u3002<\/p>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-5%ef%bc%9a%e9%a9%97%e8%ad%89%e7%a7%9f%e6%88%b6%e5%89%b5%e5%bb%ba-yWZHLWISEe\">\u6b65\u9a5f 5\uff1a\u9a57\u8b49\u79df\u6236\u5275\u5efa<\/h3>\n<p>\u6700\u5f8c\uff0c\u60a8\u53ef\u4ee5\u901a\u904e\u4ee5\u4e0b SQL \u8a9e\u53e5\u4f86\u9a57\u8b49\u79df\u6236\u662f\u5426\u6210\u529f\u5275\u5efa\uff1a<\/p>\n<pre><code>SHOW TENANTS;<\/code><\/pre>\n<p>\u9019\u5c07\u5217\u51fa\u6240\u6709\u79df\u6236\uff0c\u60a8\u61c9\u8a72\u80fd\u5920\u770b\u5230\u525b\u525b\u5275\u5efa\u7684\u79df\u6236\u540d\u7a31\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-yWZHLWISEe\">\u7e3d\u7d50<\/h2>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u4ecb\u7d39\u4e86\u5982\u4f55\u5728 OceanBase \u4e2d\u65b0\u5efa\u79df\u6236\u7684\u5177\u9ad4\u6b65\u9a5f\uff0c\u5305\u62ec\u9023\u63a5\u5230\u6578\u64da\u5eab\u3001\u5275\u5efa\u79df\u6236\u3001\u8a2d\u7f6e\u53c3\u6578\u3001\u5275\u5efa\u7528\u6236\u53ca\u6388\u6b0a\u7b49\u3002\u9019\u4e9b\u6b65\u9a5f\u5c07\u5e6b\u52a9\u60a8\u5feb\u901f\u4e0a\u624b OceanBase \u7684\u591a\u79df\u6236\u7ba1\u7406\u529f\u80fd\u3002\u82e5\u60a8\u9700\u8981\u9032\u4e00\u6b65\u7684\u652f\u6301\u6216\u5c0b\u627e\u5408\u9069\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2f VPS<\/a> \u89e3\u6c7a\u65b9\u6848\uff0c\u8acb\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u4ee5\u7372\u53d6\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b66\u4e60\u5982\u4f55\u5728 OceanBase \u4e2d\u65b0\u5efa\u79df\u6237\uff0c\u638c\u63e1\u79df\u6237\u7ba1\u7406\u7684\u57fa\u672c\u64cd\u4f5c\u4e0e\u6700\u4f73\u5b9e\u8df5\uff0c\u5feb\u901f\u63d0\u5347\u6570\u636e\u5e93\u4f7f\u7528\u6548\u7387\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-160605","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/160605","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=160605"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/160605\/revisions"}],"predecessor-version":[{"id":160606,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/160605\/revisions\/160606"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=160605"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=160605"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=160605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}