

{"id":16916,"date":"2018-05-25T10:51:33","date_gmt":"2018-05-25T10:51:33","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=16916"},"modified":"2018-05-25T10:51:33","modified_gmt":"2018-05-25T10:51:33","slug":"hbase-commands","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/hbase-commands\/","title":{"rendered":"HBase Commands &#8211; General, Data Definition, &amp; Data Manipulation"},"content":{"rendered":"<p><span style=\"font-weight: 400\">In our last <strong>HBase<\/strong> tutorial, we discussed <strong>HBase Shell<\/strong>. Today, we will see HBase Commands with examples and syntax. Basically, to get familiarized with HBase, we need to learn HBase Commands. <\/span><\/p>\n<p><span style=\"font-weight: 400\">There are several types of HBase commands such as general commands, data definition commands, data manipulation commands. So, in this article, we will learn all these\u00a0HBase\u00a0commands in detail.<\/span><\/p>\n<p>So, let&#8217;s explore HBase commands.<\/p>\n<h2><span style=\"font-weight: 400\">Hbase Commands<\/span><\/h2>\n<p><span style=\"font-weight: 400\">There are several types of Commands in HBase. They are-<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><span style=\"font-weight: 400\">&#8211; General Commands<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><span style=\"font-weight: 400\">&#8211; Data Definition Commands<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><span style=\"font-weight: 400\">&#8211; Data Manipulation Commands<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><span style=\"font-weight: 400\">&#8211; Other HBase Shell Commands<\/span><br \/>\n<span style=\"font-weight: 400\">So, let\u2019s learn all these Hbase Commands in detail.<\/span><\/p>\n<h2>Types of Commands in HBase<\/h2>\n<p>There are various types of HBase commands<\/p>\n<h3><span style=\"font-weight: 400\">a. General Commands<\/span><\/h3>\n<div id=\"attachment_18563\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/General-Commands-in-HBase-01.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-18563\" class=\"wp-image-18563 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/General-Commands-in-HBase-01.jpg\" alt=\"HBase Commands\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/General-Commands-in-HBase-01.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/General-Commands-in-HBase-01-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/General-Commands-in-HBase-01-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/General-Commands-in-HBase-01-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/General-Commands-in-HBase-01-1024x536.jpg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-18563\" class=\"wp-caption-text\">HBase General Commands<\/p><\/div>\n<p>Below we are discussing some general HBase commands:<br \/>\n<strong>i. Status<\/strong><br \/>\n<span style=\"font-weight: 400\">It shows the status of the cluster.<\/span><br \/>\n<strong>A Syntax for Status-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">hbase(main):009:0&gt; status<\/pre>\n<p><strong>ii.\u00a0table_help<\/strong><br \/>\n<span style=\"font-weight: 400\">This command helps on Table reference commands, such as scan, put, get, disable, drop etc.<\/span><br \/>\n<strong>A Syntax for table help &#8211;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">hbase(main):02:0&gt; table_help<\/pre>\n<p><strong>iii. Version<\/strong><br \/>\n<span style=\"font-weight: 400\">It displays version of HBase.<\/span><br \/>\n<strong>Version Syntax &#8211;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">hbase(main):010:0&gt; version<\/pre>\n<p><strong>iv.\u00a0whoami<\/strong><br \/>\n<span style=\"font-weight: 400\">It displays the current user details of HBase.<\/span><br \/>\n<strong>Whoami Syntax-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; whoami<\/pre>\n<h3><span style=\"font-weight: 400\">b. Data Definition Commands<\/span><\/h3>\n<p>Following are some Data Definition HBase Commands:<br \/>\n<strong>i.\u00a0alter<\/strong><br \/>\n<span style=\"font-weight: 400\">We use alter command to add\/modify\/delete column families, also to change table configuration.<\/span><br \/>\n<strong>a. Add\/Change column family<\/strong><br \/>\n<span style=\"font-weight: 400\">Let\u2019s see an example, in order to change or add the \u2018f1\u2019 column family in table \u2018t1\u2019 from the current value to keep a maximum of 5 cell VERSIONS, use this command- <\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; alter 't1', NAME =&gt; 'f1', VERSIONS =&gt; 5<\/pre>\n<p><span style=\"font-family: Verdana, Geneva, sans-serif\">Moreover, on several column families, we can operate it:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; alter 't1', 'f1', {NAME =&gt; 'f2', IN_MEMORY =&gt; true}, {NAME =&gt; 'f3', VERSIONS =&gt; 5}<\/pre>\n<p><strong>b. Delete column family<\/strong><br \/>\n<span style=\"font-weight: 400\">Use one of following to delete the \u2018f1\u2019 column family in table \u2018ns1:t1\u2019:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; alter 'ns1:t1', NAME =&gt; 'f1', METHOD =&gt; 'delete'\nhbase&gt; alter 'ns1:t1', 'delete' =&gt; 'f1'<\/pre>\n<p><strong>c. Alter Table Properties<\/strong><br \/>\n<span style=\"font-weight: 400\">Also, it is possible to change table-scope attributes such as MAX_FILESIZE, READONLY, MEMSTORE_FLUSHSIZE, DEFERRED_LOG_FLUSH, etc. we can put these at the end;<\/span><br \/>\n<span style=\"font-weight: 400\">for example:<\/span><br \/>\n<span style=\"font-weight: 400\">Now, in order to change the max size of a region to 128MB, use this command:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; alter 't1', MAX_FILESIZE =&gt; '134217728'<\/pre>\n<p><strong>ii.\u00a0alter_async<\/strong><br \/>\n<span style=\"font-weight: 400\">Only one difference between alter command and \u00a0alter_async is, alter_async does not wait for all regions to receive the schema changes.<\/span><br \/>\n<strong>iii.\u00a0alter_status<\/strong><br \/>\n<span style=\"font-weight: 400\">Alter_status command gets the status of the alter command. Moreover, it indicates the number of regions of the table which have received the updated schema.<\/span><br \/>\n<strong>For Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; alter_status 't1'\nhbase&gt; alter_status 'ns1:t1'<\/pre>\n<p><strong>iv. Create<\/strong><br \/>\n<span style=\"font-weight: 400\">For Creating tables, we use it. Also, we can Pass a table name, and a set of column family specifications (at least one), and, optionally, table configuration as arguments.<\/span><\/p>\n<p><span style=\"font-weight: 400\">For Examples:<\/span><br \/>\n<strong>a. Create a table; <\/strong><br \/>\n<span style=\"font-weight: 400\">Along with the namespace=ns1 and table qualifier\/name=t1<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; create 'ns1:t1', {NAME =&gt; 'f1', VERSIONS =&gt; 5}<\/pre>\n<p><strong>b. Create a table;<\/strong><br \/>\n<span style=\"font-weight: 400\">Along with namespace=default and table qualifier=t1<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; create 't1', {NAME =&gt; 'f1'}, {NAME =&gt; 'f2'}, {NAME =&gt; 'f3'}\nhbase&gt; # The above in shorthand would be the following:\nhbase&gt; create 't1', 'f1', 'f2', 'f3'\nhbase&gt; create 't1', {NAME =&gt; 'f1', VERSIONS =&gt; 1, TTL =&gt; 2592000, BLOCKCACHE =&gt; true}\nhbase&gt; create 't1', {NAME =&gt; 'f1', CONFIGURATION =&gt; {'hbase.hstore.blockingStoreFiles' =&gt; '10'}}<\/pre>\n<p><strong>c. Table configuration options can be put at the end.<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; create 'ns1:t1', 'f1', SPLITS =&gt; ['10', '20', '30', '40']\nhbase&gt; create 't1', 'f1', SPLITS =&gt; ['10', '20', '30', '40']\nhbase&gt; create 't1', 'f1', SPLITS_FILE =&gt; 'splits.txt', OWNER =&gt; 'johndoe'\nhbase&gt; create 't1', {NAME =&gt; 'f1', VERSIONS =&gt; 5}, METADATA =&gt; { 'mykey' =&gt; 'myvalue' }\nhbase&gt; # Optionally pre-split the table into NUMREGIONS, using\nhbase&gt; # SPLITALGO (\"HexStringSplit\", \"UniformSplit\" or classname)\nhbase&gt; create 't1', 'f1', {NUMREGIONS =&gt; 15, SPLITALGO =&gt; 'HexStringSplit'}\nhbase&gt; create 't1', 'f1', {NUMREGIONS =&gt; 15, SPLITALGO =&gt; 'HexStringSplit', CONFIGURATION =&gt; {'hbase.hregion.scan.loadColumnFamiliesOnDemand' =&gt; 'true'}}<\/pre>\n<p><strong>d. Also, it is possible to keep around a reference to the created table.<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; t1 = create 't1', 'f1'<\/pre>\n<p><span style=\"font-weight: 400\">Which gives a reference to the table named \u2018t1\u2019, on which we can then call methods t1.scan, t1.get.<\/span><\/p>\n<p><strong>v.\u00a0disable<\/strong><\/p>\n<p><span style=\"font-weight: 400\">The \u201cdisable\u201d command, disables an existing HBase table. However, the tables which are disabled, will not be deleted from HBase, only they are not available for regular access. <\/span><\/p>\n<p><span style=\"font-weight: 400\">And we can not run any other command except either enable or drop commands on disabled tables because this table is excluded from the list command. In simple words, Disabling means to delete the tables temporarily.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; disable 't1'\nhbase&gt; disable 'ns1:t1'<\/pre>\n<p><strong>vi.\u00a0disable_all<\/strong><br \/>\n<span style=\"font-weight: 400\">By \u00a0matching the given regex, it disable all of tables:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; disable_all 't.*'\nhbase&gt; disable_all 'ns:t.*'\nhbase&gt; disable_all 'ns:.*'<\/pre>\n<p><strong>vii.\u00a0drop<\/strong><\/p>\n<p><span style=\"font-weight: 400\">It simply means deleting the tables permanently. But make sure, to drop a table we need to disable it first.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; drop 't1'\nhbase&gt; drop 'ns1:t1'<\/pre>\n<p><strong>viii.\u00a0drop_all<\/strong><br \/>\n<span style=\"font-weight: 400\">By matching the given regex, it drops all of the tables:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; drop_all 't.*'\nhbase&gt; drop_all 'ns:t.*'\nhbase&gt; drop_all 'ns:.*'<\/pre>\n<p><strong>ix.\u00a0enable<\/strong><\/p>\n<p><span style=\"font-weight: 400\">In order to enable a table which might be currently disabled, we use enable command.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; enable 't1'\nhbase&gt; enable 'ns1:t1'<\/pre>\n<p><strong>x.\u00a0enable_all<\/strong><br \/>\n<span style=\"font-weight: 400\">By matching the given regex, it enables all of the tables :<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; enable_all 't.*'\nhbase&gt; enable_all 'ns:t.*'\nhbase&gt; enable_all 'ns:.*'<\/pre>\n<p><strong>xi.\u00a0exists<\/strong><br \/>\n<span style=\"font-weight: 400\">We use \u201cExists\u201d to check the existence of an HBase Table<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; exists 't1'\nhbase&gt; exists 'ns1:t1'<\/pre>\n<p><strong>xii.\u00a0get_table<\/strong><br \/>\n<span style=\"font-weight: 400\">\u201cGet_table\u201d gets the given table name and also return it as an actual object to be manipulated by the user.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase(main):014:0&gt; t1 = get_table 'blog'\n0 row(s) in 0.0130 seconds\n=&gt; Hbase::Table - blog\nhbase(main):015:0&gt;<\/pre>\n<p><strong>xiii.\u00a0is_disabled<\/strong><br \/>\n<span style=\"font-weight: 400\">We use this command to know whether an HBase table is disabled or not.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; is_disabled 't1'\nhbase&gt; is_disabled 'ns1:t1'<\/pre>\n<p><strong>xiv.\u00a0is_enabled<\/strong><br \/>\n<span style=\"font-weight: 400\">\u201cIs_enabled\u201d command helps to know whether an HBase table is enabled or not.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; is_enabled 't1'\nhbase&gt; is_enabled 'ns1:t1'<\/pre>\n<p><strong>xv.\u00a0list<\/strong><br \/>\n<span style=\"font-weight: 400\">We use this command to list all tables in hbase. Moreover, to filter the output, optional regular expression parameter could be used. <\/span><br \/>\n<strong>For example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; list\nhbase&gt; list 'abc.*'\nhbase&gt; list 'ns:abc.*'\nhbase&gt; list 'ns:.*'<\/pre>\n<p><strong>xvi.\u00a0show_filters<\/strong><\/p>\n<p><span style=\"font-weight: 400\">This command shows all the filters in Hbase. <\/span><br \/>\n<strong>For example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; show_filters\nColumnPrefixFilter\nTimestampsFilter\nPageFilter\n.....\nKeyOnlyFilter<\/pre>\n<h3>c. DML Commands<\/h3>\n<p>There are some <strong>Data Manipulation HBase<\/strong> Commands:<br \/>\n<strong>i.\u00a0append<\/strong><br \/>\n<span style=\"font-weight: 400\">\u201cappend\u201d command appends a cell \u2018value\u2019 at specified table\/row\/column coordinates.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; append 't1', 'r1', 'c1', 'value', ATTRIBUTES=&gt;{'mykey'=&gt;'myvalue'}\nhbase&gt; append 't1', 'r1', 'c1', 'value', {VISIBILITY=&gt;'PRIVATE|SECRET'}<\/pre>\n<p><strong>ii.\u00a0count<\/strong><br \/>\n<span style=\"font-weight: 400\">This command counts the number of rows in a table and here return value is the number of rows. <\/span><br \/>\n<strong>For example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; count 'ns1:t1'\nhbase&gt; count 't1'\nhbase&gt; count 't1', INTERVAL =&gt; 100000\nhbase&gt; count 't1', CACHE =&gt; 1000\nhbase&gt; count 't1', INTERVAL =&gt; 10, CACHE =&gt; 1000<\/pre>\n<p><strong>iii.\u00a0delete<\/strong><br \/>\n<span style=\"font-weight: 400\">\u201cDelete\u201d command, puts a delete cell value at specified table\/row\/column and optionally timestamp coordinates.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; delete 'ns1:t1', 'r1', 'c1', ts1\nhbase&gt; delete 't1', 'r1', 'c1', ts1\nhbase&gt; delete 't1', 'r1', 'c1', ts1, {VISIBILITY=&gt;'PRIVATE|SECRET'}<\/pre>\n<p><strong>iv.\u00a0deleteall<\/strong><br \/>\n<span style=\"font-weight: 400\">This command deletes all cells in a given row; pass a table name, row, and optionally a column and timestamp. <\/span><br \/>\n<strong>For Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; deleteall 'ns1:t1', 'r1'\nhbase&gt; deleteall 't1', 'r1'\nhbase&gt; deleteall 't1', 'r1', 'c1'\nhbase&gt; deleteall 't1', 'r1', 'c1', ts1\nhbase&gt; deleteall 't1', 'r1', 'c1', ts1, {VISIBILITY=&gt;'PRIVATE|SECRET'}<\/pre>\n<p><strong>v.\u00a0get<\/strong><br \/>\n<span style=\"font-weight: 400\">A Get command, get a row or cell contents; pass the table name, row, and optionally a dictionary of column(s), timestamp, timerange, and versions. <\/span><br \/>\n<strong>For example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; get 'ns1:t1', 'r1'\nhbase&gt; get 't1', 'r1'\nhbase&gt; get 't1', 'r1', {TIMERANGE =&gt; [ts1, ts2]}\nhbase&gt; get 't1', 'r1', {COLUMN =&gt; 'c1'}\nhbase&gt; get 't1', 'r1', {COLUMN =&gt; ['c1', 'c2', 'c3']}\nhbase&gt; get 't1', 'r1', {COLUMN =&gt; 'c1', TIMESTAMP =&gt; ts1}\nhbase&gt; get 't1', 'r1', {COLUMN =&gt; 'c1', TIMERANGE =&gt; [ts1, ts2], VERSIONS =&gt; 4}\nhbase&gt; get 't1', 'r1', {COLUMN =&gt; 'c1', TIMESTAMP =&gt; ts1, VERSIONS =&gt; 4}\nhbase&gt; get 't1', 'r1', {FILTER =&gt; \"ValueFilter(=, 'binary:abc')\"}\nhbase&gt; get 't1', 'r1', 'c1'\nhbase&gt; get 't1', 'r1', 'c1', 'c2'\nhbase&gt; get 't1', 'r1', ['c1', 'c2']\nhbsase&gt; get 't1','r1', {COLUMN =&gt; 'c1', ATTRIBUTES =&gt; {'mykey'=&gt;'myvalue'}}\nhbsase&gt; get 't1','r1', {COLUMN =&gt; 'c1', AUTHORIZATIONS =&gt; ['PRIVATE','SECRET']}<\/pre>\n<p><strong>vi.\u00a0get_counter<\/strong><br \/>\n<span style=\"font-weight: 400\">This command returns a counter cell value at specified table\/row\/column coordinates.<\/span><b>\u00a0<\/b><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; get_counter 'ns1:t1', 'r1', 'c1'\n hbase&gt; get_counter 't1', 'r1', 'c1'<\/pre>\n<p><strong>vii.\u00a0incr<\/strong><br \/>\n<span style=\"font-weight: 400\">Simply, it increments a cell \u2018value\u2019 at specified table\/row\/column coordinates. <\/span><br \/>\n<strong>For example, <\/strong><br \/>\n<span style=\"font-weight: 400\">In order to increment a cell value in table \u2018ns1:t1\u2019 or \u2018t1\u2019 at row \u2018r1\u2019 under column \u2018c1\u2019 by 1 (can be omitted) or 10, perform:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; incr 'ns1:t1', 'r1', 'c1'\nhbase&gt; incr 't1', 'r1', 'c1'\nhbase&gt; incr 't1', 'r1', 'c1', 1\nhbase&gt; incr 't1', 'r1', 'c1', 10\nhbase&gt; incr 't1', 'r1', 'c1', 10, {ATTRIBUTES=&gt;{'mykey'=&gt;'myvalue'}}\nhbase&gt; incr 't1', 'r1', 'c1', {ATTRIBUTES=&gt;{'mykey'=&gt;'myvalue'}}\nhbase&gt; incr 't1', 'r1', 'c1', 10, {VISIBILITY=&gt;'PRIVATE|SECRET'}<\/pre>\n<p><strong>viii.\u00a0put<\/strong><br \/>\n<span style=\"font-weight: 400\">Put command, puts a cell \u2018value\u2019 at specified table\/row\/column and optionally timestamp coordinates. <\/span><br \/>\n<span style=\"font-weight: 400\"><strong>For Example,<\/strong> <\/span><br \/>\n<span style=\"font-weight: 400\">In order to put a cell value into table \u2018ns1:t1\u2019 or \u2018t1\u2019 at row \u2018r1\u2019 under column \u2018c1\u2019 marked with the time \u2018ts1\u2019, perform:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; put 'ns1:t1', 'r1', 'c1', 'value'\nhbase&gt; put 't1', 'r1', 'c1', 'value'\nhbase&gt; put 't1', 'r1', 'c1', 'value', ts1\nhbase&gt; put 't1', 'r1', 'c1', 'value', {ATTRIBUTES=&gt;{'mykey'=&gt;'myvalue'}}\nhbase&gt; put 't1', 'r1', 'c1', 'value', ts1, {ATTRIBUTES=&gt;{'mykey'=&gt;'myvalue'}}\nhbase&gt; put 't1', 'r1', 'c1', 'value', ts1, {VISIBILITY=&gt;'PRIVATE|SECRET'}<\/pre>\n<p><strong>ix.\u00a0truncate<\/strong><br \/>\n<span style=\"font-weight: 400\">This command disables, drops and recreates the specified table. Make sure, the schema will be present but not the records, just after truncate of an HBase table.<\/span><br \/>\n<strong>x.\u00a0truncate_preserve<\/strong><br \/>\n<span style=\"font-weight: 400\">While still maintaining the previous region boundaries, this command disables, drops and recreates the specified table.<\/span><\/p>\n<h2><span style=\"font-weight: 400\">Other HBase Commands<\/span><\/h2>\n<div id=\"attachment_18565\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/More-HBase-Commands-01.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-18565\" class=\"wp-image-18565 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/More-HBase-Commands-01.jpg\" alt=\"HBase Commands\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/More-HBase-Commands-01.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/More-HBase-Commands-01-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/More-HBase-Commands-01-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/More-HBase-Commands-01-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/More-HBase-Commands-01-1024x536.jpg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-18565\" class=\"wp-caption-text\">HBase Commands<\/p><\/div>\n<h3>a.\u00a0Admin Commands<\/h3>\n<ol>\n<li><span style=\"font-weight: 400\"> assignbalance_switch<\/span><\/li>\n<li><span style=\"font-weight: 400\"> balancer<\/span><\/li>\n<li><span style=\"font-weight: 400\"> catalogjanitor_enabled<\/span><\/li>\n<li><span style=\"font-weight: 400\"> catalogjanitor_run<\/span><\/li>\n<li><span style=\"font-weight: 400\"> catalogjanitor_switch<\/span><\/li>\n<li><span style=\"font-weight: 400\"> close_region<\/span><\/li>\n<li><span style=\"font-weight: 400\"> compact<\/span><\/li>\n<li><span style=\"font-weight: 400\"> flush<\/span><\/li>\n<li><span style=\"font-weight: 400\"> hlog_roll<\/span><\/li>\n<li><span style=\"font-weight: 400\"> major_compact<\/span><\/li>\n<li><span style=\"font-weight: 400\"> merge_region<\/span><\/li>\n<li><span style=\"font-weight: 400\"> move<\/span><\/li>\n<li><span style=\"font-weight: 400\"> split<\/span><\/li>\n<li><span style=\"font-weight: 400\"> trace<\/span><\/li>\n<li><span style=\"font-weight: 400\"> unassign<\/span><\/li>\n<li><span style=\"font-weight: 400\"> zk_dump<\/span><\/li>\n<\/ol>\n<h3>b. Replication Commands<\/h3>\n<ol>\n<li><span style=\"font-weight: 400\"> add_peer<\/span><\/li>\n<li><span style=\"font-weight: 400\"> disable_peer<\/span><\/li>\n<li><span style=\"font-weight: 400\"> enable_peer<\/span><\/li>\n<li><span style=\"font-weight: 400\"> list_peers<\/span><\/li>\n<li><span style=\"font-weight: 400\"> list_replicated_tables<\/span><\/li>\n<li><span style=\"font-weight: 400\"> remove_peer<\/span><\/li>\n<li><span style=\"font-weight: 400\"> set_peer_tableCFs<\/span><\/li>\n<li><span style=\"font-weight: 400\"> show_peer_tableCFs<\/span><\/li>\n<\/ol>\n<h3>c.\u00a0Snapshot Commands<\/h3>\n<ol>\n<li><span style=\"font-weight: 400\"> clone_snapshot<\/span><\/li>\n<li><span style=\"font-weight: 400\"> delete_snapshot<\/span><\/li>\n<li><span style=\"font-weight: 400\"> list_snapshots<\/span><\/li>\n<li><span style=\"font-weight: 400\"> rename_snapshot<\/span><\/li>\n<li><span style=\"font-weight: 400\"> restore_snapshot<\/span><\/li>\n<li><span style=\"font-weight: 400\"> snapshot<\/span><\/li>\n<\/ol>\n<h3>d. Visibility Labels Commands<\/h3>\n<p>A. add_labels<br \/>\n<span style=\"font-weight: 400\">B. clear_auths<\/span><\/p>\n<ol>\n<li><span style=\"font-weight: 400\"> get_auths<\/span><\/li>\n<li><span style=\"font-weight: 400\"> set_auths<\/span><\/li>\n<li><span style=\"font-weight: 400\"> set_visibility<\/span><\/li>\n<\/ol>\n<h3>e.\u00a0Security Commands<\/h3>\n<p><strong>A. grant<\/strong><br \/>\n<span style=\"font-weight: 400\">This command, grant users specific rights.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">grant &lt;user&gt; &lt;permissions&gt; [&lt;@namespace&gt; [&lt;table&gt; [&lt;column family&gt; [&lt;column qualifier&gt;]]]<\/pre>\n<p><span style=\"font-weight: 400\">However, make sure, permissions is either zero or more letters from the set \u201cRWXCA\u201d.<\/span><br \/>\n<b>READ(\u2018R\u2019), WRITE(\u2018W\u2019), EXEC(\u2018X\u2019), CREATE(\u2018C\u2019), ADMIN(\u2018A\u2019)<\/b><br \/>\n<b>Note:<\/b><span style=\"font-weight: 400\"> It is must that a namespace always precede with \u2018@\u2019 character.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">hbase&gt; grant 'bobsmith', 'RWXCA'\nhbase&gt; grant 'bobsmith', 'RWXCA', '@ns1'\nhbase&gt; grant 'bobsmith', 'RW', 't1', 'f1', 'col1'\nhbase&gt; grant 'bobsmith', 'RW', 'ns1:t1', 'f1', 'col1'<\/pre>\n<p><strong>B. revoke<\/strong><br \/>\n<span style=\"font-weight: 400\">Revoke command, \u00a0revokes a user\u2019s access rights.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">revoke &lt;user&gt; [&lt;table&gt; [&lt;column family&gt; [&lt;column qualifier&gt;]]\nhbase&gt; revoke 'bobsmith'\nhbase&gt; revoke 'bobsmith', 't1', 'f1', 'col1'\nhbase&gt; revoke 'bobsmith', 'ns1:t1', 'f1', 'col1'<\/pre>\n<p><strong>C. user_permission<\/strong><br \/>\n<span style=\"font-weight: 400\">This command shows all permissions for the particular user.<\/span><br \/>\n<b>The syntax of User Permission:<\/b><\/p>\n<pre class=\"EnlighterJSRAW\">user_permission &lt;table&gt;\nhbase&gt; user_permission\nhbase&gt; user_permission 'table1'\nhbase&gt; user_permission 'namespace1:table1'\nhbase&gt; user_permission '.*'\nhbase&gt; user_permission '^[A-C].*'<\/pre>\n<p>So, this was all about HBase commands. Hope you like our explanation.<\/p>\n<h2><span style=\"font-weight: 400\">Conclusion: HBase Commands<\/span><\/h2>\n<p><span style=\"font-weight: 400\">Hence, in this HBase tutorial, we have seen all the HBase commands. Also, we discussed HBase commands with examples as well as syntax. Hope these will help you to get familiarize with HBase well. Still, if any doubt regarding HBase commands, ask in the comment tab.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our last HBase tutorial, we discussed HBase Shell. Today, we will see HBase Commands with examples and syntax. Basically, to get familiarized with HBase, we need to learn HBase Commands. There are several&#46;&#46;&#46;<\/p>\n","protected":false},"author":7,"featured_media":18547,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[2676,3304,3330,5038,5405,5407,5408,5445,5484,9343,14033],"class_list":["post-16916","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hbase","tag-commands-in-hbase","tag-data-definition-commands","tag-data-manipulation-commands","tag-general-commands","tag-hbase-commands","tag-hbase-commands-syntax","tag-hbase-commands-with-example","tag-hbase-list-name-space","tag-hbase-shell-ommands","tag-other-hbase-shell-commands","tag-syntax-for-hbase-commands"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>HBase Commands - General, Data Definition, &amp; Data Manipulation - DataFlair<\/title>\n<meta name=\"description\" content=\"HBase Commands tutorial:General Commands,Data Definition Commands,Data Manipulation Commands,HBase Shell Commands,Admin Commands,Replication Commands,\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/hbase-commands\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HBase Commands - General, Data Definition, &amp; Data Manipulation - DataFlair\" \/>\n<meta property=\"og:description\" content=\"HBase Commands tutorial:General Commands,Data Definition Commands,Data Manipulation Commands,HBase Shell Commands,Admin Commands,Replication Commands,\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/hbase-commands\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-05-25T10:51:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/Hbase-Commands-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HBase Commands - General, Data Definition, &amp; Data Manipulation - DataFlair","description":"HBase Commands tutorial:General Commands,Data Definition Commands,Data Manipulation Commands,HBase Shell Commands,Admin Commands,Replication Commands,","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/hbase-commands\/","og_locale":"en_US","og_type":"article","og_title":"HBase Commands - General, Data Definition, &amp; Data Manipulation - DataFlair","og_description":"HBase Commands tutorial:General Commands,Data Definition Commands,Data Manipulation Commands,HBase Shell Commands,Admin Commands,Replication Commands,","og_url":"https:\/\/data-flair.training\/blogs\/hbase-commands\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-05-25T10:51:33+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/Hbase-Commands-1.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/hbase-commands\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/hbase-commands\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd"},"headline":"HBase Commands &#8211; General, Data Definition, &amp; Data Manipulation","datePublished":"2018-05-25T10:51:33+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/hbase-commands\/"},"wordCount":1255,"commentCount":1,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/hbase-commands\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/Hbase-Commands-1.jpg","keywords":["Commands in HBase","Data Definition Commands","Data Manipulation Commands","General Commands","hbase commands","HBase commands syntax","Hbase commands with example","HBase list name space","HBase shell ommands","Other HBase Shell Commands","syntax for HBase Commands"],"articleSection":["HBase Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/hbase-commands\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/hbase-commands\/","url":"https:\/\/data-flair.training\/blogs\/hbase-commands\/","name":"HBase Commands - General, Data Definition, &amp; Data Manipulation - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/hbase-commands\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/hbase-commands\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/Hbase-Commands-1.jpg","datePublished":"2018-05-25T10:51:33+00:00","description":"HBase Commands tutorial:General Commands,Data Definition Commands,Data Manipulation Commands,HBase Shell Commands,Admin Commands,Replication Commands,","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/hbase-commands\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/hbase-commands\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/hbase-commands\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/Hbase-Commands-1.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/Hbase-Commands-1.jpg","width":1200,"height":628,"caption":"HBase Commands - General, Data Definition, &amp; Data Manipulation"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/hbase-commands\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"HBase Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/hbase\/"},{"@type":"ListItem","position":3,"name":"HBase Commands &#8211; General, Data Definition, &amp; Data Manipulation"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team specializes in creating clear, actionable content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Backed by industry expertise, we make learning easy and career-oriented for beginners and pros alike.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam3\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/16916","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=16916"}],"version-history":[{"count":0,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/16916\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/18547"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=16916"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=16916"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=16916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}