{"id":320,"date":"2024-07-14T12:58:59","date_gmt":"2024-07-14T04:58:59","guid":{"rendered":"https:\/\/abytelalala.cn\/?p=320"},"modified":"2024-07-18T11:56:48","modified_gmt":"2024-07-18T03:56:48","slug":"hbase%e5%9f%ba%e6%9c%ac%e6%93%8d%e4%bd%9c","status":"publish","type":"post","link":"https:\/\/abytelalala.cn\/index.php\/2024\/07\/14\/hbase%e5%9f%ba%e6%9c%ac%e6%93%8d%e4%bd%9c\/","title":{"rendered":"hbase\u57fa\u672c\u64cd\u4f5c"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\"><br>\u8868\u64cd\u4f5c\u547d\u4ee4\uff1a<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u521b\u5efa\u8868<\/strong>\uff1a <code>create 'table_name', 'column_family1', 'column_family2', ...<\/code>\u793a\u4f8b\uff1a <code>create 'my_table', 'cf1', 'cf2'<\/code><\/li>\n\n\n\n<li><strong>\u7981\u7528\u8868<\/strong>\uff1a <code>disable 'table_name'<\/code>\u7981\u7528\u8868\u540e\uff0c\u8be5\u8868\u5c06\u4e0d\u518d\u63a5\u53d7\u8bfb\u5199\u64cd\u4f5c\u3002<\/li>\n\n\n\n<li><strong>\u542f\u7528\u8868<\/strong>\uff1a <code>enable 'table_name'<\/code>\u542f\u7528\u4e4b\u524d\u7981\u7528\u7684\u8868\u3002<\/li>\n\n\n\n<li><strong>\u4fee\u6539\u8868\u7ed3\u6784<\/strong>\uff1a <code>alter 'table_name', {NAME =&gt; 'new_column_family', VERSIONS =&gt; 3}<\/code>\u793a\u4f8b\uff1a <code>alter 'my_table', {NAME =&gt; 'new_cf', VERSIONS =&gt; 5}<\/code>\u4fee\u6539\u8868\u7ed3\u6784\uff0c\u5982\u589e\u52a0\u65b0\u7684\u5217\u65cf\u6216\u4fee\u6539\u5217\u65cf\u7684\u7248\u672c\u6570\u3002<\/li>\n\n\n\n<li><strong>\u67e5\u770b\u8868\u63cf\u8ff0<\/strong>\uff1a <code>describe 'table_name'<\/code>\u663e\u793a\u8868\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5305\u62ec\u5217\u65cf\u3001\u914d\u7f6e\u9009\u9879\u7b49\u3002<\/li>\n\n\n\n<li><strong>\u5217\u51fa\u6240\u6709\u8868<\/strong>\uff1a <code>list<\/code>\u5217\u51fa\u5f53\u524d HBase \u5b9e\u4f8b\u4e2d\u6240\u6709\u7684\u8868\u3002<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">\u6570\u636e\u64cd\u4f5c\u547d\u4ee4\uff1a<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u63d2\u5165\u6216\u66f4\u65b0\u6570\u636e<\/strong>\uff1a <code>put 'table_name', 'row_key', 'column_family:column', 'value'<\/code>\u793a\u4f8b\uff1a <code>put 'my_table', 'row1', 'cf1:col1', 'value1'<\/code><\/li>\n\n\n\n<li><strong>\u83b7\u53d6\u6570\u636e<\/strong>\uff1a <code>get 'table_name', 'row_key'<\/code>\u793a\u4f8b\uff1a <code>get 'my_table', 'row1'<\/code>\u83b7\u53d6\u6307\u5b9a\u884c\u7684\u6570\u636e\u3002<\/li>\n\n\n\n<li><strong>\u5220\u9664\u6570\u636e<\/strong>\uff1a <code>delete 'table_name', 'row_key', 'column_family:column', 'timestamp'<\/code>\u793a\u4f8b\uff1a <code>delete 'my_table', 'row1', 'cf1:col1', 1597101234567<\/code>\u5220\u9664\u6307\u5b9a\u884c\u6216\u6307\u5b9a\u5217\u7684\u6570\u636e\uff0c\u53ef\u4ee5\u6307\u5b9a\u65f6\u95f4\u6233\uff08timestamp\uff09\u3002<\/li>\n\n\n\n<li><strong>\u626b\u63cf\u8868<\/strong>\uff1a<code>scan 'table_name'<\/code>\u793a\u4f8b\uff1a<code>scan 'my_table'<\/code>\u626b\u63cf\u6574\u4e2a\u8868\u7684\u6570\u636e\u3002\u770b\u8868\u6700\u540e\u4e00\u884c\u662f<code>scan 'my_table',{REVERSED => true,LIMIT =>1}<\/code><\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">\u5176\u4ed6\u64cd\u4f5c\u547d\u4ee4\uff1a<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u67e5\u770b\u96c6\u7fa4\u72b6\u6001<\/strong>\uff1a <code>status<\/code>\u663e\u793a HBase \u96c6\u7fa4\u7684\u72b6\u6001\u4fe1\u606f\uff0c\u5305\u62ec\u6d3b\u52a8\u7684 RegionServers\u3001\u8d1f\u8f7d\u60c5\u51b5\u7b49\u3002<\/li>\n\n\n\n<li><strong>\u67e5\u770b HBase \u7248\u672c<\/strong>\uff1a <code>version<\/code>\u663e\u793a\u5f53\u524d HBase \u7684\u7248\u672c\u4fe1\u606f\u3002<\/li>\n\n\n\n<li><strong>\u7edf\u8ba1\u8868\u4e2d\u7684\u884c\u6570<\/strong>\uff1a <code>count 'table_name'<\/code>\u793a\u4f8b\uff1a <code>count 'my_table'<\/code>\u7edf\u8ba1\u8868\u4e2d\u7684\u884c\u6570\u3002<\/li>\n\n\n\n<li><strong>\u6e05\u7a7a\u8868\u4e2d\u7684\u6240\u6709\u6570\u636e<\/strong>\uff1a <code>truncate 'table_name'<\/code>\u793a\u4f8b\uff1a <code>truncate 'my_table'<\/code>\u6e05\u7a7a\u6307\u5b9a\u8868\u4e2d\u7684\u6240\u6709\u6570\u636e\uff0c\u8868\u7ed3\u6784\u4fdd\u6301\u4e0d\u53d8\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u8868\u64cd\u4f5c\u547d\u4ee4\uff1a \u6570\u636e\u64cd\u4f5c\u547d\u4ee4\uff1a \u5176\u4ed6\u64cd\u4f5c\u547d\u4ee4\uff1a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-320","post","type-post","status-publish","format-standard","hentry","category-9"],"_links":{"self":[{"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/posts\/320","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/comments?post=320"}],"version-history":[{"count":5,"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/posts\/320\/revisions"}],"predecessor-version":[{"id":341,"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/posts\/320\/revisions\/341"}],"wp:attachment":[{"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/media?parent=320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/categories?post=320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/tags?post=320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}