<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>devkuma – NoSQL</title>
    <link>https://www.devkuma.com/en/tags/nosql/</link>
    <image>
      <url>https://www.devkuma.com/en/tags/nosql/logo/180x180.jpg</url>
      <title>NoSQL</title>
      <link>https://www.devkuma.com/en/tags/nosql/</link>
    </image>
    <description>Recent content in NoSQL on devkuma</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <managingEditor>kc@example.com (kc kim)</managingEditor>
    <webMaster>kc@example.com (kc kim)</webMaster>
    <copyright>The devkuma</copyright>
    
	  <atom:link href="https://www.devkuma.com/en/tags/nosql/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>MongoDB Sharding Overview</title>
      <link>https://www.devkuma.com/en/docs/mongodb/sharding/intro/</link>
      <pubDate>Wed, 19 Jan 2022 09:19:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/mongodb/sharding/intro/</guid>
      <description>
        
        
        &lt;h2 id=&#34;scaling&#34;&gt;Scaling&lt;/h2&gt;
&lt;p&gt;Before talking about sharding, let&amp;rsquo;s first look at scaling.&lt;/p&gt;
&lt;p&gt;In general, when a system grows larger, scaling becomes necessary. Scaling methods are broadly divided into two types: vertical scaling and horizontal scaling.&lt;/p&gt;
&lt;h3 id=&#34;vertical-scaling&#34;&gt;Vertical scaling&lt;/h3&gt;
&lt;p&gt;Vertical scaling is a method of replacing CPU, RAM, or storage with higher-performance components. Scaling is simple, but there are limits to CPU and memory in the first place, so there is a practical performance limit.&lt;/p&gt;
&lt;h3 id=&#34;horizontal-scaling&#34;&gt;Horizontal scaling&lt;/h3&gt;
&lt;p&gt;Horizontal scaling divides a system by data set and processes data in parallel from multiple servers. Overall performance can be better than vertical scaling, but the more it scales, the more complex it becomes, making management difficult.&lt;/p&gt;
&lt;h2 id=&#34;what-is-sharding&#34;&gt;What is sharding?&lt;/h2&gt;
&lt;p&gt;Sharding is a horizontal scaling structure that distributes data across multiple servers.&lt;/p&gt;
&lt;p&gt;Sharding has three major benefits: read/write processing becomes faster and performance is easier to improve, storage is easier to expand, and availability is high. Each is described below. MongoDB supports sharding, or horizontal scaling, as a standard feature.&lt;/p&gt;
&lt;h3 id=&#34;reads-and-writes&#34;&gt;Reads and writes&lt;/h3&gt;
&lt;p&gt;When data is distributed and stored in a shard cluster, read/write processing, or file I/O, can be distributed. File read/write operations are slow, so distributing them enables faster reads and writes. In addition, when read/write load increases, the system can horizontally scale by adding servers.&lt;/p&gt;
&lt;h3 id=&#34;storage&#34;&gt;Storage&lt;/h3&gt;
&lt;p&gt;Fragmented data is distributed and stored in the shard cluster. Even when the amount of data increases, the system can horizontally scale by adding servers.&lt;/p&gt;
&lt;h3 id=&#34;high-availability&#34;&gt;High availability&lt;/h3&gt;
&lt;p&gt;Shard clusters allow partial reads and writes. If a shard cannot be read from or written to, data can also be retrieved from a shard server that can perform the work.&lt;/p&gt;
&lt;h2 id=&#34;shard-cluster&#34;&gt;Shard cluster&lt;/h2&gt;
&lt;p&gt;MongoDB sharding consists of three components: shards, routers, and config servers. Their relationships and explanations are as follows.&lt;/p&gt;
&lt;h3 id=&#34;shard&#34;&gt;Shard&lt;/h3&gt;
&lt;p&gt;Shard servers store fragmented data, or chunks, from split collections. A shard server can be configured as a replica set.&lt;/p&gt;
&lt;h3 id=&#34;router&#34;&gt;Router&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;mongos&lt;/code&gt; is a query router that provides an interface from applications to the shard cluster. When accessing a shard cluster, access always goes through &lt;code&gt;mongos&lt;/code&gt;. Even collections that are not sharded must be accessed through &lt;code&gt;mongos&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;config-server&#34;&gt;Config server&lt;/h3&gt;
&lt;p&gt;Config servers store metadata about shard cluster settings. Information such as which shard server holds the data is also stored on these servers. Since MongoDB 3.4, config servers are configured as replica sets.&lt;/p&gt;
&lt;h2 id=&#34;shard-key&#34;&gt;Shard key&lt;/h2&gt;
&lt;p&gt;A shard key is information used as a key when distributing data and storing it on shard servers. MongoDB uses the shard key to distribute documents within a collection.&lt;/p&gt;
&lt;p&gt;The following figure is a simple example distributed by an x shard key.&lt;/p&gt;
&lt;p&gt;&amp;hellip; figure &amp;hellip;&lt;/p&gt;
&lt;p&gt;The important points about shard keys are the following three.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;They consist of immutable fields or groups of fields that exist in every document.&lt;/li&gt;
&lt;li&gt;Once a shard key is chosen and distribution is performed, the shard key cannot be changed again.&lt;/li&gt;
&lt;li&gt;A sharded collection requires an index that includes the shard key.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Needless to say, shard key selection greatly affects performance, efficiency, and scalability. If the shard key is chosen poorly, data can become biased toward specific shard servers, as described above, causing inefficient behavior.&lt;/p&gt;
&lt;h2 id=&#34;chunks&#34;&gt;Chunks&lt;/h2&gt;
&lt;p&gt;As mentioned above, MongoDB distributes data storage by shard key value, but it groups data into units called chunks and distributes those chunks across shard servers. MongoDB automatically moves chunks so that they are balanced within the shard cluster.&lt;/p&gt;
&lt;p&gt;The image of splitting data into chunks and distributing them across shards is as follows.&lt;/p&gt;
&lt;p&gt;&amp;hellip; figure &amp;hellip;&lt;/p&gt;
&lt;h2 id=&#34;operation-constraints-on-sharded-data&#34;&gt;Operation constraints on sharded data&lt;/h2&gt;
&lt;p&gt;There are several restrictions on operations for sharded data.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;group&lt;/code&gt; command cannot be used.&lt;/li&gt;
&lt;li&gt;Use MapReduce instead of aggregate.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;updateOne&lt;/code&gt; or &lt;code&gt;deleteOne&lt;/code&gt; must specify &lt;code&gt;_id&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;An error occurs if the shard key &lt;code&gt;_id&lt;/code&gt; is not included.&lt;/li&gt;
&lt;li&gt;A sharded collection requires a unique index.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;sharded-and-unsharded-collections&#34;&gt;Sharded and unsharded collections&lt;/h2&gt;
&lt;p&gt;MongoDB can mix sharded collections and unsharded collections. Sharded collections are distributed and stored in the shard cluster, while unsharded collections are stored on the primary shard.&lt;/p&gt;
&lt;h2 id=&#34;data-distribution-methods&#34;&gt;Data distribution methods&lt;/h2&gt;
&lt;p&gt;There are two distribution methods for sharding: hashed sharding and ranged sharding.&lt;/p&gt;
&lt;h3 id=&#34;hashed-sharding&#34;&gt;Hashed sharding&lt;/h3&gt;
&lt;p&gt;Hashed sharding distributes data using the hash value of the shard key. With hashed sharding, chunks tend to become scattered even when shard key values are close. In other words, it is a distribution method that makes distribution easier when the shard key changes monotonically. On the other hand, because data is easy to distribute, broadcast operations may increase depending on the data structure and retrieval method.&lt;/p&gt;
&lt;h3 id=&#34;ranged-sharding&#34;&gt;Ranged sharding&lt;/h3&gt;
&lt;p&gt;Ranged sharding distributes data according to the shard key range. Unlike hashed sharding, when shard key values are close, they are more likely to exist in the same chunk. If the shard key is chosen poorly, load can become concentrated on specific servers even though sharding is being used as a distribution technique.&lt;/p&gt;

      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>MongoDB</category>
      
    </item>
    
    <item>
      <title>How to Use the MongoDB mongod Command</title>
      <link>https://www.devkuma.com/en/docs/mongodb/how-use-mongod/</link>
      <pubDate>Thu, 13 Jan 2022 07:57:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/mongodb/how-use-mongod/</guid>
      <description>
        
        
        &lt;p&gt;This article summarizes the basic main usage and options of the &lt;code&gt;mongod&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;Only the important options are covered here. For many other options, refer to the &lt;a href=&#34;https://docs.mongodb.com/manual/reference/program/mongod/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;official manual&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;basic-options&#34;&gt;Basic options&lt;/h2&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Option&lt;/th&gt;
          &lt;th&gt;Description&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--config &amp;lt;filename&amp;gt;&lt;/code&gt;, &lt;code&gt;-f &amp;lt;filename&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Specifies a configuration file that contains startup options.&lt;br&gt;If the configuration file path contains spaces, enclose it in double quotes (&lt;code&gt;&amp;quot;&lt;/code&gt;).&lt;br&gt;The configuration file uses ASCII encoding. Non-ASCII encodings such as UTF-8 are not supported. If both a configuration file and startup options are specified, the startup option values take precedence.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--port &amp;lt;port&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Default: 27017&lt;br&gt;Specifies the port number on which MongoDB waits for TCP connections.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--maxConns &amp;lt;number&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Specifies the number of concurrent connections MongoDB allows.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--logpath &amp;lt;path&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Specifies the path where the log file is output.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--logappend&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;When MongoDB is restarted, logging continues at the end of the existing log file.&lt;br&gt;By default, MongoDB backs up the existing log file and creates a new log file when restarted.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--slowms &amp;lt;integer&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Default: 100&lt;br&gt;Specifies the profiling threshold in milliseconds.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--profile &amp;lt;level&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Default: 0&lt;br&gt;Changes the database profiling level.&lt;br&gt;&lt;br&gt;- 0: Off. Does not perform profiling.&lt;br&gt;- 1: On. Profiles only slow operations.&lt;br&gt;- 2: On. Profiles all operations.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--auth&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Uses database access control.&lt;br&gt;User configuration changes are performed with the &lt;code&gt;mongo&lt;/code&gt; command. If no user exists, only access through &lt;code&gt;localhost&lt;/code&gt; is permitted.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--bind_ip &amp;lt;address&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Default: all connections&lt;br&gt;Specifies the IP address where MongoDB accepts connections.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--dbpath &amp;lt;path&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Default: &lt;code&gt;C:\data\db&lt;/code&gt;&lt;br&gt;Specifies the storage path where database files are stored.&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;windows-service-installation-options&#34;&gt;Windows service installation options&lt;/h2&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Option&lt;/th&gt;
          &lt;th&gt;Description&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--install&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Adds MongoDB as a Windows service.&lt;br&gt;If needed, specify &lt;code&gt;--serviceName&lt;/code&gt; and &lt;code&gt;--serviceDisplayName&lt;/code&gt; at the same time.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--remove&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Removes the MongoDB service from Windows services.&lt;br&gt;If a non-default name was installed with &lt;code&gt;--serviceName&lt;/code&gt;, specify &lt;code&gt;--serviceName&lt;/code&gt;.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--serviceName &amp;lt;name&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Default: MongoDB&lt;br&gt;Specifies the service name.&lt;br&gt;The name specified here is used as the argument to &lt;code&gt;net start &amp;lt;name&amp;gt;&lt;/code&gt; and &lt;code&gt;net stop &amp;lt;name&amp;gt;&lt;/code&gt;.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--serviceDisplayName &amp;lt;name&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Default: MongoDB&lt;br&gt;Specifies the name displayed in the service management tool.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--serviceDescription &amp;lt;description&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Default: MongoDB Server&lt;br&gt;Specifies the string displayed in the description of the service management tool. If it contains spaces, enclose it in double quotes (&lt;code&gt;&amp;quot;&lt;/code&gt;).&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--serviceUser &amp;lt;user&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Specifies the user that runs MongoDB.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--servicePassword &amp;lt;password&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Specifies the password for the user that runs MongoDB.&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.mongodb.com/manual/reference/program/mongod/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MongoDB Manual - mongod&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.mongodb.com/manual/reference/program/mongod.exe/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MongoDB Manual - mongod.exe&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>MongoDB</category>
      
    </item>
    
    <item>
      <title>MongoDB Features</title>
      <link>https://www.devkuma.com/en/docs/mongodb/features/</link>
      <pubDate>Sun, 09 Jan 2022 18:38:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/mongodb/features/</guid>
      <description>
        
        
        &lt;p&gt;This article looks at the features of MongoDB.&lt;/p&gt;
&lt;p&gt;The main features, also described on the official site, can be summarized as follows.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Document database (NoSQL)&lt;/li&gt;
&lt;li&gt;Special queries&lt;/li&gt;
&lt;li&gt;High performance&lt;/li&gt;
&lt;li&gt;High availability&lt;/li&gt;
&lt;li&gt;Horizontal scalability&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;document-database-nosql&#34;&gt;Document database (NoSQL)&lt;/h2&gt;
&lt;p&gt;MongoDB is a document-format database that can store key-value combinations as they are, like JSON. Values can take many forms. For example, it can store numbers and strings, as well as arrays and objects. These value types can also be changed dynamically, and multiple types can be placed under the same field name. In other words, it is a schemaless document database.&lt;/p&gt;
&lt;h2 id=&#34;performance&#34;&gt;Performance&lt;/h2&gt;
&lt;p&gt;The following features are implemented to provide performance.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Reduced I/O processing through embedded data models&lt;/li&gt;
&lt;li&gt;Index support&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;One of MongoDB&amp;rsquo;s characteristics is that it supports indexes even though it is NoSQL. You can also specify a unique key in relation to indexes.&lt;/p&gt;
&lt;h2 id=&#34;special-queries&#34;&gt;Special queries&lt;/h2&gt;
&lt;p&gt;MongoDB searches the database using special queries specified in JSON format. Queries can perform basic CRUD operations as well as the following distinctive operations.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Aggregation and Map-Reduce&lt;/li&gt;
&lt;li&gt;String search using text indexes&lt;/li&gt;
&lt;li&gt;Geospatial queries&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Aggregation and Map-Reduce can perform various statistics on stored data. Query assembly is implemented in a distinctive way, so it takes some getting used to, but the processing order is pipelined, which makes the code easier to follow.&lt;/p&gt;
&lt;p&gt;Geospatial queries can use the built-in GeoJSON format to search for points within a range.&lt;/p&gt;
&lt;h2 id=&#34;availability&#34;&gt;Availability&lt;/h2&gt;
&lt;p&gt;MongoDB provides replication through a feature called replica sets. Replica sets provide automatic failover and data redundancy.&lt;/p&gt;
&lt;h2 id=&#34;horizontal-scaling&#34;&gt;Horizontal scaling&lt;/h2&gt;
&lt;p&gt;Horizontal scaling means that performance can be improved by adding machines. MongoDB provides horizontal scalability through a core feature called sharding.&lt;/p&gt;
&lt;h2 id=&#34;support-for-multiple-storage-engines&#34;&gt;Support for multiple storage engines&lt;/h2&gt;
&lt;p&gt;MongoDB supports multiple storage engines. In addition to commonly used file systems, you can choose an in-memory engine. It also exposes a storage engine API, so third-party storage engines can be created.&lt;/p&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.mongodb.com/v3.2/introduction/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MongoDB - Introduction to MongoDB&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.tutorialsjar.com/key-features-of-mongodb/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;TutorialsJar - What Are The Top 10 Key Features Of MongoDB?&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>MongoDB</category>
      
    </item>
    
    <item>
      <title>What is NoSQL?</title>
      <link>https://www.devkuma.com/en/docs/nosql/</link>
      <pubDate>Fri, 04 Jun 2021 08:26:25 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/nosql/</guid>
      <description>
        
        
        &lt;h2 id=&#34;what-is-nosql&#34;&gt;What is NoSQL?&lt;/h2&gt;
&lt;p&gt;NoSQL, interpreted as &amp;ldquo;Not only SQL,&amp;rdquo; refers broadly to non-relational databases. In general, non-relational databases refer to all databases except relational databases.&lt;/p&gt;
&lt;p&gt;Non-SQL and non-relational databases provide mechanisms for storing and retrieving data using consistency models that are less restrictive than traditional relational databases.&lt;/p&gt;
&lt;h2 id=&#34;classification-by-storage-method&#34;&gt;Classification by storage method&lt;/h2&gt;
&lt;p&gt;Examples of non-relational database data models are classified by storage method into documents, key-value, graphs, and others.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Document DB&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Adopts a collection data model structure such as JSON or XML.&lt;/li&gt;
&lt;li&gt;Originated from Lotus Notes.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.mongodb.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MongoDB&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;, &lt;a href=&#34;http://basex.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;BaseX&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;, and CouchDB are examples.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Key-Value DB&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The simplest type of solution where data is stored as key-value pairs.&lt;/li&gt;
&lt;li&gt;Originated from the Amazon Dynamo Paper.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://redis.io/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Redis&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt; and Memcached are examples.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Graph DB&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Originated from Euler and graph theory.&lt;/li&gt;
&lt;li&gt;Adopts Nodes, Relationship, and Key-Value data models.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://neo4j.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Neo4J&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt; and OrientDB are examples.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Wide Columnar Store&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Also called Big Table DB.&lt;/li&gt;
&lt;li&gt;Originated from Google&amp;rsquo;s BigTable Paper.&lt;/li&gt;
&lt;li&gt;Uses a Column Family data model developed from Key-Value.&lt;/li&gt;
&lt;li&gt;HBase, Cassandra, and ScyllaDB are examples.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;difference-between-rdb-and-nosql&#34;&gt;Difference between RDB and NoSQL&lt;/h2&gt;
&lt;p&gt;The characteristics of RDBs, or relational databases, and NoSQL, or non-relational databases, can be summarized as follows.&lt;/p&gt;
&lt;p&gt;RDB and NoSQL differ not only in data structure, but also in the meaning of data integrity and scaling.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Category&lt;/th&gt;
          &lt;th&gt;RDB&lt;/th&gt;
          &lt;th&gt;NoSQL&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Data structure&lt;/td&gt;
          &lt;td&gt;Represents data structure in table form. It uses &amp;ldquo;tables&amp;rdquo; and &amp;ldquo;connections between tables&amp;rdquo; to represent data structure.&lt;br&gt;&lt;strong&gt;RDB&lt;/strong&gt;&lt;br&gt;&lt;img src=&#34;https://www.devkuma.com/docs/nosql/rdb.png&#34; alt=&#34;RDB&#34;&gt;&lt;/td&gt;
          &lt;td&gt;Represents data structure in methods other than table form.&lt;br&gt;Representation methods include documents (XML, JSON), key-value, and graphs.&lt;br&gt;&lt;strong&gt;Document&lt;/strong&gt;&lt;br&gt;&lt;img src=&#34;https://www.devkuma.com/docs/nosql/nosql_document.png&#34; alt=&#34;nosql-document&#34;&gt;&lt;br&gt;&lt;strong&gt;Key-Value&lt;/strong&gt;&lt;br&gt;&lt;img src=&#34;https://www.devkuma.com/docs/nosql/nosql_key-value.png&#34; alt=&#34;Key-Value&#34;&gt;&lt;br&gt;&lt;strong&gt;Graph&lt;/strong&gt;&lt;br&gt;&lt;img src=&#34;https://www.devkuma.com/docs/nosql/nosql_graph.png&#34; alt=&#34;Graph&#34;&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;ACID characteristics&lt;/td&gt;
          &lt;td&gt;Strict management is performed to prevent data inconsistency.&lt;/td&gt;
          &lt;td&gt;Strict data integrity management, called eventual integrity, is not performed.&lt;br&gt;Speed is prioritized, and data is guaranteed to be consistent &amp;ldquo;eventually.&amp;rdquo;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Scaling&lt;/td&gt;
          &lt;td&gt;Vertical scaling, meaning increasing server specifications, is easy to perform.&lt;/td&gt;
          &lt;td&gt;Horizontal scaling, meaning increasing the number of servers, is a characteristic strength.&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;cap-theorem&#34;&gt;CAP theorem&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Consistency
&lt;ul&gt;
&lt;li&gt;Also called concurrency or sameness.&lt;/li&gt;
&lt;li&gt;Means guaranteeing that data queried by multiple clients at the same time is the same data.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Availability
&lt;ul&gt;
&lt;li&gt;Guarantees that all clients&amp;rsquo; read and write requests can always receive a response.&lt;/li&gt;
&lt;li&gt;Also called fault tolerance.&lt;/li&gt;
&lt;li&gt;Fault-tolerant NoSQL can provide normal service even when some nodes in the cluster fail.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Partition tolerance
&lt;ul&gt;
&lt;li&gt;Means that in systems operating in regionally partitioned network environments, the systems in each region must continue operating normally even if the network between two regions is disconnected or network data is lost.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://ko.wikipedia.org/wiki/NoSQL&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Wiki | NoSQL&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://aws.amazon.com/ko/nosql/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;AWS | What is NoSQL?&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>NoSQL</category>
      
    </item>
    
    <item>
      <title>Redis Overview</title>
      <link>https://www.devkuma.com/en/docs/redis/overview/</link>
      <pubDate>Mon, 24 May 2021 10:12:26 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/redis/overview/</guid>
      <description>
        
        
        &lt;h2 id=&#34;overview&#34;&gt;Overview&lt;/h2&gt;
&lt;p&gt;Redis stands for Remote Dictionary Server. It is an open source, non-relational database management system for storing and managing unstructured data in a key-value structure. It was first developed by Salvatore Sanfilippo in 2009. Since 2015, it has been supported by Redis Labs. Redis is used freely in many services.&lt;/p&gt;
&lt;h3 id=&#34;pareto-principle&#34;&gt;Pareto principle&lt;/h3&gt;
&lt;p&gt;The Pareto principle says that 80% of the phenomena that occur in society are caused by 20% of the causes. This also fits website access patterns.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;It is estimated that 80% of Internet traffic is access to only 20% of sites, and caching the data from these 20% of websites can dramatically improve efficiency.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Textbook for Infrastructure Engineers - Network Edition, 2017, Gilbut&lt;/p&gt;
&lt;p&gt;Therefore, storing commonly used data in Redis as a cache can be an efficient way to use resources.&lt;/p&gt;
&lt;h2 id=&#34;redis-features&#34;&gt;Redis features&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Redis is a key-value store NoSQL DB.
&lt;ul&gt;
&lt;li&gt;Supports a key-value structure for simple strings&lt;/li&gt;
&lt;li&gt;Supports writing binary data&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;It operates as a single thread.
&lt;ul&gt;
&lt;li&gt;It guarantees operation atomicity by operating as a single thread.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;It supports various data structures.
&lt;ul&gt;
&lt;li&gt;Collection support: List, Set, Sorted Set, Hash, and other data structures&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;High speed
&lt;ul&gt;
&lt;li&gt;It provides performance around 100,000 QPS.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Disk storage
&lt;ul&gt;
&lt;li&gt;Data can be stored persistently on disk.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Replication
&lt;ul&gt;
&lt;li&gt;Supports a master/slave structure that can replicate data to other nodes.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Sharding support
&lt;ul&gt;
&lt;li&gt;Supports data sharding through Redis Cluster.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Publish/Subscribe support
&lt;ul&gt;
&lt;li&gt;Can be used as a message broker&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Expire time
&lt;ul&gt;
&lt;li&gt;You can set an expiration time on a key so old data is automatically deleted.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Recovery is possible through data snapshots or AOF logs, so some persistence is guaranteed.&lt;/li&gt;
&lt;li&gt;In Java Spring, it is often used for session management and caching.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;why-are-collections-important&#34;&gt;Why are collections important?&lt;/h3&gt;
&lt;p&gt;Redis is an &lt;strong&gt;in-memory database&lt;/strong&gt;. That means all data is stored and queried in memory. It is much faster than traditional relational databases such as Oracle and MySQL because memory access is faster than disk access. However, speed is only one of Redis&amp;rsquo;s characteristics. The biggest difference from other in-memory databases such as Memcached is that it supports &lt;strong&gt;various data structures&lt;/strong&gt;. Redis stores various data structures in key-value form as shown below.&lt;/p&gt;
&lt;p&gt;Redis basically provides String, Bitmap, Hash, List, Set, and Sorted Set, and as versions have advanced, it now also supports types such as Geospatial Index, HyperLogLog, and Stream.&lt;/p&gt;
&lt;p&gt;Why is providing many data structures important? The reason is &lt;strong&gt;development convenience and difficulty&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;For example, if you implement a real-time ranking server with an RDBMS, you need to store data in the DB, sort it by the stored SCORE value, and read it again. As the number of records increases, this process becomes slower because it uses disk. You could write code directly to process data on the server with an in-memory approach, but using Redis Sorted Set is faster and simpler.&lt;/p&gt;
&lt;h3 id=&#34;redis-persistence&#34;&gt;Redis persistence&lt;/h3&gt;
&lt;p&gt;Redis uses RDB (Snapshot) and AOF (Append Only File) methods to store data on disk.&lt;br&gt;
Both methods internally use the &lt;code&gt;fork()&lt;/code&gt; function, so sufficient memory is required.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;RDB (Snapshot)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A method of moving data in memory to disk.&lt;/li&gt;
&lt;li&gt;Because snapshots capture the memory state as it is, they are useful for backup and recovery at a specific point in time, and they can load data into memory faster than AOF.&lt;/li&gt;
&lt;li&gt;If the server goes down, data changed between backed-up snapshots is lost.&lt;/li&gt;
&lt;li&gt;There are two methods.
&lt;ul&gt;
&lt;li&gt;SAVE: a blocking method that stops all Redis operations sequentially and stores the snapshot at that time on disk.&lt;/li&gt;
&lt;li&gt;BGSAVE: a non-blocking method that stores the memory snapshot at the time of execution on disk through a separate process.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;AOF (Append Only File)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A method of recording all Redis write/update operations as a log file.&lt;/li&gt;
&lt;li&gt;When the server starts, operations are replayed sequentially to recover data.&lt;/li&gt;
&lt;li&gt;Because it records every operation as it runs, logs can be kept up to the current point.&lt;/li&gt;
&lt;li&gt;Because it only appends to the log file, write speed is fast and data loss does not occur even if the server goes down.&lt;/li&gt;
&lt;li&gt;Because logs are recorded for all operations, the amount of data is very large.&lt;/li&gt;
&lt;li&gt;When the server restarts, all operations must be executed again, so restart speed is slow.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;using-redis-in-the-cloud&#34;&gt;Using Redis in the cloud&lt;/h2&gt;
&lt;p&gt;If you use Amazon Web Services or Microsoft Azure for application development, each cloud service provides a Redis service, so you can use it.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Cloud service&lt;/th&gt;
          &lt;th&gt;Service name&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Amazon Web Services&lt;/td&gt;
          &lt;td&gt;Amazon ElastiCache for Redis&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Microsoft Azure&lt;/td&gt;
          &lt;td&gt;Azure Redis Cache&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Of course, you can also install Redis directly on each cloud service&amp;rsquo;s compute instances, but considering management cost, choosing these services is recommended.&lt;/p&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://ko.wikipedia.org/wiki/%EB%A0%88%EB%94%94%EC%8A%A4&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Redis | Wikipedia&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;[redisgate][http://redisgate.kr/]&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>Redis</category>
      
      <category>NoSQL</category>
      
    </item>
    
    <item>
      <title>Designing Data-Intensive Applications</title>
      <link>https://www.devkuma.com/en/docs/data-intensive-application/</link>
      <pubDate>Wed, 03 Aug 2022 15:06:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/data-intensive-application/</guid>
      <description>
        
        
        &lt;p&gt;Core ideas behind reliable, scalable, and maintainable systems&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/data-intensive-application/book.jpg&#34; alt=&#34;Data-Intensive Applications&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://wikibook.co.kr/data-intensive-applications/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://wikibook.co.kr/data-intensive-applications/&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Group study members: Kim Kyung-cheol, Kim Min-gyu, Kim Jung-su, Kim Eun-taek, Park Su-min, Park Hyun-do, Lee Seung-ik, Lee Ho-jun, Jo Sung-jik, Hwang Yoon-ho&lt;/p&gt;
&lt;p&gt;&lt;em&gt;These materials were presented during a group study.&lt;/em&gt;&lt;/p&gt;

      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>Data</category>
      
      <category>RDB</category>
      
    </item>
    
    <item>
      <title>Installing Redis with Docker</title>
      <link>https://www.devkuma.com/en/docs/redis/install/</link>
      <pubDate>Fri, 31 Mar 2023 17:46:26 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/redis/install/</guid>
      <description>
        
        
        &lt;h2 id=&#34;installing-redis-with-docker&#34;&gt;Installing Redis with Docker&lt;/h2&gt;
&lt;p&gt;If you want a simple setup for learning or experimentation, using Docker to install Redis is recommended.&lt;/p&gt;
&lt;h3 id=&#34;downloading-the-redis-docker-image&#34;&gt;Downloading the Redis Docker image&lt;/h3&gt;
&lt;p&gt;Run the following command to download Redis Docker. This example uses the alpine version.&lt;/p&gt;
&lt;p&gt;If you want another version tag, refer to &lt;a href=&#34;https://hub.docker.com/_/redis/tags&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://hub.docker.com/_/redis/tags&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;% docker pull redis:alpine
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After downloading, check the image and you can see the list as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;% docker images
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;REPOSITORY         TAG       IMAGE ID       CREATED        SIZE
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;redis              alpine    a4cf5af74f5e   &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;2&lt;/span&gt; days ago     30.4MB
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;creating-and-running-a-redis-docker-container&#34;&gt;Creating and running a Redis Docker container&lt;/h3&gt;
&lt;p&gt;Run the following command.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;% docker run -d -p 6379:6379 --name&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;redis redis:alpine 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;-p&lt;/code&gt;: specify the port to expose on the host&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--name&lt;/code&gt;: specify the container name&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After running it, check the running container.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;% docker container ls
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;CONTAINER ID   IMAGE          COMMAND                  CREATED          STATUS          PORTS                    NAMES
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1df277cb625c   redis:alpine   &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;docker-entrypoint.s…&amp;#34;&lt;/span&gt;   &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;30&lt;/span&gt; seconds ago   Up &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;29&lt;/span&gt; seconds   0.0.0.0:6379-&amp;gt;6379/tcp   redis
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;connecting-to-redis-docker&#34;&gt;Connecting to Redis Docker&lt;/h2&gt;
&lt;h3 id=&#34;connecting-inside-the-redis-docker-container&#34;&gt;Connecting inside the Redis Docker container&lt;/h3&gt;
&lt;p&gt;Before connecting to Redis, connect inside the Docker container where Redis is installed.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;% docker &lt;span style=&#34;color:#204a87&#34;&gt;exec&lt;/span&gt; -it redis /bin/bash
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you see an error message like the following, try connecting with &lt;code&gt;/bin/sh&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;OCI runtime &lt;span style=&#34;color:#204a87&#34;&gt;exec&lt;/span&gt; failed: &lt;span style=&#34;color:#204a87&#34;&gt;exec&lt;/span&gt; failed: unable to start container process: exec: &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;/bin/bash&amp;#34;&lt;/span&gt;: stat /bin/bash: no such file or directory: unknown
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;% docker &lt;span style=&#34;color:#204a87&#34;&gt;exec&lt;/span&gt; -it redis /bin/sh
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;connecting-to-redis&#34;&gt;Connecting to Redis&lt;/h3&gt;
&lt;p&gt;Once connected inside the container, connect to Redis. Use the &lt;code&gt;redis-cli&lt;/code&gt; command to connect to Redis.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/data &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# redis-cli&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When connected, the prompt changes to &lt;code&gt;IP:port&amp;gt;&lt;/code&gt; as shown above.&lt;/p&gt;
&lt;p&gt;To check Redis information, enter &lt;code&gt;info&lt;/code&gt; as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt; info
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Server&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;redis_version:7.0.10
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;... omitted ...
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Press &lt;code&gt;Ctrl+C&lt;/code&gt; to exit.&lt;/p&gt;

      </description>
      
      <category>Redis</category>
      
      <category>NoSQL</category>
      
    </item>
    
    <item>
      <title>Installing MongoDB with Docker</title>
      <link>https://www.devkuma.com/en/docs/mongodb/installs/</link>
      <pubDate>Mon, 10 Jan 2022 08:53:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/mongodb/installs/</guid>
      <description>
        
        
        &lt;h2 id=&#34;installing-mongodb-with-docker&#34;&gt;Installing MongoDB with Docker&lt;/h2&gt;
&lt;h3 id=&#34;downloading-the-mongodb-docker-image&#34;&gt;Downloading the MongoDB Docker image&lt;/h3&gt;
&lt;p&gt;Run the following command to download the MongoDB Docker image. If you do not specify a version in the tag, the latest version is downloaded.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker pull mongo
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;% docker pull mongo
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Using default tag: latest
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;latest: Pulling from library/mongo
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ea362f368469: Pull &lt;span style=&#34;color:#204a87&#34;&gt;complete&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ecab26900ceb: Pull &lt;span style=&#34;color:#204a87&#34;&gt;complete&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1847fcb70562: Pull &lt;span style=&#34;color:#204a87&#34;&gt;complete&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;a7de23811c0d: Pull &lt;span style=&#34;color:#204a87&#34;&gt;complete&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;29dd51833fb9: Pull &lt;span style=&#34;color:#204a87&#34;&gt;complete&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;5eccd2be8afb: Pull &lt;span style=&#34;color:#204a87&#34;&gt;complete&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd8a8cd6879f: Pull &lt;span style=&#34;color:#204a87&#34;&gt;complete&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;e6ca3abc397d: Pull &lt;span style=&#34;color:#204a87&#34;&gt;complete&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;7481c3682d3c: Pull &lt;span style=&#34;color:#204a87&#34;&gt;complete&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;af377cb9eb7d: Pull &lt;span style=&#34;color:#204a87&#34;&gt;complete&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Digest: sha256:6743836d42756b2ae50549b2eb4585c688fce81a243cedd152b56266c2fb3d17
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Status: Downloaded newer image &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;for&lt;/span&gt; mongo:latest
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker.io/library/mongo:latest
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To specify the MongoDB version, specify the version in the tag. You can check available MongoDB versions on &lt;a href=&#34;https://hub.docker.com/_/mongo/?tab=tags&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Docker Hub&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Check the downloaded Docker image with the following command.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker images
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;% docker images
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;REPOSITORY                                      TAG            IMAGE ID       CREATED         SIZE
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mongo                                           latest         ee13a1eacac9   &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;2&lt;/span&gt; days ago      696MB
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;creating-and-running-a-mongodb-docker-container&#34;&gt;Creating and running a MongoDB Docker container&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;docker run --name my-mongodb -v ~/mongodb/db:/data/db -d -p 27017:27017 mongo
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;-v ~/mongodb/db:/data/db&lt;/code&gt; mounts the &lt;code&gt;~/mongodb/db&lt;/code&gt; directory on the host, meaning the local computer running the container, to the &lt;code&gt;/data/db&lt;/code&gt; directory in the container. If you do not set up a volume this way, the stored data is deleted when the container is deleted. Once deleted, container data cannot be recovered.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;% docker run --name my-mongodb -v ~/mongodb/db:/data/db -d -p 27017:27017 mongo
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ade97bdb08fde4eaa72ceb0135b0a570d97b21616affb7949a0fc479fec25e0e
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;starting-stopping-and-restarting-a-mongodb-docker-container&#34;&gt;Starting, stopping, and restarting a MongoDB Docker container&lt;/h3&gt;
&lt;p&gt;Stop the MongoDB Docker container.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker stop my-mongodb
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Start the MongoDB Docker container.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker start my-mongodb
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Restart the MongoDB Docker container.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker restart my-mongodb
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;checking-whether-the-mongodb-docker-container-is-running&#34;&gt;Checking whether the MongoDB Docker container is running&lt;/h4&gt;
&lt;p&gt;Run the following command.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;% docker ps -a
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;CONTAINER ID   IMAGE                                                  COMMAND                  CREATED          STATUS                      PORTS                                       NAMES
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ade97bdb08fd   mongo                                                  &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;docker-entrypoint.s...&amp;#34;&lt;/span&gt;   &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;37&lt;/span&gt; seconds ago   Up &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;36&lt;/span&gt; seconds               0.0.0.0:27017-&amp;gt;27017/tcp                    my-mongodb
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;connecting-to-the-mongodb-docker-container&#34;&gt;Connecting to the MongoDB Docker container&lt;/h4&gt;
&lt;p&gt;Run the following command.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker &lt;span style=&#34;color:#204a87&#34;&gt;exec&lt;/span&gt; -it my-mongodb bash
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The result is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;% docker &lt;span style=&#34;color:#204a87&#34;&gt;exec&lt;/span&gt; -it my-mongodb bash
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@ade97bdb08fd:/#
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>MongoDB</category>
      
      <category>Docker</category>
      
    </item>
    
    <item>
      <title>Redis redis-cli</title>
      <link>https://www.devkuma.com/en/docs/redis/redis-cli/</link>
      <pubDate>Fri, 10 Mar 2023 14:39:26 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/redis/redis-cli/</guid>
      <description>
        
        
        &lt;h2 id=&#34;installing-redis-cli&#34;&gt;Installing redis-cli&lt;/h2&gt;
&lt;p&gt;The following shows how to install it with Homebrew in a macOS environment.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;brew tap aoki/redis-cli
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;brew update &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; brew doctor
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;brew install redis-cli
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;a href=&#34;https://github.com/aoki/homebrew-redis-cli&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;github.com/aoki/homebrew-redis-cli&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;server-control&#34;&gt;Server control&lt;/h2&gt;
&lt;h3 id=&#34;connecting-with-redis-cli&#34;&gt;Connecting with redis-cli&lt;/h3&gt;
&lt;p&gt;If the host name and port number are omitted, it connects to localhost on port 6379.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ redis-cli
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Remote access can be done as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ redis-cli -h &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#{host name} -p #{port number}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Other main options are as follows.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;-n&lt;/code&gt;: database number&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-a&lt;/code&gt;: password&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-s&lt;/code&gt;: socket&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-u&lt;/code&gt;: server URL and other connection options can be set&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;querying-server-information&#34;&gt;Querying server information&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;redis-cli info
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; info
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Server&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;redis_version:6.0.9
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;redis_git_sha1:00000000
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;redis_git_dirty:0
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;redis_build_id:ffd199d8341c2d8f
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;redis_mode:standalone
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;... omitted ....
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;querying-connected-clients&#34;&gt;Querying connected clients&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; client list
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;disconnecting-a-connected-client&#34;&gt;Disconnecting a connected client&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; client &lt;span style=&#34;color:#204a87&#34;&gt;kill&lt;/span&gt; 10.0.0.8:33333
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;dumping-all-requests-received-after-running-the-command&#34;&gt;Dumping all requests received after running the command&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;redis-cli monitor
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; monitor
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;OK
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;key-operations&#34;&gt;Key operations&lt;/h2&gt;
&lt;h3 id=&#34;setting-a-key-and-value&#34;&gt;Setting a key and value&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87&#34;&gt;set&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt;key name&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt;value&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; &lt;span style=&#34;color:#204a87&#34;&gt;set&lt;/span&gt; key01 value01
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;OK
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;querying-a-value-by-key&#34;&gt;Querying a value by key&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;get &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt;key name&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; get key01
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;value01
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;querying-key-list&#34;&gt;Querying key list&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; keys *
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;key01
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;deleting-a-key&#34;&gt;Deleting a key&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; del key01
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;checking-whether-a-key-exists-where-1-means-true&#34;&gt;Checking whether a key exists, where 1 means true&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;exists &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt;key name&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt;value&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; exists key01
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;setting-data-only-if-the-key-does-not-already-exist&#34;&gt;Setting data only if the key does not already exist&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;setnx &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt;key name&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt;value&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; setnx key01 value02
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; setnx key01 value02
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If the result is 0, it means the key exists and the data was not updated.&lt;/p&gt;
&lt;h3 id=&#34;renaming-an-existing-key&#34;&gt;Renaming an existing key&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rename &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt;old key name&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt;new key name&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; rename key01 key02 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;OK
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; rename key03 key04
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ERR no such key
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;returning-the-number-of-keys-in-the-current-database&#34;&gt;Returning the number of keys in the current database&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; dbsize
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;moving-a-specific-key-to-another-database&#34;&gt;Moving a specific key to another database&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; move key01 &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;selecting-a-db-number&#34;&gt;Selecting a DB number&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;select&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;OK
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;deleting-all-keys-in-the-current-database&#34;&gt;Deleting all keys in the current database&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; flushdb
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;OK
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;deleting-all-keys-in-all-databases&#34;&gt;Deleting all keys in all databases&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; flushall
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;OK
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;regular-expressions&#34;&gt;Regular expressions&lt;/h3&gt;
&lt;p&gt;The regular expressions available in Redis are only the following.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;[]&lt;/code&gt;: one of the characters inside the brackets&lt;/li&gt;
&lt;li&gt;&lt;code&gt;*&lt;/code&gt;: any string&lt;/li&gt;
&lt;li&gt;&lt;code&gt;?&lt;/code&gt;: a single character&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;examples&#34;&gt;Examples&lt;/h4&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Query all Key lists.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ keys *
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Query keys that start with a number.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ keys &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;[&lt;/span&gt;0-9&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;]&lt;/span&gt;*
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;multiple-key&#34;&gt;Multiple Key&lt;/h2&gt;
&lt;h3 id=&#34;setting-multiple-key-values-together&#34;&gt;Setting multiple key values together&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; mset key01 value01 key02 value02 key03 value03 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;OK
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;querying-multiple-key-values-at-once&#34;&gt;Querying multiple key values at once&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; mget key01 key02 key03
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;value01
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;value02
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;value03
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;expire&#34;&gt;expire&lt;/h2&gt;
&lt;h3 id=&#34;setting-a-key-with-an-expiration-period&#34;&gt;Setting a key with an expiration period&lt;/h3&gt;
&lt;p&gt;The following example sets it to 60 seconds.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;gt; setex key01 60 value01 
OK
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;setting-expiration-on-an-existing-key&#34;&gt;Setting expiration on an existing key&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; expire key02 &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;30&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;math&#34;&gt;Math&lt;/h2&gt;
&lt;h3 id=&#34;adding-1-to-a-key-value&#34;&gt;Adding 1 to a key value&lt;/h3&gt;
&lt;p&gt;The following example sets &lt;code&gt;key02&lt;/code&gt; to 1 and increments it by 1.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; &lt;span style=&#34;color:#204a87&#34;&gt;set&lt;/span&gt; key02 &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;OK
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; incr key02 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;adding-a-specified-number-to-a-key-value&#34;&gt;Adding a specified number to a key value&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;gt; incrby key02 100 
102
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;subtracting-1-from-a-key-value&#34;&gt;Subtracting 1 from a key value&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; decr key02 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;101&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;subtracting-a-specified-number-from-a-key-value&#34;&gt;Subtracting a specified number from a key value&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; decrby key02 &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;51&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;50&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;list&#34;&gt;List&lt;/h2&gt;
&lt;h3 id=&#34;adding-values-to-the-head-of-a-list&#34;&gt;Adding values to the head of a List&lt;/h3&gt;
&lt;p&gt;Multiple values can be specified separated by spaces.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; lpush list01 value01
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;adding-values-to-the-end-of-a-list&#34;&gt;Adding values to the end of a List&lt;/h3&gt;
&lt;p&gt;Multiple values can be specified separated by spaces.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; rpush list01 value02
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;returning-the-number-of-list-elements&#34;&gt;Returning the number of List elements&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; llen list01
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;returning-the-element-at-a-specified-index-in-a-list&#34;&gt;Returning the element at a specified index in a List&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; lindex list01 &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;value01
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;returning-elements-from-a-specified-start-index-to-end-index-in-a-list&#34;&gt;Returning elements from a specified start index to end index in a List&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;gt; lrange list01 0 1
value01
value02
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;changing-the-element-at-a-specified-index-in-a-list-to-a-specified-value&#34;&gt;Changing the element at a specified index in a List to a specified value&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;gt; lset list01 1 value03
OK
&amp;gt; lindex list01 1
value03
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;returning-and-deleting-the-first-element-of-a-list&#34;&gt;Returning and deleting the first element of a List&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;gt; lpop list01
value01
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;returning-and-deleting-the-last-element-of-a-list&#34;&gt;Returning and deleting the last element of a List&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;gt; rpop list01
value03
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;trimming-a-list-to-elements-from-a-specified-start-index-to-end-index&#34;&gt;Trimming a List to elements from a specified start index to end index&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; ltrim list01 &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;OK
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;hash&#34;&gt;Hash&lt;/h2&gt;
&lt;p&gt;This is a data format managed by a parent Key, child Key (field), and value. For example, if you use the parent Key as a product ID and child keys to store product attribute information, you can use it with a way of thinking close to RDB data management.&lt;/p&gt;
&lt;h3 id=&#34;adding-a-value-to-a-specified-hash-field&#34;&gt;Adding a value to a specified Hash field&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; hset hash01 field01 value01
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;integer&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;returning-the-value-of-a-specified-hash-field&#34;&gt;Returning the value of a specified Hash field&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; hget hash01 field01
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;value01&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;adding-multiple-fields-to-a-hash&#34;&gt;Adding multiple fields to a Hash&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; hmset hash01 field02 value02 field03 value03
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;OK
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;returning-the-values-of-multiple-hash-fields&#34;&gt;Returning the values of multiple Hash fields&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; hmget hash01 field01 field02 field03
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;value01
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;value02
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;value03
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;returning-all-hash-fields&#34;&gt;Returning all Hash fields&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; hkeys hash01
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;field01
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;field02
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;field03
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;returning-all-values-of-hash-fields&#34;&gt;Returning all values of Hash fields&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; hvals hash01
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;value01
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;value02
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;value03
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;adding-a-specified-number-to-the-value-of-a-specified-hash-field&#34;&gt;Adding a specified number to the value of a specified Hash field&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; hincrby hash01 field04 &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;100&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;101&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;checking-whether-a-specified-hash-field-exists&#34;&gt;Checking whether a specified Hash field exists&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; hexists hash01 field01
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;returning-the-number-of-hash-fields&#34;&gt;Returning the number of Hash fields&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; hlen hash01
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;removing-a-specified-hash-field&#34;&gt;Removing a specified Hash field&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; hdel hash01 field04
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;other-operations&#34;&gt;Other operations&lt;/h2&gt;
&lt;h3 id=&#34;how-to-search-for-keys-when-keys-cannot-be-used&#34;&gt;How to search for keys when keys cannot be used&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;scan &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt; match devkuma-* count &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Key names can be searched with wildcards, and &lt;code&gt;devkuma-*&lt;/code&gt; searches for keys that start with &lt;code&gt;devkuma-&lt;/code&gt;.&lt;/p&gt;

      </description>
      
      <category>Redis</category>
      
      <category>NoSQL</category>
      
    </item>
    
    <item>
      <title>Querying and Storing Redis Data Structures</title>
      <link>https://www.devkuma.com/en/docs/redis/data-structure/</link>
      <pubDate>Fri, 31 Mar 2023 17:46:26 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/redis/data-structure/</guid>
      <description>
        
        
        &lt;h2 id=&#34;data-structures-collection&#34;&gt;Data structures (Collection)&lt;/h2&gt;
&lt;p&gt;Redis provides various data structures.&lt;/p&gt;
&lt;p&gt;In Redis, the basic type for data representation consists of one Key and one or more Field/Element values.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Key
&lt;ul&gt;
&lt;li&gt;Stores an ASCII value.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Value (Field/Element)
&lt;ul&gt;
&lt;li&gt;Basically stores String data.&lt;/li&gt;
&lt;li&gt;Stores Container-type data.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Container type
&lt;ul&gt;
&lt;li&gt;Includes Hash, List, Set, Sorted Set, and others.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;strings&#34;&gt;Strings&lt;/h2&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/redis/redis-data-structure-strings.png&#34; alt=&#34;Redis data type Strings&#34;&gt;&lt;/p&gt;
&lt;p&gt;String is the most basic data type for Redis values. It stores characters, numbers, and other values. When storing, there is no separate distinction between numbers and characters.&lt;br&gt;
Redis Strings are binary safe. This means a Redis string can contain any kind of data, such as a JPEG image or a serialized Ruby object.&lt;/p&gt;
&lt;p&gt;A String value can have a maximum length of 512 MB.&lt;/p&gt;
&lt;h3 id=&#34;redis-commands-for-strings&#34;&gt;Redis commands for Strings&lt;/h3&gt;
&lt;p&gt;Let&amp;rsquo;s store and query data in a key-value structure.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Command&lt;/th&gt;
          &lt;th&gt;Syntax&lt;/th&gt;
          &lt;th&gt;Description&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;set&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;&lt;code&gt;set key&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Stores a key-value pair.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;get&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;&lt;code&gt;get key&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Queries the value for the key.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;del&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;&lt;code&gt;del key&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Deletes the key.&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt; &lt;span style=&#34;color:#204a87&#34;&gt;set&lt;/span&gt; devkuma &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;OK
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt; get devkuma
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;1000&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt; del devkuma
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;integer&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt; get devkuma
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;nil&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;lists&#34;&gt;Lists&lt;/h2&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/redis/redis-data-structure-lists.png&#34; alt=&#34;Redis data type Lists&#34;&gt;&lt;/p&gt;
&lt;p&gt;A List is simply a String list ordered by insertion order. You can think of the String type as becoming an array structure.&lt;br&gt;
New elements can be added to the front or back of a list. It is said to support up to about 4 billion elements.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Command&lt;/th&gt;
          &lt;th&gt;Syntax&lt;/th&gt;
          &lt;th&gt;Description&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;lpush&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;&lt;code&gt;LPUSH key element [element ...]&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Left push. Stores data from the left, with the index starting at 0.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;lpop&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;&lt;code&gt;LPOP key&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Left pop. Extracts data from index 0 of the list.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;rpush&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;&lt;code&gt;RPUSH key element [element ...]&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Right push. Stores data from the right, meaning from the last index.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;rpop&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;&lt;code&gt;RPOP key&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Right pop. Extracts data from the last index of the list.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;lrange&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;&lt;code&gt;LRANGE key start stop&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Extracts list data from start to end.&lt;br&gt;If end is declared as -1 in lrange, all data in the list is extracted.&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The LPUSH command adds a new element before the head, and RPUSH adds it at the end. If executed on an empty key, a new list is created and added.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt; lpush fruit apple
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;integer&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt; lpush fruit banana
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;integer&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt; lpush fruit orange
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;integer&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt; lrange fruit &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;orange&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;banana&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;3&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;apple&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;sets&#34;&gt;Sets&lt;/h2&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/redis/redis-data-structure-sets.png&#34; alt=&#34;Redis data type Sets&#34;&gt;&lt;/p&gt;
&lt;p&gt;A Set is an unordered String collection. It is like a List type without indexes. Values are not duplicated. It can be processed faster than Lists.&lt;/p&gt;
&lt;p&gt;Because data can be extracted randomly, it may be usable for areas such as machine learning.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Command&lt;/th&gt;
          &lt;th&gt;Syntax&lt;/th&gt;
          &lt;th&gt;Description&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;sadd&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;&lt;code&gt;SADD key member [member...]&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Adds members to the set key.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;srem&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;&lt;code&gt;SREM key member [member...]&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Deletes members from the set key.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;smembers&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;&lt;code&gt;SMEMBERS key&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Queries all members of the set key.&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Add elements to key &lt;code&gt;animal&lt;/code&gt; with the &lt;code&gt;sadd&lt;/code&gt; command.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt; sadd animal dog
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;integer&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt; smembers animal
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;dog&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt; sadd animal cat cow
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;integer&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt; smembers animal
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;dog&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;cat&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;3&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;cow&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Delete an element from key &lt;code&gt;animal&lt;/code&gt; with the &lt;code&gt;srem&lt;/code&gt; command.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt; srem animal cat
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;integer&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt; smembers animal
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;dog&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;cow&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Use the &lt;code&gt;del&lt;/code&gt; command to delete everything.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt; del animal
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;integer&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt; smembers animal
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;empty array&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;127.0.0.1:6379&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;sorted-sets&#34;&gt;Sorted Sets&lt;/h2&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/redis/redis-data-structure-stored-sets.png&#34; alt=&#34;Redis data type Sorted Sets&#34;&gt;&lt;/p&gt;
&lt;p&gt;A Sorted Set is a set of non-repeating Strings similar to a Redis Set.
It is a Set type with the concept of score added. Values are not duplicated here either. It can be sorted by score or processed with threshold values on scores. It seems usable for real-time ranking displays in games.&lt;/p&gt;
&lt;h2 id=&#34;hashes&#34;&gt;Hashes&lt;/h2&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/redis/redis-data-structure-hashs.png&#34; alt=&#34;Redis data type Hashes&#34;&gt;&lt;/p&gt;
&lt;p&gt;A Hash consists of multiple field-value pairs under one key. It is a Set with the concept of fields that can be specified as strings.&lt;/p&gt;
&lt;p&gt;Every hash can store up to 2^32 - 1 field-value pairs, or more than about 4 billion.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Command&lt;/th&gt;
          &lt;th&gt;Syntax&lt;/th&gt;
          &lt;th&gt;Description&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;hset&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;&lt;code&gt;HSET key field [field value...]&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Sets one or more values.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;hget&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;&lt;code&gt;HGET key field&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Gets one or more values.&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;bitmaps-and-hyperloglogs&#34;&gt;Bitmaps and HyperLogLogs&lt;/h2&gt;
&lt;p&gt;Redis also supports Bitmaps and HyperLogLogs, data types that are actually based on the String base type but have their own meanings.&lt;/p&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://redis.io/docs/data-types/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Redis data types | Redis&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>Redis</category>
      
      <category>NoSQL</category>
      
    </item>
    
    <item>
      <title>How to Use the MongoDB mongo Command</title>
      <link>https://www.devkuma.com/en/docs/mongodb/how-to-use-mongo/</link>
      <pubDate>Tue, 11 Jan 2022 18:21:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/mongodb/how-to-use-mongo/</guid>
      <description>
        
        
        &lt;p&gt;This article explains how to connect using &lt;code&gt;mongo&lt;/code&gt;, the client module for connecting to MongoDB.&lt;/p&gt;
&lt;h2 id=&#34;basic-options&#34;&gt;Basic options&lt;/h2&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Option&lt;/th&gt;
          &lt;th&gt;Description&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--host &amp;lt;hostname&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Specifies the host name of the MongoDB server to connect to. If no host name is specified, it connects to localhost.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--port &amp;lt;port&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Specifies the port number used to connect to the MongoDB server. If no port number is specified, it connects to &lt;code&gt;27017&lt;/code&gt;.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--username &amp;lt;username&amp;gt;, -u &amp;lt;username&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Specifies the user name when accessing MongoDB with authentication enabled.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--password &amp;lt;password&amp;gt;, -p &amp;lt;password&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Specifies the password when connecting to MongoDB with authentication enabled.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;--authenticationDatabase &amp;lt;dbname&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Specifies the database name used for authentication.&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;files&#34;&gt;Files&lt;/h2&gt;
&lt;h3 id=&#34;dbshell&#34;&gt;.dbshell&lt;/h3&gt;
&lt;p&gt;This stores the history of commands executed in the mongo shell. The file is automatically created directly under the home directory (&lt;code&gt;%UserProfile%&lt;/code&gt;). On Windows, for example, it is located in the following place.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;%UserProfile%&lt;/code&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;C&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f57900&#34;&gt;\Users\&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;&amp;lt;user name&amp;gt;\.dbshell&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;mongorcjs&#34;&gt;.mongorc.js&lt;/h3&gt;
&lt;p&gt;If you place the &lt;code&gt;.mongorc.js&lt;/code&gt; file directly under a defined directory (&lt;code&gt;%UserProfile%&lt;/code&gt; or &lt;code&gt;%ProgramData%&lt;/code&gt;), &lt;code&gt;.mongorc.js&lt;/code&gt; is automatically loaded and executed when &lt;code&gt;mongo&lt;/code&gt; starts. This lets you predefine variables or functions that you want to use commonly while the shell is running. &lt;code&gt;.mongorc.js&lt;/code&gt; reads global definitions (&lt;code&gt;%ProgramData%&lt;/code&gt;) before user definitions (&lt;code&gt;%UserProfile%&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;If you do not want to load &lt;code&gt;.mongorc.js&lt;/code&gt;, start &lt;code&gt;mongo&lt;/code&gt; with the &lt;code&gt;--norc&lt;/code&gt; option.&lt;/p&gt;
&lt;p&gt;On Windows, for example, the directories are as follows.
&lt;code&gt;%UserProfile%&lt;/code&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;C&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f57900&#34;&gt;\Users\&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;&amp;lt;user name&amp;gt;\.mongorc.js&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;%ProgramData%&lt;/code&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;C&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f57900&#34;&gt;\ProgramData\MongoDB\.mongorc.js&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.mongodb.com/v3.2/reference/program/mongo/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MongoDB Manual - mongo&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.mongodb.com/v3.2/mongo/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MongoDB Manual - mongo shell&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>MongoDB</category>
      
    </item>
    
    <item>
      <title>Redis Command SETEX key Seconds value</title>
      <link>https://www.devkuma.com/en/docs/redis/setex/</link>
      <pubDate>Fri, 31 Mar 2023 17:46:26 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/redis/setex/</guid>
      <description>
        
        
        &lt;h2 id=&#34;setex&#34;&gt;SETEX&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;SETEX&lt;/code&gt; command sets a string value with a key and seconds. The data is deleted after the specified number of seconds.&lt;br&gt;
It is useful for storing data with an expiration time.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Available version: version 2.0.0 and later&lt;/li&gt;
&lt;li&gt;Logical processing time complexity: O(1)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It behaves the same as the following two commands.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SET mykey value
EXPIRE mykey seconds
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;setex-usage&#34;&gt;SETEX usage&lt;/h2&gt;
&lt;p&gt;The usage is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SETEX [key] [seconds] [value]
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2&gt;&lt;/h2&gt;
&lt;p&gt;When creating a key to store a string value, you can also set a timeout. The key is deleted after the timeout period has passed. It has the same effect as the following two commands.&lt;/p&gt;
&lt;p&gt;Data is deleted after the specified time: specify in seconds.
Data is deleted after the specified number of seconds.
It is useful for storing data with an expiration time.
The usage is &lt;code&gt;SETEX key seconds value&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Example
Command&amp;gt; setex key 5 value
Result&amp;gt; OK
Command&amp;gt; ttl key
Result&amp;gt; 2   shows the remaining time in seconds
Command&amp;gt; get key
Result&amp;gt; (nil)   data was deleted after 5 seconds
View animation&lt;/p&gt;
&lt;p&gt;The TTL command shows the remaining time in seconds.&lt;/p&gt;

      </description>
      
      <category>Redis</category>
      
      <category>NoSQL</category>
      
    </item>
    
    <item>
      <title>How to Apply Indexes in MongoDB</title>
      <link>https://www.devkuma.com/en/docs/mongodb/create-index/</link>
      <pubDate>Wed, 12 Jan 2022 08:39:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/mongodb/create-index/</guid>
      <description>
        
        
        &lt;p&gt;Because MongoDB is a document database, it has indexes that work a little differently. This article explains index concepts that do not exist in relational databases.&lt;/p&gt;
&lt;h2 id=&#34;mongodb-indexes&#34;&gt;MongoDB indexes&lt;/h2&gt;
&lt;p&gt;In MongoDB, the &lt;code&gt;_id&lt;/code&gt; property is basically created automatically as a unique index whenever a document is created. If this is not enough, you can create your own indexes with &lt;code&gt;db.collection.createIndex()&lt;/code&gt;. Indexes created with &lt;code&gt;db.collection.createIndex()&lt;/code&gt; are B-tree data structure indexes.&lt;/p&gt;
&lt;p&gt;MongoDB supports several index types in addition to simple key specifications. The supported index types are as follows.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Single key&lt;/li&gt;
&lt;li&gt;Compound key&lt;/li&gt;
&lt;li&gt;Multikey&lt;/li&gt;
&lt;li&gt;Geospatial&lt;/li&gt;
&lt;li&gt;Text&lt;/li&gt;
&lt;li&gt;Hashed&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;ldquo;Compound key&amp;rdquo; and &amp;ldquo;multikey&amp;rdquo; have similar names, but they are different. A compound key is a key made from a combination of multiple fields, while a multikey is a key that targets all values included in an array for a field that handles arrays.&lt;/p&gt;
&lt;p&gt;Below, we will look at concrete examples of the basic single-field index, compound index, and multikey index.&lt;/p&gt;
&lt;h2 id=&#34;basic-index-creation&#34;&gt;Basic index creation&lt;/h2&gt;
&lt;p&gt;You can create an index on a specified collection by running the following command in the mongo shell.&lt;/p&gt;
&lt;p&gt;The function is the same in JavaScript code, but JavaScript can specify a callback as the third argument.&lt;/p&gt;
&lt;h3 id=&#34;syntax&#34;&gt;Syntax&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;db.collection.createIndex&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;keys, options&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;arguments&#34;&gt;Arguments&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Argument&lt;/th&gt;
          &lt;th&gt;Type&lt;/th&gt;
          &lt;th&gt;Description&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;keys&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;&lt;code&gt;string&lt;/code&gt;/&lt;code&gt;object&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Specifies the field name that has a value. Specify &lt;code&gt;1&lt;/code&gt; for an ascending key and &lt;code&gt;-1&lt;/code&gt; for a descending key.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;options&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;&lt;code&gt;object&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Specifies options for index creation. The available options include &lt;code&gt;unique&lt;/code&gt; and &lt;code&gt;collation&lt;/code&gt;. There are more options, but remember these for now.&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;examples&#34;&gt;Examples&lt;/h3&gt;
&lt;p&gt;Below, we will look at examples of single-field indexes, compound indexes, and multikey indexes.&lt;/p&gt;
&lt;h2 id=&#34;creating-a-single-field-index&#34;&gt;Creating a single-field index&lt;/h2&gt;
&lt;p&gt;This section covers three sample codes for creating indexes on a sample document like the following. Because MongoDB is a document database, it can create indexes on embedded fields and embedded documents that do not exist in relational databases.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;&amp;#34;score&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1034&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;&amp;#34;location&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color:#a40000&#34;&gt;city:&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;&amp;#34;Seoul&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#a40000&#34;&gt;county:&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;&amp;#34;Korea Republic of&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;single-field&#34;&gt;Single field&lt;/h3&gt;
&lt;p&gt;This is the simplest sample code for creating an index on a single field.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.collection.createIndex&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; score: &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.collection.find&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; score: &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1034&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.collection.find&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; score: &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;$gt&lt;/span&gt;: &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1000&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;embedded-field&#34;&gt;Embedded field&lt;/h3&gt;
&lt;p&gt;MongoDB can also specify a document as an attribute value. In this case, fields inside the document, or nested elements, can also be indexed.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.collection.createIndex&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;location.city&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.collection.find&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;location.city&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;Kyunggi&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;embedded-document&#34;&gt;Embedded document&lt;/h3&gt;
&lt;p&gt;This is similar to an embedded field, but you can also specify the original object. However, note that in this case an exact match is required, including the number and order of attributes.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.collection.createIndex&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; location: &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.collection.find&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; city: &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;Seoul&amp;#34;&lt;/span&gt;, county: &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;Korea Republic of&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;creating-a-compound-key-index&#34;&gt;Creating a compound-key index&lt;/h2&gt;
&lt;p&gt;This is a compound-key index, which also exists in relational databases. In MongoDB, it can be created by specifying multiple fields as keys. In a MongoDB compound-key index, the index is effective not only for patterns that match all specified compound keys, but also for patterns that match part of them.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s look at an example of creating a compound-key index for the following sample data.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;&amp;#34;item&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;Apple&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;&amp;#34;location&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;xxx store&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;&amp;#34;stock&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;4&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;&amp;#34;type&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;cases&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.collection.createIndex&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; item: 1, location: 1, stock: &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.collection.find&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; item: &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;Apple&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.collection.find&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; item: &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;Apple&amp;#34;&lt;/span&gt;, location: &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;xxx store&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.collection.find&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; item: &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;Apple&amp;#34;&lt;/span&gt;, location: &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;xxx store&amp;#34;&lt;/span&gt;, stock: &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;$gt&lt;/span&gt;: &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In the example above, the index is created as &lt;code&gt;item -&amp;gt; location -&amp;gt; stock&lt;/code&gt;, so the leading parts such as &lt;code&gt;item&lt;/code&gt; and &lt;code&gt;item -&amp;gt; location&lt;/code&gt; can also use the index.&lt;/p&gt;
&lt;h2 id=&#34;creating-a-multikey-index&#34;&gt;Creating a multikey index&lt;/h2&gt;
&lt;p&gt;MongoDB also has fields that use arrays as values. Whether an array contains primitive values or objects, a multikey index can be created.&lt;/p&gt;
&lt;p&gt;Below, we will look at examples of creating an index on a collection that includes an array field named &lt;code&gt;ratings&lt;/code&gt; and searching it.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;&amp;#34;item&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;Apple&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;  &lt;span style=&#34;color:#a40000&#34;&gt;ratings:&lt;/span&gt; &lt;span style=&#34;color:#a40000&#34;&gt;[&lt;/span&gt; &lt;span style=&#34;color:#a40000&#34;&gt;2,&lt;/span&gt; &lt;span style=&#34;color:#a40000&#34;&gt;9&lt;/span&gt; &lt;span style=&#34;color:#a40000&#34;&gt;]&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;&amp;#34;item&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;Banana&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#a40000&#34;&gt;ratings:&lt;/span&gt; &lt;span style=&#34;color:#a40000&#34;&gt;[&lt;/span&gt; &lt;span style=&#34;color:#a40000&#34;&gt;4,&lt;/span&gt; &lt;span style=&#34;color:#a40000&#34;&gt;3&lt;/span&gt; &lt;span style=&#34;color:#a40000&#34;&gt;]&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;An index can be created simply by calling &lt;code&gt;createIndex()&lt;/code&gt; for &lt;code&gt;ratings&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.collection.createIndex&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; ratings: &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Searches on array fields usually use &lt;code&gt;$elemMatch&lt;/code&gt;. The following example extracts documents where at least one &lt;code&gt;ratings&lt;/code&gt; record is greater than or equal to 3 and less than or equal to 6.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.collection.find&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; ratings: &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;$elemMatch&lt;/span&gt;: &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;$gte&lt;/span&gt;: 3, &lt;span style=&#34;color:#000&#34;&gt;$lte&lt;/span&gt;: &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;6&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;_id&amp;#34;&lt;/span&gt; : ObjectId&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;5a2d24459c684f917e3ec0c2&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt;, &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;item&amp;#34;&lt;/span&gt; : &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;XYZ&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;ratings&amp;#34;&lt;/span&gt; : &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;[&lt;/span&gt; 4, &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;3&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;]&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you enter the following, it extracts documents where at least one record satisfies greater than or equal to 3 or less than or equal to 6, so all documents are extracted as a result.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.collection.find&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; ratings: &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;$gte&lt;/span&gt;: 3, &lt;span style=&#34;color:#000&#34;&gt;$lte&lt;/span&gt;: &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;6&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;_id&amp;#34;&lt;/span&gt; : ObjectId&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;5a2d24399c684f917e3ec0c1&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt;, &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;item&amp;#34;&lt;/span&gt; : &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;ABC&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;ratings&amp;#34;&lt;/span&gt; : &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;[&lt;/span&gt; 2, &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;9&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;]&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;_id&amp;#34;&lt;/span&gt; : ObjectId&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;5a2d24459c684f917e3ec0c2&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt;, &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;item&amp;#34;&lt;/span&gt; : &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;XYZ&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;ratings&amp;#34;&lt;/span&gt; : &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;[&lt;/span&gt; 4, &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;3&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;]&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MongoDB - db.collection.createIndex()&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.mongodb.com/manual/core/index-single/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MongoDB - Single Field Indexes&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.mongodb.com/manual/core/index-compound/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MongoDB - Compound Indexes&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.mongodb.com/manual/core/index-multikey/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MongoDB - Multikey Indexes&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>MongoDB</category>
      
    </item>
    
    <item>
      <title>How to Apply Unique Constraints in MongoDB</title>
      <link>https://www.devkuma.com/en/docs/mongodb/unique-constraint/</link>
      <pubDate>Wed, 12 Jan 2022 08:59:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/mongodb/unique-constraint/</guid>
      <description>
        
        
        &lt;p&gt;This article explains how to apply unique constraints in MongoDB.&lt;/p&gt;
&lt;h2 id=&#34;applying-unique-constraints&#34;&gt;Applying unique constraints&lt;/h2&gt;
&lt;p&gt;To apply a unique constraint in MongoDB, specify &lt;code&gt;true&lt;/code&gt; for the &lt;code&gt;unique&lt;/code&gt; option of &lt;code&gt;createIndex()&lt;/code&gt; when creating an index.&lt;/p&gt;
&lt;p&gt;The examples below show the cases of a single-key index and a compound-key index.&lt;/p&gt;
&lt;h3 id=&#34;single-key-index&#34;&gt;Single-key index&lt;/h3&gt;
&lt;p&gt;For a single-key index, you can create it by simply running the following code in the mongo shell.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.members.createIndex&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; userId: &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt;, &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt; unique: &lt;span style=&#34;color:#204a87&#34;&gt;true&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;compound-key-index&#34;&gt;Compound-key index&lt;/h3&gt;
&lt;p&gt;For a compound-key index, the code is the same as for a single-key index.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.members.createIndex&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; firstname: 1, lastname: &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt;, &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt; unique: &lt;span style=&#34;color:#204a87&#34;&gt;true&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;With a compound-key index, the combination of compound keys only needs to be unique, so the following can be set without issue.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.members.insert&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; firstname: &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;kc&amp;#34;&lt;/span&gt;, lastname: &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;Kim&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.members.insert&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; firstname: &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;et&amp;#34;&lt;/span&gt;, lastname: &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;Kim&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.members.insert&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; firstname: &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;kc&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;limits-on-setting-unique-constraints&#34;&gt;Limits on setting unique constraints&lt;/h2&gt;
&lt;p&gt;As with relational databases, you cannot apply a unique constraint to a collection that already contains duplicate data. This may be obvious once duplicate data already exists.&lt;/p&gt;
&lt;p&gt;Also, setting a unique constraint on a hashed index is not recommended. See &lt;a href=&#34;https://docs.mongodb.com/manual/core/index-hashed/#considerations&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Considerations for Hashed Indexes&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;behavior-when-no-value-is-set-for-the-unique-constraint-key&#34;&gt;Behavior when no value is set for the unique constraint key&lt;/h2&gt;
&lt;p&gt;As in the example above where a unique constraint was set with a compound-key index, if there is a field with no value, MongoDB internally treats it as &lt;code&gt;null&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For example, suppose there is a collection with a unique constraint on field &lt;code&gt;x&lt;/code&gt; as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.collection.createIndex&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; x: &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt;, &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt; unique: &lt;span style=&#34;color:#204a87&#34;&gt;true&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Assume that data is inserted without specifying field &lt;code&gt;x&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.collection.insert&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; y: &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;WriteResult&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;nInserted&amp;#34;&lt;/span&gt; : &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The first insert succeeds because &lt;code&gt;x: null&lt;/code&gt; is assigned. What happens if another document without field &lt;code&gt;x&lt;/code&gt; is inserted?&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt; db.collection.insert&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt; z: &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;WriteResult&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;({&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;nInserted&amp;#34;&lt;/span&gt; : 0,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;writeError&amp;#34;&lt;/span&gt; : &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;code&amp;#34;&lt;/span&gt; : 11000,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;errmsg&amp;#34;&lt;/span&gt; : &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;E11000 duplicate key error collection: test.collection index: x_1 dup key: { : null }&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As shown above, an error occurs and the insert cannot be performed. The error message also shows that &lt;code&gt;null&lt;/code&gt; is assigned when no value is specified.&lt;/p&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.mongodb.com/v3.4/core/index-unique/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MongoDB - Unique Indexes&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>MongoDB</category>
      
    </item>
    
    <item>
      <title>Apache HBase Overview</title>
      <link>https://www.devkuma.com/en/docs/hbase/overview/</link>
      <pubDate>Fri, 08 Jul 2022 09:37:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/hbase/overview/</guid>
      <description>
        
        
        &lt;h2 id=&#34;what-is-hbase&#34;&gt;What is HBase?&lt;/h2&gt;
&lt;p&gt;Apache HBase is an open source distributed database management system developed and published by the Apache Software Foundation. It is one of the NoSQL systems, with a structure different from mainstream relational databases.&lt;/p&gt;
&lt;p&gt;It models Google&amp;rsquo;s BigTable, which was developed and used internally at Google, and reimplements a similar database management system as open source software.&lt;/p&gt;
&lt;p&gt;HBase builds a database on HDFS (Hadoop Distributed File System), a distributed file system also developed and published by the ASF. Like a relational database, it structures data in tables, but unlike a typical RDBMS, it stores the values of each column together in storage. This approach is called column-oriented storage.&lt;/p&gt;
&lt;p&gt;Each row in a table stores data as pairs of qualifiers, which correspond to column names, and cells, which correspond to field values. Multiple qualifiers are grouped into a column family. Cell data is automatically versioned, so data from an arbitrary point in the past can be retrieved.&lt;/p&gt;
&lt;p&gt;HBase is designed for a distributed environment where multiple server computers manage one database. It automatically shards data across multiple nodes, so applications do not need to worry about the target location. It also provides strong data consistency, preventing stale data from being externally referenced during processing.&lt;/p&gt;
&lt;p&gt;Database operations are performed not with SQL, as in RDBs, but by calling APIs such as the Java API or RESTful API from an application. HBase is well suited to large-scale distributed big data processing such as Apache Hadoop MapReduce.&lt;/p&gt;
&lt;p&gt;HBase is not a replacement for SQL databases, but it can add an SQL layer by using software such as Apache Phoenix. With an SQL layer, JDBC drivers and similar tools can be used to handle various analytical workloads more easily and in a familiar way.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/apache/hbase&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Apache HBase|GitHub&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;hbase-history&#34;&gt;HBase History&lt;/h2&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Year&lt;/th&gt;
          &lt;th&gt;Event&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;November 2006&lt;/td&gt;
          &lt;td&gt;Google published the BigTable paper.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;February 2007&lt;/td&gt;
          &lt;td&gt;The initial HBase prototype was created as a Hadoop contribution.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;October 2007&lt;/td&gt;
          &lt;td&gt;The first usable HBase was released with Hadoop 0.15.0.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;January 2008&lt;/td&gt;
          &lt;td&gt;HBase became a subproject of Hadoop.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;October 2008&lt;/td&gt;
          &lt;td&gt;HBase 0.18.1 was released.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;January 2009&lt;/td&gt;
          &lt;td&gt;HBase 0.19.0 was released.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;September 2009&lt;/td&gt;
          &lt;td&gt;HBase 0.20.0 was released.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;May 2010&lt;/td&gt;
          &lt;td&gt;HBase became an Apache top-level project.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;June 2010&lt;/td&gt;
          &lt;td&gt;The first developer version, HBase 0.89.20100621, was released.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;January 2011&lt;/td&gt;
          &lt;td&gt;HBase 0.90.0 was released.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Mid-2011&lt;/td&gt;
          &lt;td&gt;HBase 0.92.0 was released.&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;hbase-features&#34;&gt;HBase Features&lt;/h2&gt;
&lt;p&gt;The following are some important characteristics of Apache HBase.&lt;/p&gt;
&lt;h3 id=&#34;distributed&#34;&gt;Distributed&lt;/h3&gt;
&lt;p&gt;Apache HBase can run in two modes: pseudo-distributed mode and fully distributed mode. Pseudo-distributed mode is used for testing and runs on a single node, while fully distributed mode is used in production and runs on a cluster of nodes.&lt;/p&gt;
&lt;h3 id=&#34;big-data-store&#34;&gt;Big Data Store&lt;/h3&gt;
&lt;p&gt;Apache HBase is designed to store very large data in tables with billions of rows and millions or billions of columns. Because it runs on Hadoop HDFS, it provides low-latency real-time reads and writes for data. It also provides better performance for read operations on massive data stored in tables.&lt;/p&gt;
&lt;h3 id=&#34;non-relational&#34;&gt;Non-Relational&lt;/h3&gt;
&lt;p&gt;As already noted, Apache HBase is a non-relational database, so it does not follow the relational database model. In relational database management, data is stored in tables as rows and columns. SQL can be used to access that data, but Apache HBase uses storage and query mechanisms where data storage is not fixed to that format. In Apache HBase, schemas are flexible and can be extended according to requirements.&lt;/p&gt;
&lt;h3 id=&#34;flexible-data-model&#34;&gt;Flexible Data Model&lt;/h3&gt;
&lt;p&gt;Apache HBase provides a flexible data model for storing data in tables. A table has one or more column families. User data is stored in rows, which are collections of key/value pairs. In a table, each row is uniquely identified by a row key.&lt;/p&gt;
&lt;h3 id=&#34;scalable&#34;&gt;Scalable&lt;/h3&gt;
&lt;p&gt;Apache HBase regions are horizontally scalable, with rows distributed by region. A table can be stored across multiple regions, and when a region becomes very large, the data is split into two regions around the middle row key.&lt;/p&gt;
&lt;h2 id=&#34;hbase-functions&#34;&gt;HBase Functions&lt;/h2&gt;
&lt;p&gt;Apache HBase provides the following functions.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Supports linear and modular scalability.&lt;/li&gt;
&lt;li&gt;Provides strict consistency for reads and writes.&lt;/li&gt;
&lt;li&gt;Provides automatic and configurable table sharding.&lt;/li&gt;
&lt;li&gt;Supports automatic failover between RegionServers.&lt;/li&gt;
&lt;li&gt;Provides convenient base classes for supporting Hadoop MapReduce jobs with Apache HBase tables.&lt;/li&gt;
&lt;li&gt;Makes the Java API easy to use for client access.&lt;/li&gt;
&lt;li&gt;Provides block cache and Bloom filters for real-time queries.&lt;/li&gt;
&lt;li&gt;Provides query predicate pushdown through server-side filters.&lt;/li&gt;
&lt;li&gt;Provides an extensible JRuby-based (JIRB) shell.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;hbase-pros-and-cons&#34;&gt;HBase Pros and Cons&lt;/h2&gt;
&lt;h3 id=&#34;hbase-advantages&#34;&gt;HBase Advantages&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Effective for reliably handling large volumes of data.
&lt;ul&gt;
&lt;li&gt;A master that controls the overall distributed system manages overall data consistency and guarantees consistency among replicated data.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Suitable for supporting large-scale data analysis processing.
&lt;ul&gt;
&lt;li&gt;Easy to use as MapReduce input.&lt;/li&gt;
&lt;li&gt;Optimized for use with HDFS, MapReduce, and related tools.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;If performance issues occur, performance can be maintained by adding only Region servers.&lt;/li&gt;
&lt;li&gt;Failover is easy, and management is convenient.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;hbase-disadvantages&#34;&gt;HBase Disadvantages&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;It is convenient as MapReduce input, but when used together with file input, CPU usage can rise and Region servers can go down easily.&lt;/li&gt;
&lt;li&gt;There is material about conditions for appropriate HBase settings, but because cluster size and basic specifications differ, it is difficult to apply directly.&lt;/li&gt;
&lt;li&gt;Regions for a specific table can easily become concentrated on a specific Region server, leading to performance degradation.
&lt;ul&gt;
&lt;li&gt;Proper HBase design is required during configuration.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;differences-between-rdbms-and-hbase&#34;&gt;Differences Between RDBMS and HBase&lt;/h2&gt;
&lt;p&gt;The following table summarizes the major differences between relational databases and HBase.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;RDBMS&lt;/th&gt;
          &lt;th&gt;HBase&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Uses tables as the database.&lt;/td&gt;
          &lt;td&gt;Uses regions as the database.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Supported file systems are FAT, NTFS, and EXT.&lt;/td&gt;
          &lt;td&gt;The supported file system is HDFS.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Uses commit logs to store logs.&lt;/td&gt;
          &lt;td&gt;Uses WAL (Write-Ahead Logs) to store logs.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;The reference system used is a coordinate system.&lt;/td&gt;
          &lt;td&gt;The reference system is the one used by ZooKeeper.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Uses a primary key.&lt;/td&gt;
          &lt;td&gt;Uses a row key.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Partitioning is supported.&lt;/td&gt;
          &lt;td&gt;Sharding is supported.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Uses Row, Column, and Cell.&lt;/td&gt;
          &lt;td&gt;Uses Row, Column family, Column, and Cell.&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;differences-between-hdfs-and-hbase&#34;&gt;Differences Between HDFS and HBase&lt;/h2&gt;
&lt;p&gt;The following table summarizes the major differences between HDFS and HBase.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;HDFS&lt;/th&gt;
          &lt;th&gt;HBase&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;HDFS provides a file system for distributed storage.&lt;/td&gt;
          &lt;td&gt;HBase provides table-form, column-based data storage.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;HDFS provides storage optimized for large files.&lt;/td&gt;
          &lt;td&gt;HBase provides optimization for table-form data.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Uses flat files.&lt;/td&gt;
          &lt;td&gt;Uses key-value pair data.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;The data model is not flexible.&lt;/td&gt;
          &lt;td&gt;Provides a flexible data model.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Uses a file system and processing framework.&lt;/td&gt;
          &lt;td&gt;Uses table-form storage with built-in Hadoop MapReduce support.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Mostly optimized for write-once-read-many workloads.&lt;/td&gt;
          &lt;td&gt;Optimized for many reads and writes.&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;differences-between-row-oriented-and-column-oriented-data-stores&#34;&gt;Differences Between Row-Oriented and Column-Oriented Data Stores&lt;/h2&gt;
&lt;p&gt;The following table summarizes the major differences between row-oriented and column-oriented data stores.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Row-oriented data store&lt;/th&gt;
          &lt;th&gt;Column-oriented data store&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Row-oriented data stores are efficient for adding and modifying records.&lt;/td&gt;
          &lt;td&gt;Column-oriented data stores are efficient for reading data.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;They read pages containing entire rows.&lt;/td&gt;
          &lt;td&gt;They read only the required columns.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Best suited for OLTP systems.&lt;/td&gt;
          &lt;td&gt;Not yet suitable for OLTP systems.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Serializes the full value of a row.&lt;/td&gt;
          &lt;td&gt;Serializes the full value of a column.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Stores rows in contiguous pages of memory.&lt;/td&gt;
          &lt;td&gt;Stores columns from pages in memory.&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;blockquote&gt;
&lt;p&gt;What is OLTP (Online Transactional Processing)? It refers to online transaction processing and means batch transaction processing against databases by online users over a network.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;pros-and-cons-of-column-oriented-databases&#34;&gt;Pros and Cons of Column-Oriented Databases&lt;/h2&gt;
&lt;p&gt;The following are the pros and cons of column-oriented databases.&lt;/p&gt;
&lt;h3 id=&#34;advantages&#34;&gt;Advantages&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Built-in support for efficiency and data compression.&lt;/li&gt;
&lt;li&gt;Supports fast data retrieval.&lt;/li&gt;
&lt;li&gt;Management and configuration are simplified in column-oriented databases.&lt;/li&gt;
&lt;li&gt;Suitable for high performance in aggregate queries, such as COUNT, SUM, AVG, MIN, and MAX.&lt;/li&gt;
&lt;li&gt;Provides an automatic sharding mechanism that distributes larger regions into smaller regions, making it efficient for partitioning.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;disadvantages&#34;&gt;Disadvantages&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;JOIN queries and data across multiple tables are not optimized.&lt;/li&gt;
&lt;li&gt;Storage efficiency decreases because partitions must be created for frequent deletes and updates.&lt;/li&gt;
&lt;li&gt;Because of the non-relational nature, designing partitions and indexes is very difficult.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;hbase-use-cases&#34;&gt;HBase Use Cases&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Used to guarantee data consistency or for analysis.
&lt;ul&gt;
&lt;li&gt;Example: Facebook, eBay, Adobe, LINE, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Monitoring systems.&lt;/li&gt;
&lt;li&gt;Tracking user actions.&lt;/li&gt;
&lt;li&gt;Audit logging systems.&lt;/li&gt;
&lt;li&gt;Real-time analytics.
&lt;ul&gt;
&lt;li&gt;Cases where Hadoop must be used to analyze large amounts of data.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Used as the primary storage for large-scale social networking services.
&lt;ul&gt;
&lt;li&gt;Message-oriented systems, such as Twitter-like messages and statuses.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Content management systems that serve content from HBase.&lt;/li&gt;
&lt;li&gt;Standard use cases such as storing web pages during web crawling.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.cloudduggu.com/hbase/introduction/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Apache HBase Introduction&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://hbase.apache.org/book.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Apache HBase ™ Reference Guide&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>HBase</category>
      
    </item>
    
    <item>
      <title>Apache HBase Architecture</title>
      <link>https://www.devkuma.com/en/docs/hbase/architecture/</link>
      <pubDate>Fri, 08 Jul 2022 09:40:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/hbase/architecture/</guid>
      <description>
        
        
        &lt;h2 id=&#34;apache-hbase-architecture&#34;&gt;Apache HBase Architecture&lt;/h2&gt;
&lt;p&gt;Apache HBase is a NoSQL database. NoSQL is a general expression indicating that a database is not an RDBMS whose primary access language is SQL. Apache HBase is a data store rather than a traditional database. HBase can scale linearly and modularly by adding commodity nodes to the cluster. If the number of nodes increases from 20 to 40, storage and capacity also increase at the same time in the HBase cluster.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;HBase Cluster Architecture&lt;/strong&gt;
&lt;img src=&#34;https://www.devkuma.com/docs/hbase/hbase-cluster-architure.jpg&#34; alt=&#34;HBase Cluster Architecture&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;apache-hbase-components&#34;&gt;Apache HBase Components&lt;/h2&gt;
&lt;p&gt;HBase consists of two types of servers: Master servers and Region servers.&lt;br&gt;
Its structure allows simple scale-out by adding Region servers.
HBase data is divided into units called Regions, and server types are separated according to how Regions are handled.&lt;/p&gt;
&lt;h3 id=&#34;master-server---hbase-hmaster&#34;&gt;Master Server - HBase HMaster&lt;/h3&gt;
&lt;p&gt;Apache HBase HMaster is an important component of an HBase cluster that is responsible for monitoring RegionServers, handling failover, and managing region splits.&lt;/p&gt;
&lt;p&gt;Data for each table is managed by RegionServers, and the entire cluster is managed by HMaster.&lt;br&gt;
HMaster manages metadata that records which Region server stores each piece of HBase data (Region).&lt;br&gt;
It assigns Regions to Region servers and detects failures in Region servers.&lt;/p&gt;
&lt;p&gt;HMaster functions include the following.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Monitors RegionServers.
&lt;ul&gt;
&lt;li&gt;Coordinates Region servers.&lt;/li&gt;
&lt;li&gt;Manages Region startup.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Handles RegionServer failover.&lt;/li&gt;
&lt;li&gt;Assigns or unassigns Regions.&lt;/li&gt;
&lt;li&gt;Monitors all Region servers in the cluster.
&lt;ul&gt;
&lt;li&gt;Management functions.&lt;/li&gt;
&lt;li&gt;Table creation, deletion, and update.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Handles metadata changes.&lt;/li&gt;
&lt;li&gt;Provides an interface for all metadata changes.&lt;/li&gt;
&lt;li&gt;Performs load balancing during idle time.&lt;/li&gt;
&lt;li&gt;HMaster provides a web user interface that shows information about the HBase cluster.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/hbase/hbase-hmaster.png&#34; alt=&#34;HBase HMaster&#34;&gt;&lt;/p&gt;
&lt;p&gt;These tasks are handled by ZooKeeper, software that runs inside the Master server.&lt;br&gt;
ZooKeeper is software used in many distributed applications besides HBase.&lt;/p&gt;
&lt;h3 id=&#34;region-server---hbase-region-server&#34;&gt;Region Server - HBase Region Server&lt;/h3&gt;
&lt;p&gt;RegionServer is responsible for storing the actual data assigned by the Master server. As in a Hadoop cluster, NameNode stores metadata and DataNode stores actual data. HBase is similar: the Master holds metadata, and RegionServers store actual data. RegionServer runs on DataNodes in a distributed cluster environment.&lt;/p&gt;
&lt;p&gt;RegionServer performs the following tasks.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Handles assigned regions (tables).&lt;/li&gt;
&lt;li&gt;Handles read and write requests made by clients.&lt;/li&gt;
&lt;li&gt;Flushes cache to HDFS.&lt;/li&gt;
&lt;li&gt;Is responsible for region split processing.&lt;/li&gt;
&lt;li&gt;Maintains HLog.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The client first queries the Master server, or more precisely ZooKeeper, to learn the location of the Region server that holds the target data (Region).&lt;/p&gt;
&lt;p&gt;Then that Region server handles the client request.&lt;br&gt;
A Region is always managed by a single Region server and maintains data consistency for reads and writes.&lt;/p&gt;
&lt;p&gt;If a Region server goes down, the assigned Regions fail over to another Region server. This work is performed by the Master server.&lt;br&gt;
However, until failover completes, clients cannot read from or write to the target Region.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/hbase/hbase-region-server.png&#34; alt=&#34;HBase Region Server&#34;&gt;&lt;/p&gt;
&lt;h4 id=&#34;regionserver-components&#34;&gt;RegionServer Components&lt;/h4&gt;
&lt;p&gt;The following are the components of a RegionServer.&lt;/p&gt;
&lt;h5 id=&#34;wal-write-ahead-logging&#34;&gt;WAL (Write-Ahead Logging)&lt;/h5&gt;
&lt;p&gt;What is WAL? It is a standard method used by databases to guarantee data integrity. In systems that use WAL, changes are first recorded in the WAL before data is modified. These records make it possible to determine when a failure occurred, how far processing succeeded, and where subsequent work should resume.&lt;/p&gt;
&lt;p&gt;Various database systems, including PostgreSQL, HBase, and MongoDB, use the WAL method.&lt;/p&gt;
&lt;p&gt;Apache HBase WAL is an intermediate file also called an edit log file. When reading or modifying data in HBase, data is not written directly to disk but kept in memory for a period of time. If the system goes down, all data in memory may be lost. To overcome this problem, Apache HBase first records data in a Write-Ahead Logging file before recording it in memory.&lt;/p&gt;
&lt;h5 id=&#34;hfile&#34;&gt;HFile&lt;/h5&gt;
&lt;p&gt;HFile is the format for storing data in HBase. It belongs to a Column Family, and a Column Family can have multiple HFiles.
It is the actual file where row data is physically stored, and data is stored in key/value format.
When MemStore fills sufficiently, it creates a new HFile in HDFS and stores the data there.&lt;br&gt;
This process is very fast because the structure minimizes random access.&lt;/p&gt;
&lt;h5 id=&#34;store&#34;&gt;Store&lt;/h5&gt;
&lt;p&gt;Store corresponds to a Column family for an HBase table. HFiles are stored here.&lt;/p&gt;
&lt;h5 id=&#34;memstore&#34;&gt;MemStore&lt;/h5&gt;
&lt;p&gt;MemStore resides in main memory and records current data operations. After data is stored in the WAL, key/value data is sorted and stored in the RegionServer memory store. This data is then stored in HFile as-is.
There is one MemStore per Column Family.&lt;/p&gt;
&lt;h5 id=&#34;region&#34;&gt;Region&lt;/h5&gt;
&lt;p&gt;A Region is a table split that is divided based on keys and hosted by RegionServers.&lt;/p&gt;
&lt;h3 id=&#34;client&#34;&gt;Client&lt;/h3&gt;
&lt;p&gt;Clients can be written in Java or other languages and can connect through external APIs to the RegionServer that manages the actual row data. A client queries catalog tables to find a Region. Once the Region is found, the client connects directly to RegionServers, performs data operations, and caches data for fast lookups.&lt;/p&gt;
&lt;h3 id=&#34;catalog-tables&#34;&gt;Catalog Tables&lt;/h3&gt;
&lt;p&gt;Catalog tables are used to maintain metadata for all RegionServers and Regions.&lt;/p&gt;
&lt;p&gt;HBase has two types of catalog tables.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;-ROOT-&lt;/strong&gt; This table contains information about the location of the META table.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;.META&lt;/strong&gt; This table contains information about all Regions and their locations.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;zookeeper&#34;&gt;ZooKeeper&lt;/h3&gt;
&lt;p&gt;Apache ZooKeeper acts like the coordinator for HBase. HBase uses ZooKeeper to manage the state of servers that make up the cluster.
It provides services such as maintaining configuration information, naming, distributed synchronization, and server error notification. Clients communicate with region servers through ZooKeeper.&lt;/p&gt;
&lt;p&gt;Apache ZooKeeper is a high-performance centralized coordination service system for distributed applications that provides distributed synchronization and group services to HBase. Despite cluster coordination, it lets users focus on application logic. It also provides APIs that allow users to interact with the Master server.&lt;/p&gt;
&lt;p&gt;The Apache ZooKeeper API provides consistency, ordering, and durability, and also provides synchronization and concurrency for distributed cluster systems.&lt;/p&gt;
&lt;h2 id=&#34;hbase-data-writeread-process&#34;&gt;HBase Data Write/Read Process&lt;/h2&gt;
&lt;p&gt;This section explains how HBase reads and writes data.&lt;/p&gt;
&lt;h3 id=&#34;hbase-data-writes&#34;&gt;HBase Data Writes&lt;/h3&gt;
&lt;p&gt;When storing data in HBase, the data is stored in two places: the WAL (Write Ahead Log) and the Region server&amp;rsquo;s MemStore.&lt;/p&gt;
&lt;p&gt;Using these two locations, the write process is considered complete when changes have occurred in both the WAL and MemStore.&lt;/p&gt;
&lt;p&gt;When a data load request arrives in HBase, the appropriate Region server is found first. After the Region server is found, a commit log is added and the data is added to the in-memory MemStore.
Data stored in MemStore is flushed to disk as an HFile when it becomes full according to configured values. Memory is cleared, the server waits for the next request, and a corresponding record is also written to the WAL.
MemStore flush occurs when the value exceeds &lt;code&gt;hbase.hregion.memstore.flush.size&lt;/code&gt;; the unit is bytes and the setting is 134217728 (128 MB).&lt;/p&gt;
&lt;p&gt;MemStore is a memory area of the Region server and acts like a cache.
When a certain amount of data accumulates in MemStore, the data is exported to disk as an HFile and persisted.&lt;br&gt;
However, data before it is exported to HFile is stored in server memory (MemStore), so it disappears if the server goes down.
Therefore, HBase writes a log called HLog when writing data, and if the server goes down, it can recover data based on HLog.&lt;/p&gt;
&lt;h2 id=&#34;hbase-data-reads&#34;&gt;HBase Data Reads&lt;/h2&gt;
&lt;p&gt;The process of reading data from HBase is similar to the write process described above.&lt;/p&gt;
&lt;p&gt;When a request enters HBase, MemStore is checked first. If the desired data is found in MemStore, that data is returned.
Otherwise, HBase searches from the most recently flushed file to older files until it finds suitable data that satisfies the query or there are no more flushed files.&lt;/p&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.joinc.co.kr/w/man/12/hadoop/hbase/about&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;HBase Introduction|joinc.co.kr&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>HBase</category>
      
    </item>
    
    <item>
      <title>Apache HBase Regions</title>
      <link>https://www.devkuma.com/en/docs/hbase/regions/</link>
      <pubDate>Wed, 21 Jun 2023 11:05:33 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/hbase/regions/</guid>
      <description>
        
        
        &lt;p&gt;Apache HBase stores large amounts of data in tables sorted by row key in lexicographic order. Tables are distributed across multiple Regions, and Regions are further distributed across multiple RegionServers. When you create a table in Apache HBase, a default Region is assigned.&lt;/p&gt;
&lt;p&gt;Apache HBase Regions are horizontally scalable. They include a start key and an end key, and rows are sorted and stored in a continuous format based on those keys. Because HBase provides strong consistency, it does not store the same row key in multiple Regions. Regions distribute load across multiple RegionServers and also perform load balancing and failover according to requirements. As data grows, Regions are split manually or automatically.&lt;/p&gt;
&lt;h2 id=&#34;number-of-regions&#34;&gt;Number of Regions&lt;/h2&gt;
&lt;p&gt;It is recommended to use a small number of medium to large Regions, 5 to 20 GB, per RegionServer, usually 20 to 200 Regions. The standard number of Regions is 100.&lt;/p&gt;
&lt;p&gt;Some factors to consider for Regions are as follows.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The limiting factor when choosing the number of Regions is available heap space. MemStore requires almost 2 MB per column family per Region. If there are 100 Regions and 3 column families per Region, MemStore heap space requirements are 600 MB. Fewer Regions require less MemStore heap.&lt;/li&gt;
&lt;li&gt;A large number of Regions creates many small flushes. If each flush creates a StoreFile, many StoreFiles are created, requiring more compaction. MemStore and StoreFile indexes also require more heap space.&lt;/li&gt;
&lt;li&gt;A large number of Regions creates load on the master because the master must assign and reassign Regions to RegionServers. The master must also move Regions for load balancing.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;region-assignment&#34;&gt;Region Assignment&lt;/h2&gt;
&lt;p&gt;In Apache HBase, Regions are assigned by the master as follows.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The master starts the assignment manager.&lt;/li&gt;
&lt;li&gt;The assignment manager checks existing assignments in hbase:meta metadata.&lt;/li&gt;
&lt;li&gt;Assignments are stored when RegionServers are available.&lt;/li&gt;
&lt;li&gt;If a RegionServer is not online, the load balancer is called to assign Regions to another RegionServer.&lt;/li&gt;
&lt;li&gt;The hbase:meta metadata is updated with the new assignment.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;region-failover&#34;&gt;Region failover&lt;/h2&gt;
&lt;p&gt;Because a RegionServer can fail and multiple RegionServers provide data, a RegionServer&amp;rsquo;s Regions can become unavailable. ZooKeeper detects RegionServer failures, and the master starts failover on another RegionServer with a similar Row Key for the Region.&lt;/p&gt;
&lt;h2 id=&#34;region-locality&#34;&gt;Region Locality&lt;/h2&gt;
&lt;p&gt;Region Locality indicates the proximity of a Region to a RegionServer. It is achieved through HDFS block replication across the cluster.&lt;/p&gt;
&lt;p&gt;The replica placement policy is the HDFS replica placement policy, as follows.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The first replica is placed on the local node.&lt;/li&gt;
&lt;li&gt;The second replica is placed on a random node in a different rack.&lt;/li&gt;
&lt;li&gt;The third replica is placed in the same rack as the second replica, but on a different node.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;benefits-of-regions&#34;&gt;Benefits of Regions&lt;/h2&gt;
&lt;p&gt;The benefits of Regions include distributed data storage, partitioning, automatic sharding and scalability, and Region splitting.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s look at each in detail.&lt;/p&gt;
&lt;h3 id=&#34;distributed-data-store&#34;&gt;Distributed data store&lt;/h3&gt;
&lt;p&gt;The design of a distributed data store matches Apache HBase&amp;rsquo;s design of using multiple Regions for a table. Distributing Regions of larger tables across a cluster of nodes provides high availability.&lt;/p&gt;
&lt;h3 id=&#34;partitioning&#34;&gt;Partitioning&lt;/h3&gt;
&lt;p&gt;Data tables are stored in multiple Regions, and Regions partition the data. To access data in that table, access must now happen from different Regions. Having multiple Regions provides the benefit of delivering data quickly.&lt;/p&gt;
&lt;h3 id=&#34;automatic-sharding-and-scalability&#34;&gt;Automatic sharding and scalability&lt;/h3&gt;
&lt;p&gt;The automatic sharding process is used to split a Region into roughly two halves when the number of row keys in the Region becomes too large. In HBase, the basic unit of horizontal scalability is the Region, and rows are shared by Region.&lt;/p&gt;
&lt;h3 id=&#34;region-splitting&#34;&gt;Region splitting&lt;/h3&gt;
&lt;p&gt;When a threshold is exceeded, a Region is split. This is handled by the RegionServer, which splits the Region and takes the split Region offline. After that, two split Regions are added to hbase:meta, opened by the RegionServer, and reported to the master. Region splitting is automatic by default, but it can also be run manually. The HBase Region split policy is configured with &lt;code&gt;hbase.regionserver.region.split.policy&lt;/code&gt;.&lt;/p&gt;

      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>HBase</category>
      
    </item>
    
    <item>
      <title>HBase Data Model</title>
      <link>https://www.devkuma.com/en/docs/hbase/data-model/</link>
      <pubDate>Tue, 20 Jun 2023 19:07:12 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/hbase/data-model/</guid>
      <description>
        
        
        &lt;h2 id=&#34;data-structure&#34;&gt;Data structure&lt;/h2&gt;
&lt;p&gt;HBase tables have no fixed type and are stored as byte arrays (&lt;code&gt;byte[]&lt;/code&gt;).&lt;br&gt;
HBase rows are sorted in ascending order by a unique row key, and this row key is used when reading and writing table values.&lt;br&gt;
As mentioned earlier, data managed by HBase is divided into Regions by fixed ranges, and a table has multiple Regions.
HBase columns are also grouped in units called column families.&lt;br&gt;
Table data is divided by Region and by column family, then exported as files.
Files are separate, but if they belong to the same Region, they are stored on the same Region server.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/hbase/hbase-table.png&#34; alt=&#34;HBase Table&#34;&gt;&lt;/p&gt;
&lt;p&gt;Each HBase data cell value has a timestamp, so versions are managed.
Files are stored in the following format.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Row(Row Key): Column family: Column: timestamp: value
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;data-model&#34;&gt;Data model&lt;/h2&gt;
&lt;p&gt;The Apache HBase data model is a distributed, multidimensional, persistent, sorted map indexed by column key, row key, and timestamp. This is why Apache HBase is also called a key-value storage system.&lt;/p&gt;
&lt;p&gt;The basic unit of HBase is a column. Columns form a Column Family, and Column Families form a table. Each Row in a table has a Row Key and can be identified by it. See the figure below.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/hbase/hbase-column-family.png&#34; alt=&#34;HBase Column family&#34;&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;This table has two column families: Customer and Sales.&lt;/li&gt;
&lt;li&gt;The Customer column family has two columns: Name and City.&lt;/li&gt;
&lt;li&gt;The Sales column family has two columns: Product and Amount.&lt;/li&gt;
&lt;li&gt;A Row consists of Row Key, Customer CF, and Sales CF.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The following are data model terms used in Apache HBase.&lt;/p&gt;
&lt;h3 id=&#34;table&#34;&gt;Table&lt;/h3&gt;
&lt;p&gt;An Apache HBase table consists of multiple Rows. It organizes data into tables made of characters that are easy to use with the file system.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A set of Rows, with a Row Key and multiple column families.&lt;/li&gt;
&lt;li&gt;In schema definition, only Column Families are defined.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;row&#34;&gt;Row&lt;/h3&gt;
&lt;p&gt;Apache HBase stores data based on Rows, and each Row has a unique Row Key. The Row Key is represented as a byte array.&lt;/p&gt;
&lt;h4 id=&#34;row-key&#34;&gt;Row Key&lt;/h4&gt;
&lt;p&gt;Because data is collected based on the Row Key, the Row Key must be designed so that data can be distributed appropriately. The goal of Row Key design is to store data so similar Rows are near each other.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Sorted lexicographically as arbitrary bytes.&lt;/li&gt;
&lt;li&gt;An empty byte string means the start and end of the table.&lt;/li&gt;
&lt;li&gt;Anything can be a row key, including strings, integers, binary data, and serialized data structures.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In general, a Row Key pattern can also be organized in website domain format. If domains are stored in reverse order, such as &lt;code&gt;org.apache.mair&lt;/code&gt; and &lt;code&gt;org.apache.jira&lt;/code&gt;, Apache domain data can be stored near each other.&lt;/p&gt;
&lt;h3 id=&#34;column&#34;&gt;Column&lt;/h3&gt;
&lt;p&gt;A Column consists of a Column Family and a Column Qualifier.&lt;/p&gt;
&lt;h4 id=&#34;column-family&#34;&gt;Column Family&lt;/h4&gt;
&lt;p&gt;A Column Family is used to store Rows and also provides the structure for storing data in Apache HBase.&lt;/p&gt;
&lt;p&gt;It consists of characters and strings and can be used with file system paths. Each row in a table has the same column families, but a row does not need to store data in every column family.&lt;/p&gt;
&lt;h4 id=&#34;column-qualifier&#34;&gt;Column Qualifier&lt;/h4&gt;
&lt;p&gt;A Column Qualifier provides an index for data stored in a Column Family. The Column qualifier is not a fixed value, so various data can be entered. It can be thought of as a map object.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A group of Columns where all ColumnFamily members use the same prefix.&lt;/li&gt;
&lt;li&gt;NOSQL:Cassandra and NOSQL:HBASE are member columns of the NOSQL column family.&lt;/li&gt;
&lt;li&gt;The column family prefix must consist of displayable characters.&lt;/li&gt;
&lt;li&gt;Part of the table schema definition must be specified first.&lt;/li&gt;
&lt;li&gt;All column family members are physically stored together in the file system.&lt;/li&gt;
&lt;li&gt;New column family members can be added dynamically.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;cell&#34;&gt;Cell&lt;/h3&gt;
&lt;p&gt;A Cell is a data unit consisting of Column family, Row key, and Column qualifier. The value of each column is called a cell.&lt;/p&gt;
&lt;p&gt;A data cell includes a value and a timestamp, which is the version of the value. Because there is a timestamp, previous values are stored together and maintained for a certain period.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A tuple with ROW KEY, Column, and Version specified.&lt;/li&gt;
&lt;li&gt;The value is an arbitrary byte array and Timestamp.&lt;/li&gt;
&lt;li&gt;Table cells are versioned, only cells.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;timestamp&#34;&gt;Timestamp&lt;/h4&gt;
&lt;p&gt;Versions are assigned to values where the same data is stored in a Cell. Each version is identified by a version number assigned during creation time. If Timestamp is not mentioned while writing data, the current time is assigned.&lt;/p&gt;
&lt;h2 id=&#34;hbase-data-types&#34;&gt;HBase data types&lt;/h2&gt;
&lt;p&gt;Apache HBase has no concept of data types. Everything is a byte array. When values are inserted, it is a kind of byte-in and byte-out database converted to byte arrays using the &lt;code&gt;Put&lt;/code&gt; and &lt;code&gt;Result&lt;/code&gt; interfaces. Apache HBase uses a serialization framework to convert user data into byte arrays.&lt;/p&gt;
&lt;p&gt;Apache HBase cells can store values up to 10 to 15 MB. If a value is larger, it can be stored in Hadoop HDFS and file path metadata information can be stored in Apache HBase.&lt;/p&gt;
&lt;h2 id=&#34;hbase-data-storage&#34;&gt;HBase data storage&lt;/h2&gt;
&lt;p&gt;The following introduces how Apache HBase is physically stored.&lt;/p&gt;
&lt;h3 id=&#34;conceptual-view&#34;&gt;Conceptual view&lt;/h3&gt;
&lt;p&gt;You can see that a table is represented as a series of Rows at the conceptual level.&lt;/p&gt;
&lt;p&gt;The following is a conceptual diagram of how data is stored in HBase.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/hbase/hbase_conceptual_view.png&#34; alt=&#34;Conceptual view&#34; width=&#34;70%&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;physical-view&#34;&gt;Physical view&lt;/h3&gt;
&lt;p&gt;In the physical view, a table is physically stored by column family.&lt;/p&gt;
&lt;p&gt;The following example shows a table that will be stored as a column-family-based table.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/hbase/hase_physical_view1.png&#34; alt=&#34;Physical view&#34; width=&#34;50%&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/hbase/hase_physical_view2.png&#34; alt=&#34;Physical view&#34; width=&#34;40%&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;namespace&#34;&gt;Namespace&lt;/h2&gt;
&lt;p&gt;A namespace is a logical group of tables. It is similar to grouping related tables in a relational database.&lt;/p&gt;
&lt;p&gt;The representation of a namespace is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;HBase Namespaces
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- Table
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- Region Server Group
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- Permission
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- Quota
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Let&amp;rsquo;s look at each component of namespace space.&lt;/p&gt;
&lt;h3 id=&#34;table-1&#34;&gt;Table&lt;/h3&gt;
&lt;p&gt;All tables are part of a namespace. If no namespace is defined, the table is assigned to the default namespace.&lt;/p&gt;
&lt;h3 id=&#34;regionserver-group&#34;&gt;RegionServer group&lt;/h3&gt;
&lt;p&gt;A default RegionServer group can be assigned to a namespace. In this case, created tables become members of the RegionServer group.&lt;/p&gt;
&lt;h3 id=&#34;permission&#34;&gt;Permission&lt;/h3&gt;
&lt;p&gt;Using namespaces, users can define access control lists such as read, delete, and update permissions, and with write permission, users can create tables.&lt;/p&gt;
&lt;h3 id=&#34;quota&#34;&gt;Quota&lt;/h3&gt;
&lt;p&gt;This component is used to define the quota that a namespace can include for tables and Regions.&lt;/p&gt;
&lt;h3 id=&#34;predefined-namespaces&#34;&gt;Predefined namespaces&lt;/h3&gt;
&lt;p&gt;There are two predefined special namespaces.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;hbase&lt;/strong&gt;: A system namespace used to include HBase internal tables.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;default&lt;/strong&gt;: This namespace is for all tables where no namespace is defined.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;data-model-operations&#34;&gt;Data model operations&lt;/h2&gt;
&lt;p&gt;The main data model operations are Get, Put, Scan, and Delete. These operations can be used to read, write, and delete records from tables.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s look at each operation in detail.&lt;/p&gt;
&lt;h3 id=&#34;get&#34;&gt;Get&lt;/h3&gt;
&lt;p&gt;The Get operation is similar to the Select statement in a relational database. It is used to fetch the contents of an HBase table.&lt;/p&gt;
&lt;p&gt;You can run the Get command in the HBase shell as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main) :001:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; get &amp;#39;table name&amp;#39;, &amp;#39;row key&amp;#39; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;filters&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;put&#34;&gt;Put&lt;/h3&gt;
&lt;p&gt;The Put operation is used to write data to a table.&lt;/p&gt;
&lt;h3 id=&#34;scan&#34;&gt;Scan&lt;/h3&gt;
&lt;p&gt;The Scan operation is used to read multiple rows from a table. It differs from Get, where the set of rows to read must be specified. Scan can iterate over a row range or all rows in a table.&lt;/p&gt;
&lt;h3 id=&#34;delete&#34;&gt;Delete&lt;/h3&gt;
&lt;p&gt;The Delete operation is used to delete a row or set of rows from an HBase table. It can be executed through &lt;code&gt;HTable.delete()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;When a delete command is executed, it is marked as deleted, and when compaction occurs, the row is finally deleted from the table.&lt;/p&gt;
&lt;p&gt;Internal delete types are as follows.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Delete&lt;/strong&gt;: Used for a specific version of a column.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Delete column&lt;/strong&gt;: Can be used for all column versions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Delete family&lt;/strong&gt;: Used for all columns in a specific ColumnFamily.&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>HBase</category>
      
    </item>
    
    <item>
      <title>Installing HBase with Docker for Local Practice</title>
      <link>https://www.devkuma.com/en/docs/hbase/docker-install/</link>
      <pubDate>Tue, 13 Jun 2023 18:40:33 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/hbase/docker-install/</guid>
      <description>
        
        
        &lt;h2 id=&#34;installing-hbase-with-docker&#34;&gt;Installing HBase with Docker&lt;/h2&gt;
&lt;p&gt;Let&amp;rsquo;s install HBase in a Docker environment using the Docker image below.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;HBase Docker image to install
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://hub.docker.com/r/dajobe/hbase&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://hub.docker.com/r/dajobe/hbase&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;downloading-hbase-docker-run-commands&#34;&gt;Downloading HBase Docker run commands&lt;/h2&gt;
&lt;p&gt;Download, or clone, the HBase Docker run commands from the GitHub repository below.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;GitHub
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/dajobe/hbase-docker&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://github.com/dajobe/hbase-docker&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git clone git@github.com:dajobe/hbase-docker.git
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;running-hbase-docker&#34;&gt;Running HBase Docker&lt;/h2&gt;
&lt;p&gt;With Docker running, execute the following command as-is.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./start-hbase.sh
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It is recommended to use the start-hbase.sh script, which starts the container, inspects it to determine all local API ports and web UI ports, and suggests editing /etc/hosts to add an alias for the container IP if it does not already exist.&lt;/p&gt;
&lt;p&gt;It is recommended to use the start-hbase.sh script, which starts the container, determines all local API ports and web UI ports, and suggests editing /etc/hosts to add an alias for the container IP if it does not already exist.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;% ./start-hbase.sh
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;start-hbase.sh: Starting HBase container
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Error: No such container: hbase-docker
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Unable to find image &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;dajobe/hbase:latest&amp;#39;&lt;/span&gt; locally
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;latest: Pulling from dajobe/hbase
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;6cf436f81810: Pulling fs layer
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;... omitted ...
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;159beed970fa: Pull &lt;span style=&#34;color:#204a87&#34;&gt;complete&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Digest: sha256:daa36a6d90b118ced866b6c76fcd918e7da73302b0e4971f506f0f61f645a9fe
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Status: Downloaded newer image &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;for&lt;/span&gt; dajobe/hbase:latest
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;WARNING: The requested image&lt;span style=&#34;color:#a40000&#34;&gt;&amp;#39;&lt;/span&gt;s platform &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;linux/amd64&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; does not match the detected host platform &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;linux/arm64/v8&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; and no specific platform was requested
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;start-hbase.sh: Container has ID 3804d552250334cc850189e076b77cb0d3066850cef332bec7a125dc29228361
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./start-hbase.sh: line 32: python: &lt;span style=&#34;color:#204a87&#34;&gt;command&lt;/span&gt; not found
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Here, the container ID is &lt;code&gt;3804d552250334cc850189e076b77cb0d3066850cef332bec7a125dc29228361&lt;/code&gt;. Record it because it is needed when running the shell.&lt;/p&gt;
&lt;p&gt;When you run the command above, &lt;code&gt;data&lt;/code&gt; is created in the current path where it was run, ports are opened, and HBase should run.&lt;/p&gt;
&lt;h3 id=&#34;manual-run-method&#34;&gt;Manual run method&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker run --name&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;hbase-docker &lt;span style=&#34;color:#4e9a06&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  -h hbase-docker &lt;span style=&#34;color:#4e9a06&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  -p 9095:9095 &lt;span style=&#34;color:#4e9a06&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  -p 8085:8085 &lt;span style=&#34;color:#4e9a06&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  -p 16010:16010  &lt;span style=&#34;color:#4e9a06&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  -v &lt;span style=&#34;color:#000&#34;&gt;$PWD&lt;/span&gt;/data:/data &lt;span style=&#34;color:#4e9a06&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  -d dajobe/hbase
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;running-the-hbase-shell&#34;&gt;Running the HBase Shell&lt;/h2&gt;
&lt;p&gt;Next, let&amp;rsquo;s run the shell command that can connect to HBase using the Docker image.&lt;/p&gt;
&lt;p&gt;Put the container ID recorded above into &lt;code&gt;$id&lt;/code&gt; and run it.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker run --rm -it --link &lt;span style=&#34;color:#000&#34;&gt;$id&lt;/span&gt;:hbase-docker dajobe/hbase hbase shell
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;On macOS Apple Silicon, such as M1 or M2, the following error may occur.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;% docker run --rm -it --link 3804d552250334cc850189e076b77cb0d3066850cef332bec7a125dc29228361:hbase-docker dajobe/hbase hbase shell
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;WARNING: The requested image&lt;span style=&#34;color:#a40000&#34;&gt;&amp;#39;&lt;/span&gt;s platform &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;linux/amd64&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; does not match the detected host platform &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;linux/arm64/v8&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt; and no specific platform was requested
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In that case, delete the Docker container that is already running, add the &lt;code&gt;--platform linux/amd64&lt;/code&gt; option, and run it again.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;% docker run --rm -it --platform linux/amd64 --link 3804d552250334cc850189e076b77cb0d3066850cef332bec7a125dc29228361:hbase-docker dajobe/hbase hbase shell
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2023-06-16 09:38:17,680 WARN  &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;[&lt;/span&gt;main&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;]&lt;/span&gt; util.NativeCodeLoader: Unable to load native-hadoop library &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;for&lt;/span&gt; your platform... using builtin-java classes where applicable
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;HBase Shell
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Use &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;help&amp;#34;&lt;/span&gt; to get list of supported commands.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Use &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;exit&amp;#34;&lt;/span&gt; to quit this interactive shell.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;For Reference, please visit: http://hbase.apache.org/2.0/book.html#shell
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Version 2.1.2, r1dfc418f77801fbfb59a125756891b9100c1fc6d, Sun Dec &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;30&lt;/span&gt; 21:45:09 PST &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;2018&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 0.0480 seconds
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;main&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt;:001:0&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The command to exit the shell is &lt;code&gt;quit&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;(&lt;/span&gt;main&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;)&lt;/span&gt;:005:0&amp;gt; quit
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;How to use commands will be explained on the next page.&lt;/em&gt;&lt;/p&gt;

      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>HBase</category>
      
    </item>
    
    <item>
      <title>HBase General Shell Commands - status, version, whoami</title>
      <link>https://www.devkuma.com/en/docs/hbase/general-shell-commands/</link>
      <pubDate>Fri, 16 Jun 2023 14:55:22 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/hbase/general-shell-commands/</guid>
      <description>
        
        
        &lt;h2 id=&#34;general-hbase-shell-commands&#34;&gt;General HBase shell commands&lt;/h2&gt;
&lt;p&gt;This section introduces general HBase commands.&lt;/p&gt;
&lt;h2 id=&#34;status&#34;&gt;&lt;code&gt;status&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;Displays cluster status. Additional options, &lt;code&gt;&amp;quot;summary&amp;quot;&lt;/code&gt;, &lt;code&gt;&amp;quot;simple&amp;quot;&lt;/code&gt;, and &lt;code&gt;&amp;quot;detailed&amp;quot;&lt;/code&gt;, can be used to check detailed information. The default is &lt;code&gt;&amp;quot;summary&amp;quot;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You can check cluster status with the status command.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Option&lt;/th&gt;
          &lt;th&gt;Description&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;simple&lt;/td&gt;
          &lt;td&gt;Server information&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;summary&lt;/td&gt;
          &lt;td&gt;Number of servers, load&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;detailed&lt;/td&gt;
          &lt;td&gt;Server information, meta information&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;replication&lt;/td&gt;
          &lt;td&gt;Source and sink information&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;status&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):001:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; status
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1 servers, 0 dead, 2.0000 average load
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;status &#39;simple&#39;&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):002:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; status &amp;#39;simple&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1 live servers
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    532f4d895a98:40371 1686636094968
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        requestsPerSecond=0.0, numberOfOnlineRegions=2, usedHeapMB=19, maxHeapMB=966, numberOfStores=2, numberOfStorefiles=2, storefileUncompressedSizeMB=0, storefileSizeMB=0, memstoreSizeMB=0, storefileIndexSizeMB=0, readRequestsCount=42, writeRequestsCount=5, rootIndexSizeKB=0, totalStaticIndexSizeKB=0, totalStaticBloomSizeKB=0, totalCompactingKVs=0, currentCompactedKVs=0, compactionProgressPct=NaN, coprocessors=[]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0 dead servers
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Aggregate load: 0, regions: 2
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;status &#39;summary&#39;&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):003:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; status &amp;#39;summary&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1 servers, 0 dead, 2.0000 average load
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;status &#39;detailed&#39;&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):004:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; status &amp;#39;detailed&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;version 2.0.0-SNAPSHOT
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0 regionsInTransition
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;master coprocessors: []
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1 live servers
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    532f4d895a98:40371 1686636094968
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        requestsPerSecond=0.0, numberOfOnlineRegions=2, usedHeapMB=21, maxHeapMB=966, numberOfStores=2, numberOfStorefiles=2, storefileUncompressedSizeMB=0, storefileSizeMB=0, memstoreSizeMB=0, storefileIndexSizeMB=0, readRequestsCount=42, writeRequestsCount=5, rootIndexSizeKB=0, totalStaticIndexSizeKB=0, totalStaticBloomSizeKB=0, totalCompactingKVs=0, currentCompactedKVs=0, compactionProgressPct=NaN, coprocessors=[]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;hbase:meta,,1&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            numberOfStores=1, numberOfStorefiles=1, storefileUncompressedSizeMB=0, storefileSizeMB=0, memstoreSizeMB=0, storefileIndexSizeMB=0, readRequestsCount=36, writeRequestsCount=3, rootIndexSizeKB=0, totalStaticIndexSizeKB=0, totalStaticBloomSizeKB=0, totalCompactingKVs=0, currentCompactedKVs=0, compactionProgressPct=NaN, completeSequenceId=10
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;hbase:namespace,,1686636105191.93358ca1f9bf1816320d88c48e39a3b4.&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            numberOfStores=1, numberOfStorefiles=1, storefileUncompressedSizeMB=0, storefileSizeMB=0, memstoreSizeMB=0, storefileIndexSizeMB=0, readRequestsCount=6, writeRequestsCount=2, rootIndexSizeKB=0, totalStaticIndexSizeKB=0, totalStaticBloomSizeKB=0, totalCompactingKVs=0, currentCompactedKVs=0, compactionProgressPct=NaN, completeSequenceId=8
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0 dead servers
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;version&#34;&gt;version&lt;/h2&gt;
&lt;p&gt;Checks the installed HBase version information.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;version&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):001:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; version
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2.0.0-SNAPSHOT, r31ed817447b4c3edef2019d1580aa3ede83a82da, Fri Sep 26 02:07:26 UTC 2014
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;whoami&#34;&gt;whoami&lt;/h3&gt;
&lt;p&gt;Checks the current HBase user.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;whoami&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):008:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; whoami
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root (auth:SIMPLE)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    groups: root
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>HBase</category>
      
    </item>
    
    <item>
      <title>HBase Table Management Commands - create, list, exists, disable/enable, describe, alter, drop</title>
      <link>https://www.devkuma.com/en/docs/hbase/table-management-commands/</link>
      <pubDate>Fri, 16 Jun 2023 14:55:22 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/hbase/table-management-commands/</guid>
      <description>
        
        
        &lt;h2 id=&#34;table-management-commands&#34;&gt;Table Management commands&lt;/h2&gt;
&lt;p&gt;This section introduces HBase Shell commands for table management.&lt;/p&gt;
&lt;h2 id=&#34;create---create-a-table&#34;&gt;create - Create a Table&lt;/h2&gt;
&lt;p&gt;You can create a table by using the &lt;code&gt;create&lt;/code&gt; command. Here, you must specify the table name and Column Family name. The syntax for creating a table in the HBase shell is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;create &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;, &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;column family&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The following is a sample schema for a table named &lt;code&gt;order&lt;/code&gt;. It has two column families: &lt;code&gt;customer&lt;/code&gt; and &lt;code&gt;sales&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/hbase/hbase-column-family.png&#34; alt=&#34;HBase Column family&#34;&gt;&lt;/p&gt;
&lt;p&gt;You can create this table in the HBase shell as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;create &amp;#39;order&amp;#39;, &amp;#39;customer&amp;#39;, &amp;#39;sales&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When executed, it runs as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):002:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; create &amp;#39;order&amp;#39;, &amp;#39;customer&amp;#39;, &amp;#39;sales&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Created table order
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 2.4344 seconds
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;=&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; Hbase::Table - order
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;create-options&#34;&gt;create Options&lt;/h3&gt;
&lt;p&gt;You can also add options when creating a table.&lt;/p&gt;
&lt;p&gt;Create &lt;code&gt;t1&lt;/code&gt; and create column family &lt;code&gt;cf1&lt;/code&gt;, storing up to 5 latest &lt;code&gt;version&lt;/code&gt; values.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;create &amp;#39;t1&amp;#39;, {NAME =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;f1&amp;#39;, VERSIONS =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; 5}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Create &lt;code&gt;t1&lt;/code&gt; and create column families &lt;code&gt;cf1&lt;/code&gt;, &lt;code&gt;cf2&lt;/code&gt;, and &lt;code&gt;cf3&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;create &amp;#39;t1&amp;#39;, {NAME =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;f1&amp;#39;, NAME =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;f2&amp;#39;, NAME =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;f3&amp;#39;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The following commands specify other options.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;create &amp;#39;t1&amp;#39;, {NAME =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;cf2&amp;#39;, VERSION =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; 1, TTL =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; 2592000, BLOCKCACHE =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;true} 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;create &amp;#39;t1&amp;#39;, {NAME =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;cf2&amp;#39;, CONFIGURATION =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; {&amp;#39;hbase.hstore.blockingStoreFiles&amp;#39; =&amp;#39;10&amp;#39;}} 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;list---view-table-list&#34;&gt;list - View Table List&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;list&lt;/code&gt; is a command used to list all tables in HBase. The syntax of the list command is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;list
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you enter this command and run it at the HBase prompt, all HBase tables are displayed as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):004:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; list
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;TABLE
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;order
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1 row(s) in 0.1070 seconds
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;=&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; [&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;order&amp;#34;&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can also add options as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):005:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; list &amp;#39;customer.*&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;TABLE
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;order
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1 row(s) in 0.0140 seconds
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;=&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; [&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;order&amp;#34;&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;exists---check-table-existence&#34;&gt;exists - Check Table Existence&lt;/h2&gt;
&lt;p&gt;You can check whether a table exists by using the &lt;code&gt;exists&lt;/code&gt; command. The following is the syntax for checking whether a table exists.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;exists &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The following example checks whether the &lt;code&gt;order&lt;/code&gt; table exists.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):022:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; exists &amp;#39;order&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Table order does exist
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0 row(s) in 0.0680 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The following example checks whether the &lt;code&gt;user&lt;/code&gt; table exists, where it does not actually exist.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):023:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; exists &amp;#39;user&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Table user does not exist
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0 row(s) in 0.0110 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;disable---disable-a-table&#34;&gt;disable - Disable a Table&lt;/h2&gt;
&lt;p&gt;To delete a table or change its settings, you must first disable the table by using the &lt;code&gt;disable&lt;/code&gt; command. You can enable it again by using the &lt;code&gt;enable&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;The syntax for disabling a table is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;disable &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The following example shows how to disable the &lt;code&gt;order&lt;/code&gt; table.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):004:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; disable &amp;#39;order&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0 row(s) in 1.4570 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Even after disabling a table, you can check that the table exists with the &lt;code&gt;list&lt;/code&gt; and &lt;code&gt;exists&lt;/code&gt; commands.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):009:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; list
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;TABLE
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;order
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1 row(s) in 0.0140 seconds
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;=&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; [&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;order&amp;#34;&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A disabled table cannot be scanned. The following error occurs.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):010:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; scan &amp;#39;order&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ROW                                         COLUMN+CELL
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ERROR: order is disabled.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;// omitted
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;is_disabled&#34;&gt;is_disabled&lt;/h3&gt;
&lt;p&gt;This command is used to check whether a table is disabled. The syntax is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;is_disabled &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The following example checks whether a table named &lt;code&gt;order&lt;/code&gt; is disabled. It returns &lt;code&gt;true&lt;/code&gt; if disabled and &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):011:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; is_disabled &amp;#39;order&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;true
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0 row(s) in 0.0360 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;disable_all&#34;&gt;disable_all&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;disable_all&lt;/code&gt; command is used to disable all tables matching a given regular expression. The syntax of the &lt;code&gt;disable_all&lt;/code&gt; command is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;disable_all ‘&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;regex table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;’ 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A simple example is shown below. The following command disables all tables that start with &lt;code&gt;r&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;disable_all &amp;#39;r.*&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Assume HBase has four tables that start with &lt;code&gt;dev&lt;/code&gt;: &lt;code&gt;dev_follow&lt;/code&gt;, &lt;code&gt;dev_friend&lt;/code&gt;, &lt;code&gt;dev_test&lt;/code&gt;, and &lt;code&gt;dev_user&lt;/code&gt;. The following code disables all tables that start with &lt;code&gt;dev&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):017:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; disable_all &amp;#39;dev.*&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dev_follow
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dev_friend
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dev_test
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dev_user
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Disable the above 4 tables (y/n)?
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;y
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;4 tables successfully disabled
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;enable---enable-a-table&#34;&gt;enable - Enable a Table&lt;/h2&gt;
&lt;p&gt;To enable a disabled table, use the &lt;code&gt;enable&lt;/code&gt; command. The syntax for enabling a table is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;enable &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The following is an example of enabling a table.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):018:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; enable &amp;#39;order&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0 row(s) in 0.6580 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After enabling the table, scan it. If no error occurs, the table has been enabled normally.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):020:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; scan &amp;#39;order&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ROW                                         COLUMN+CELL
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0 row(s) in 0.0730 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;is_enabled&#34;&gt;is_enabled&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;is_enabled&lt;/code&gt; command is used to check whether a table is enabled. The syntax is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;is_enabled &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The following command checks whether a table named &lt;code&gt;order&lt;/code&gt; is enabled. It returns &lt;code&gt;true&lt;/code&gt; if enabled and &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):021:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; is_enabled &amp;#39;order&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;true
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0 row(s) in 0.0750 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;describe---describe-a-table&#34;&gt;describe - Describe a Table&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;describe&lt;/code&gt; command returns a description of a table. The syntax is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;describe &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The following is the output of the &lt;code&gt;describe&lt;/code&gt; command for the &lt;code&gt;order&lt;/code&gt; table.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):006:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; describe &amp;#39;order&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;DESCRIPTION                                                                                                  ENABLED
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &amp;#39;order&amp;#39;, {NAME =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;customer&amp;#39;, DATA_BLOCK_ENCODING =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;NONE&amp;#39;, BLOOMFILTER =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;ROW&amp;#39;, REPLICATION_SCO true
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; PE =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;0&amp;#39;, VERSIONS =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;1&amp;#39;, COMPRESSION =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;NONE&amp;#39;, MIN_VERSIONS =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;0&amp;#39;, TTL =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;FOREVER&amp;#39;, KEEP_DELETED_CELL
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; S =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;false&amp;#39;, BLOCKSIZE =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;65536&amp;#39;, IN_MEMORY =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;false&amp;#39;, BLOCKCACHE =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;true&amp;#39;}, {NAME =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;sales&amp;#39;, DATA_BLO
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; CK_ENCODING =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;NONE&amp;#39;, BLOOMFILTER =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;ROW&amp;#39;, REPLICATION_SCOPE =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;0&amp;#39;, VERSIONS =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;1&amp;#39;, COMPRESSION =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;NON
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; E&amp;#39;, MIN_VERSIONS =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;0&amp;#39;, TTL =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;FOREVER&amp;#39;, KEEP_DELETED_CELLS =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;false&amp;#39;, BLOCKSIZE =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;65536&amp;#39;, IN_MEMORY =
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;false&amp;#39;, BLOCKCACHE =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;true&amp;#39;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1 row(s) in 0.1450 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;alter---change-a-table&#34;&gt;alter - Change a Table&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;alter&lt;/code&gt; is a command used to change an existing table. You can use this command to change the maximum number of cells in a column family, set and remove table-scope operators, and delete column families from a table.&lt;/p&gt;
&lt;h3 id=&#34;change-the-maximum-number-of-cells-in-a-column-family&#34;&gt;Change the Maximum Number of Cells in a Column Family&lt;/h3&gt;
&lt;p&gt;The following is the syntax for changing the maximum number of cells in a column family.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;alter &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;, NAME =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;column family&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;, VERSIONS =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; 5 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The following example sets the maximum number of cells to 5.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):007:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;alter &amp;#39;order&amp;#39;, NAME =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;customer&amp;#39;, VERSIONS =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; 5
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Updating all regions with the new schema...
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0/1 regions updated.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1/1 regions updated.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Done.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0 row(s) in 2.4240 seconds
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):009:0&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;table-scope-operators&#34;&gt;Table-Scope Operators&lt;/h3&gt;
&lt;p&gt;With &lt;code&gt;alter&lt;/code&gt;, you can set and remove table-scope operators such as &lt;code&gt;MAX_FILESIZE&lt;/code&gt;, &lt;code&gt;READONLY&lt;/code&gt;, &lt;code&gt;MEMSTORE_FLUSHSIZE&lt;/code&gt;, and &lt;code&gt;DEFERRED_LOG_FLUSH&lt;/code&gt;.&lt;/p&gt;
&lt;h4 id=&#34;readonly---set-read-only&#34;&gt;READONLY - Set Read-Only&lt;/h4&gt;
&lt;p&gt;The following is the syntax for making a table read-only.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;alter &amp;#39;&amp;lt;table name&amp;gt;&amp;#39;, READONLY(option)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The following example makes the &lt;code&gt;order&lt;/code&gt; table read-only.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):009:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; alter &amp;#39;order&amp;#39;, READONLY
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Updating all regions with the new schema...
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0/1 regions updated.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1/1 regions updated.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Done.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0 row(s) in 2.3650 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;max_filesize---change-region-setting&#34;&gt;MAX_FILESIZE - Change Region Setting&lt;/h4&gt;
&lt;p&gt;Change the region setting with &lt;code&gt;MAX_FILESIZE&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;alter &amp;#39;t1&amp;#39;, MAX_FILESIZE =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;123217728&amp;#39; 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This changes the maximum region size to 128 MB.&lt;/p&gt;
&lt;h3 id=&#34;delete-a-column-family&#34;&gt;Delete a Column Family&lt;/h3&gt;
&lt;p&gt;With &lt;code&gt;alter&lt;/code&gt;, you can also delete a column family. The syntax for deleting a column family with &lt;code&gt;alter&lt;/code&gt; is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;alter &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;, &amp;#39;delete&amp;#39; =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;column family&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The following is an example of deleting a column family from the &lt;code&gt;order&lt;/code&gt; table.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):010:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; alter &amp;#39;order&amp;#39;, &amp;#39;delete&amp;#39; =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;sales&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Updating all regions with the new schema...
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0/1 regions updated.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1/1 regions updated.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Done.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0 row(s) in 2.3790 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you check with the &lt;code&gt;describe&lt;/code&gt; command, you can see that &lt;code&gt;&#39;sales&#39;&lt;/code&gt; has disappeared.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):011:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; describe &amp;#39;order&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;DESCRIPTION                                                                                                  ENABLED
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &amp;#39;order&amp;#39;, {NAME =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;READONLY&amp;#39;, DATA_BLOCK_ENCODING =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;NONE&amp;#39;, BLOOMFILTER =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;ROW&amp;#39;, REPLICATION_SCO true
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; PE =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;0&amp;#39;, COMPRESSION =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;NONE&amp;#39;, VERSIONS =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;1&amp;#39;, TTL =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;FOREVER&amp;#39;, MIN_VERSIONS =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;0&amp;#39;, KEEP_DELETED_CELL
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; S =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;false&amp;#39;, BLOCKSIZE =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;65536&amp;#39;, IN_MEMORY =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;false&amp;#39;, BLOCKCACHE =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;true&amp;#39;}, {NAME =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;customer&amp;#39;, DATA_
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; BLOCK_ENCODING =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;NONE&amp;#39;, BLOOMFILTER =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;ROW&amp;#39;, REPLICATION_SCOPE =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;0&amp;#39;, VERSIONS =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;5&amp;#39;, COMPRESSION =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; NONE&amp;#39;, MIN_VERSIONS =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;0&amp;#39;, TTL =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;FOREVER&amp;#39;, KEEP_DELETED_CELLS =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;false&amp;#39;, BLOCKSIZE =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;65536&amp;#39;, IN_MEMOR
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; Y =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;false&amp;#39;, BLOCKCACHE =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;true&amp;#39;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1 row(s) in 0.0850 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;drop---delete-a-table&#34;&gt;drop - Delete a Table&lt;/h2&gt;
&lt;p&gt;You can delete a table by using the &lt;code&gt;drop&lt;/code&gt; command. The syntax is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;drop &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The table must be disabled before it is deleted.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):024:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; disable &amp;#39;order&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0 row(s) in 1.3960 seconds
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):025:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; drop &amp;#39;order&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0 row(s) in 0.2860 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Use the &lt;code&gt;exists&lt;/code&gt; command to check whether the table has been deleted.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):026:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; exists &amp;#39;order&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Table order does not exist
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0 row(s) in 0.0710 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;drop_all&#34;&gt;drop_all&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;drop_all&lt;/code&gt; command is used to delete all tables matching a given regular expression. The syntax is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;drop_all &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;regex table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A simple example is shown below. The following command deletes all tables that start with &lt;code&gt;t&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;drop_all &amp;#39;t.*&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;
&lt;p&gt;Note: All target tables must be disabled before deletion.&lt;/p&gt;
&lt;/blockquote&gt;

      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>HBase</category>
      
    </item>
    
    <item>
      <title>HBase Data Manipulation Commands - put, get, delete, deleteall, scan, count, truncate</title>
      <link>https://www.devkuma.com/en/docs/hbase/data-manipulation-commands/</link>
      <pubDate>Fri, 16 Jun 2023 14:55:22 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/hbase/data-manipulation-commands/</guid>
      <description>
        
        
        &lt;h2 id=&#34;data-manipulation-commands&#34;&gt;Data Manipulation commands&lt;/h2&gt;
&lt;p&gt;This section introduces HBase Shell commands for manipulating data.&lt;/p&gt;
&lt;h2 id=&#34;put---insertupdate-data&#34;&gt;put - Insert/Update Data&lt;/h2&gt;
&lt;p&gt;This section introduces how to create and update data in an HBase table.&lt;/p&gt;
&lt;p&gt;The following HBase table will be created.&lt;br&gt;
&lt;img src=&#34;https://www.devkuma.com/docs/hbase/hbase-column-family.png&#34; alt=&#34;HBase Column family&#34;&gt;&lt;/p&gt;
&lt;p&gt;You can insert and update a row in a table by using the &lt;code&gt;put&lt;/code&gt; command. The syntax is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;put &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;, &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;row id&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;, &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;column family&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;:&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;column name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;, &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;value&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;insert-the-first-row&#34;&gt;Insert the First Row&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;create &amp;#39;order&amp;#39;, &amp;#39;customer&amp;#39;, &amp;#39;sales&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;put &amp;#39;order&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;customer:name&amp;#39;, &amp;#39;John White&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;put &amp;#39;order&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;customer:city&amp;#39;, &amp;#39;Los Angeles&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;put &amp;#39;order&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;sales:product&amp;#39;, &amp;#39;Chairs&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;put &amp;#39;order&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;sales:amount&amp;#39;, &amp;#39;400.00&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;First, create the table.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):001:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; create &amp;#39;order&amp;#39;, &amp;#39;customer&amp;#39;, &amp;#39;sales&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Created table order
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 5.0510 seconds
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;=&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; Hbase::Table - order
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then insert the first row values into the table.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):002:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; put &amp;#39;order&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;customer:name&amp;#39;, &amp;#39;John White&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 0.6725 seconds
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):003:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; put &amp;#39;order&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;customer:city&amp;#39;, &amp;#39;Los Angeles&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 0.0318 seconds
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):004:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; put &amp;#39;order&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;sales:product&amp;#39;, &amp;#39;Chairs&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 0.0988 seconds
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):005:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; put &amp;#39;order&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;sales:amount&amp;#39;, &amp;#39;400.00&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 0.0423 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you scan the whole table, the following result is displayed.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):006:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; scan &amp;#39;order&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ROW                               COLUMN+CELL
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 101                              column=customer:city, timestamp=1686908392705, value=Los Angeles
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 101                              column=customer:name, timestamp=1686908388954, value=John White
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 101                              column=sales:amount, timestamp=1686908401071, value=400.00
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 101                              column=sales:product, timestamp=1686908398256, value=Chairs
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1 row(s)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 0.4121 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;update-data&#34;&gt;Update Data&lt;/h3&gt;
&lt;p&gt;You can change an existing cell value by using the &lt;code&gt;put&lt;/code&gt; command. The syntax is the same as when inserting data.&lt;/p&gt;
&lt;p&gt;Specify a new value as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;put &amp;#39;order&amp;#39;,&amp;#39;101&amp;#39;,&amp;#39;customer:city&amp;#39;,&amp;#39;LA&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The command execution is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):007:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; put &amp;#39;order&amp;#39;,&amp;#39;101&amp;#39;,&amp;#39;customer:city&amp;#39;,&amp;#39;LA&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 0.0677 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):008:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; scan &amp;#39;order&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ROW                               COLUMN+CELL
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 101                              column=customer:city, timestamp=1686909532774, value=LA
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 101                              column=customer:name, timestamp=1686908388954, value=John White
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 101                              column=sales:amount, timestamp=1686908401071, value=400.00
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 101                              column=sales:product, timestamp=1686908398256, value=Chairs
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1 row(s)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 0.1186 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;get---retrieve-data&#34;&gt;get - Retrieve Data&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;get&lt;/code&gt; command is used to read data from an HBase table. The syntax is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;get &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;, &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;row id&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The following example uses the &lt;code&gt;get&lt;/code&gt; command to retrieve row &lt;code&gt;101&lt;/code&gt; from the &lt;code&gt;order&lt;/code&gt; table.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):009:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; get &amp;#39;order&amp;#39;, &amp;#39;101&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;COLUMN                            CELL
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; customer:city                    timestamp=1686909532774, value=LA
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; customer:name                    timestamp=1686908388954, value=John White
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; sales:amount                     timestamp=1686908401071, value=400.00
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; sales:product                    timestamp=1686908398256, value=Chairs
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1 row(s)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 0.3162 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;retrieve-a-specific-row&#34;&gt;Retrieve a Specific Row&lt;/h3&gt;
&lt;p&gt;The following is the syntax for using the &lt;code&gt;get&lt;/code&gt; command to retrieve a specific column.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;get &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;, &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;row id&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;, {COLUMN =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;column family&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;:&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;column name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The following is an example of retrieving a specific column from an HBase table.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):010:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; get &amp;#39;order&amp;#39;, &amp;#39;101&amp;#39;, {COLUMN =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;customer:name&amp;#39;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;COLUMN                            CELL
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; customer:name                    timestamp=1686908388954, value=John White
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1 row(s)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 0.1450 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;delete---delete-a-specific-cell-from-a-table&#34;&gt;delete - Delete a Specific Cell from a Table&lt;/h2&gt;
&lt;p&gt;You can delete a specific cell from a table by using the &lt;code&gt;delete&lt;/code&gt; command. The syntax of the &lt;code&gt;delete&lt;/code&gt; command is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;delete &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;, &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;row id&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;, &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;column name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;, &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;timestamp&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The following is an example of deleting a specific cell. Here, &lt;code&gt;city&lt;/code&gt; is deleted.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):011:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; delete &amp;#39;order&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;customer:city&amp;#39;, 1686909532774
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 0.0917 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you query again, you can see that the &lt;code&gt;&#39;LA&#39;&lt;/code&gt; value changed with the previous &lt;code&gt;put&lt;/code&gt; command has been deleted and the existing &lt;code&gt;&#39;Los Angeles&#39;&lt;/code&gt; value is visible again.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):012:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; get &amp;#39;order&amp;#39;, &amp;#39;101&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;COLUMN                            CELL
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; customer:city                    timestamp=1686908392705, value=Los Angeles
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; customer:name                    timestamp=1686908388954, value=John White
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; sales:amount                     timestamp=1686908401071, value=400.00
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; sales:product                    timestamp=1686908398256, value=Chairs
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1 row(s)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 0.2196 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;deleteall---delete-all-cells-in-a-table-row&#34;&gt;deleteall - Delete All Cells in a Table Row&lt;/h2&gt;
&lt;p&gt;You can delete all cells in a row by using the &lt;code&gt;deleteall&lt;/code&gt; command. The following is the syntax of the &lt;code&gt;deleteall&lt;/code&gt; command.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;deleteall &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;, &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;row id&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The following is an example of the &lt;code&gt;deleteall&lt;/code&gt; command that deletes all cells in row 1 of the &lt;code&gt;order&lt;/code&gt; table.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):013:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; deleteall &amp;#39;order&amp;#39;,&amp;#39;101&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 0.1271 seconds
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):015:0&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Check the table by using the &lt;code&gt;scan&lt;/code&gt; command. After deleting the table data, the table snapshot is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):015:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; scan &amp;#39;order&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ROW                               COLUMN+CELL
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0 row(s)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 0.0518 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;scan---retrieve-data&#34;&gt;scan - Retrieve Data&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;scan&lt;/code&gt; command is used to view data in HTable. You can use the &lt;code&gt;scan&lt;/code&gt; command to fetch table data. The syntax is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;scan &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;First, insert data as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;put &amp;#39;order&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;customer:name&amp;#39;, &amp;#39;John White&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;put &amp;#39;order&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;customer:city&amp;#39;, &amp;#39;Los Angeles&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;put &amp;#39;order&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;sales:product&amp;#39;, &amp;#39;Chairs&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;put &amp;#39;order&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;sales:amount&amp;#39;, &amp;#39;400.00&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The following example uses the &lt;code&gt;scan&lt;/code&gt; command to retrieve data from the table.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):019:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; scan &amp;#39;order&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ROW                               COLUMN+CELL
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 101                              column=customer:city, timestamp=1686912065208, value=Los Angeles
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 101                              column=customer:name, timestamp=1686912059341, value=John White
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 101                              column=sales:amount, timestamp=1686912074891, value=400.00
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 101                              column=sales:product, timestamp=1686912070718, value=Chairs
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1 row(s)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 0.2649 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;count---count-data&#34;&gt;count - Count Data&lt;/h2&gt;
&lt;p&gt;You can count the number of rows in a table by using the &lt;code&gt;count&lt;/code&gt; command. The syntax is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;count ‘&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39; 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):020:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; count &amp;#39;order&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1 row(s)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 0.2992 seconds
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;=&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; 1
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;truncate---delete-all&#34;&gt;truncate - Delete All&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;truncate&lt;/code&gt; command disables, drops, and recreates a table. The syntax of &lt;code&gt;truncate&lt;/code&gt; is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;truncate ‘&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39; 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The following is an example of the &lt;code&gt;truncate&lt;/code&gt; command. Here, the &lt;code&gt;order&lt;/code&gt; table was deleted and recreated.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):021:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; truncate &amp;#39;order&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Truncating &amp;#39;order&amp;#39; table (it may take a while):
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Disabling table...
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Truncating table...
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 5.6828 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After deleting the table data with &lt;code&gt;truncate&lt;/code&gt;, check it by using the &lt;code&gt;scan&lt;/code&gt; command. You can confirm that the table has no rows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):023:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; scan &amp;#39;order&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ROW                               COLUMN+CELL
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0 row(s)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 1.6790 seconds
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>HBase</category>
      
    </item>
    
    <item>
      <title>HBase Security Commands - grant, revoke, user_permission</title>
      <link>https://www.devkuma.com/en/docs/hbase/security-tools/</link>
      <pubDate>Sun, 18 Jun 2023 16:13:38 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/hbase/security-tools/</guid>
      <description>
        
        
        &lt;h2 id=&#34;security-tools&#34;&gt;Security tools&lt;/h2&gt;
&lt;p&gt;In HBase, permissions can be granted to and revoked from users. There are three commands for security purposes.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;grant&lt;/li&gt;
&lt;li&gt;revoke&lt;/li&gt;
&lt;li&gt;user_permission&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;grant---granting-permissions&#34;&gt;grant - granting permissions&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;grant&lt;/code&gt; command grants users specific permissions such as read, write, execute, and admin permissions for tables. The syntax of the grant command is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;grant &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;user&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39; &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;permissions&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39; [&amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39; [&amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;column family&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39; [&amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;column; qualifier&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;]]
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;RWXCA can be used to grant permissions to users.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;R: READ permission&lt;/li&gt;
&lt;li&gt;W: WRITE permission&lt;/li&gt;
&lt;li&gt;X: EXEC permission&lt;/li&gt;
&lt;li&gt;C: CREATE permission&lt;/li&gt;
&lt;li&gt;A: ADMIN permission&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;grant &amp;#39;devkuma&amp;#39;, &amp;#39;RWXCA&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;grant &amp;#39;devkuma&amp;#39;, &amp;#39;RW&amp;#39; &amp;#39;t1&amp;#39;, &amp;#39;cf1&amp;#39;, &amp;#39;qualifier1&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;revoke---deleting-permissions&#34;&gt;revoke - deleting permissions&lt;/h2&gt;
&lt;p&gt;Deletes a user&amp;rsquo;s access permissions.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;revoke &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;user&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;lt;permissions&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; [&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; [&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;column family&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; [&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;column; qualifier&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;]]
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;revoke &amp;#39;devkuma&amp;#39;, &amp;#39;t1&amp;#39;, &amp;#39;cf1&amp;#39;, &amp;#39;qualifier1&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;user_permission---querying-permissions-for-a-specific-table&#34;&gt;user_permission - querying permissions for a specific table&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;user_permission&lt;/code&gt; command is used to query all permissions for a specific table. The syntax is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;user_permission &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;table name&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Shows all permissions that exist for a specific table.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;user_permission &amp;#39;t1&amp;#39; 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>HBase</category>
      
    </item>
    
    <item>
      <title>HBase Compression, Compaction, and Data Block Encoding</title>
      <link>https://www.devkuma.com/en/docs/hbase/compression/</link>
      <pubDate>Thu, 22 Jun 2023 19:13:23 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/hbase/compression/</guid>
      <description>
        
        
        &lt;h2 id=&#34;compression-and-compaction&#34;&gt;Compression and Compaction&lt;/h2&gt;
&lt;p&gt;Regions stored on an HBase RegionServer have an HStore for each Column Family, and this consists of MemStore and HFile for that CF.&lt;/p&gt;
&lt;p&gt;MemStore is Column Family data in memory, and HFile is Column Family data stored on local disk, meaning HDFS. The reason for this layered structure is that data must be sorted by Row key according to the HBase table structure, so it cannot be written directly to disk and must be sorted in memory first.&lt;/p&gt;
&lt;p&gt;When write operations such as put or update are performed in HBase, data is first recorded in the WAL (Write Ahead Log), then written to MemStore. For read operations such as scan, HBase checks MemStore first and then searches HFiles for the requested content.&lt;/p&gt;
&lt;p&gt;When repeated writes cause MemStore data size to exceed the configured threshold, MemStore data is stored as an HFile. In a Region composed of many HFiles, as HFiles increase, compaction occurs and merges multiple HFiles into larger ones. As a result, many small HFiles are reduced to fewer large HFiles. This operation is called compaction.&lt;/p&gt;
&lt;p&gt;HBase compaction is performed as minor compaction and major compaction.&lt;/p&gt;
&lt;h3 id=&#34;minor-compaction&#34;&gt;Minor Compaction&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Minor compaction is the process of merging several recently created small files into a larger configured HFile size.&lt;/li&gt;
&lt;li&gt;As data is inserted, many small HFiles are created. Too many files can reduce performance, so HBase automatically manages the number of HFiles by remaking multiple HFiles into a few larger HFiles.&lt;/li&gt;
&lt;li&gt;Because data stored in HFiles is sorted, it can be merged quickly using merge sort.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/hbase/hbase-minor-compaction.png&#34; alt=&#34;Minor Compaction&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;major-compaction&#34;&gt;Major Compaction&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Major compaction gathers all HFiles for a Column Family in a specific Region and creates one HFile per column. It runs once every 7 days by default.&lt;/li&gt;
&lt;li&gt;During this process, unnecessary cells and expired cells are removed to improve overall read performance. Data with Tombstone Markers is finally deleted at this time.&lt;/li&gt;
&lt;li&gt;When this work is performed, large amounts of file read/write activity occur, which can increase disk I/O and network traffic.&lt;/li&gt;
&lt;li&gt;It can be scheduled to run automatically, and this can be used to schedule it on weekends or at night to minimize the impact of sudden I/O increases on the service.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/hbase/hbase-majar-compaction.png&#34; alt=&#34;Major Compaction&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;compaction-settings&#34;&gt;Compaction settings&lt;/h2&gt;
&lt;p&gt;Minor compaction uses the following settings to configure the number of HFiles that will be compacted.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;hbase.hstore.compaction.min&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;Sets the minimum number of HFiles for minor compaction.&lt;/li&gt;
&lt;li&gt;The default is 3, and it must be set to 2 or higher.&lt;/li&gt;
&lt;li&gt;If the value is too large, minor compaction is delayed and later processing all at once can create load.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hbase.hstore.compaction.max&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;Sets the maximum number of HFiles for minor compaction.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The following settings specify the size of HFiles to compact.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;hbase.hstore.compaction.min.size&lt;/code&gt;: HFiles smaller than this value are always included when searching for minor compaction through ExploringCompactionPolicy. This value is used together with &lt;code&gt;hbase.hstore.compaction.ratio&lt;/code&gt; to choose HFiles for compaction.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hbase.hstore.compaction.max.size&lt;/code&gt;: HFiles larger than this size are excluded from minor compaction. If minor compaction occurs often but does not have much effect, this value can be reduced so large files are excluded from minor compaction. Default: &lt;code&gt;9223372036854775807&lt;/code&gt;, LONG.MAX_VALUE, bytes.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Other settings:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;hbase.hregion.majorcompaction&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;HBase can have multiple StoreFiles for one Region. Periodically, to improve performance, it gathers these files and combines them into one larger file. This process involves significant CPU usage and disk I/O, and response time may decrease. Therefore, when response time matters, it is better to run Major compaction manually during off-peak time.&lt;/li&gt;
&lt;li&gt;The default is 86,400,000 ms. If this value is changed to 0, periodic Major Compaction will not run.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hbase.hregion.majorcompaction.jitter&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;The property defaults to 0.2, or 20%. It spreads out the timing when Major compaction runs for each stored file.&lt;/li&gt;
&lt;li&gt;Without it, major compaction runs simultaneously every 24 hours.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;hbase-compression-and-data-block-encoding&#34;&gt;HBase compression and data block encoding&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;The codecs mentioned in this section are for encoding and decoding data blocks or row keys. For more information about replication codecs, see &lt;a href=&#34;https://hbase.apache.org/book.html#cluster.replication.preserving.tags&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;cluster.replication.preserving.tags&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;HBase supports several compression algorithms that can be enabled for a ColumnFamily. Data block encoding uses HBase&amp;rsquo;s underlying design and patterns, such as sorted row keys and the schema of a given table, to limit information duplication in keys. Compressors can reduce the size of large opaque byte arrays in Cells and significantly reduce the storage space needed for uncompressed data.&lt;/p&gt;
&lt;p&gt;Compressors and data block encoding can be used together in the same ColumnFamily.&lt;/p&gt;
&lt;h3 id=&#34;changes-are-applied-during-compaction&#34;&gt;Changes are applied during compaction&lt;/h3&gt;
&lt;p&gt;If compression or encoding is changed for a ColumnFamily, the change is applied during compaction.&lt;/p&gt;
&lt;p&gt;Some codecs use features built into Java, such as GZip compression. Other codecs depend on native libraries. Native libraries can be provided through codec dependencies installed in the HBase library directory, or as part of Hadoop when using Hadoop codecs. Hadoop codecs usually have native code components, so follow the &lt;a href=&#34;https://hbase.apache.org/book.html#hadoop.native.lib&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Hadoop native binary support installation instructions&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt; to use Hadoop native libraries in HBase.&lt;/p&gt;
&lt;p&gt;This section describes common codecs used and tested in HBase.&lt;/p&gt;
&lt;p&gt;Whichever codec you use, you must test that the codec is installed correctly and available on all nodes in the cluster. Additional operational steps may be needed to verify codec availability on newly deployed nodes. The &lt;a href=&#34;https://hbase.apache.org/book.html#compression.test&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;compression.test&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt; utility can be used to verify that a specified codec is installed correctly.&lt;/p&gt;
&lt;p&gt;To configure HBase to use compressors, see &lt;a href=&#34;https://hbase.apache.org/book.html#compressor.install&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;compressor.install&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;. To enable a compressor for a ColumnFamily, see &lt;a href=&#34;https://hbase.apache.org/book.html#changing.compression&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;changing.compression&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;. To enable data block encoding for a ColumnFamily, see &lt;a href=&#34;https://hbase.apache.org/book.html#data.block.encoding.enable&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;data.block.encoding.enable&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;block-compressors&#34;&gt;Block Compressors&lt;/h3&gt;
&lt;h4 id=&#34;none&#34;&gt;NONE&lt;/h4&gt;
&lt;p&gt;This compression type constant selects no compression and is the default.&lt;/p&gt;
&lt;h4 id=&#34;brotli&#34;&gt;BROTLI&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Brotli&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Brotli&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt; is a general-purpose lossless compression algorithm. It combines a modern variant of LZ77, Huffman coding, and second-order context modeling, and provides compression ratios comparable to the best general-purpose compression methods currently available. It has similar speed to GZ but provides denser compression.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;bzip2&#34;&gt;BZIP2&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Bzip2 compresses files using the Burrows-Wheeler block-sorting text compression algorithm and Huffman coding. It usually has a much better compression ratio than dictionary-based compression such as LZ, but both compression and decompression may be slower than other options.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;gzgzip&#34;&gt;GZ(GZIP)&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Focuses on compression ratio.&lt;/li&gt;
&lt;li&gt;gzip is based on the DEFLATE algorithm, a combination of LZ77 and Huffman coding. This algorithm is universally available in the Java runtime environment, so it is a good lowest-common-denominator option. However, it is quite slow compared with newer algorithms such as Zstandard.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;lz4&#34;&gt;LZ4&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Focuses on compression/decompression speed.&lt;/li&gt;
&lt;li&gt;LZ4 is a lossless data compression algorithm focused on compression and decompression speed. It belongs to the LZ77 family of compression algorithms, like Brotli, DEFLATE, and Zstandard. In microbenchmarks, LZ4 is the fastest option in that family for both compression and decompression and is generally recommended.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;lzma&#34;&gt;LZMA&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;LZMA is a dictionary compression method somewhat similar to LZ77. It achieves a very high compression ratio with a computationally expensive prediction model and variable-size compression dictionary, while maintaining decompression speed similar to other commonly used compression algorithms. LZMA beats all other options at typical compression ratios, but as a compressor it can be very slow, especially when configured to operate at high compression levels.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;lzo&#34;&gt;LZO&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Focuses on compression/decompression speed and requires additional library installation.&lt;/li&gt;
&lt;li&gt;LZO is another LZ-variant data compression algorithm implemented with a focus on decompression speed. It is not as fast as LZ4 but is close.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;snappy&#34;&gt;SNAPPY&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Focuses on compression/decompression speed.&lt;/li&gt;
&lt;li&gt;SNAPPY is based on LZ77 ideas but optimized for very fast compression speed, achieving only a reasonable level of compression in the tradeoff. It is as fast as LZ4, but its compression ratio is not very high. HBase provides a pure Java Snappy codec that can be used instead of GZ as a universally available option for all Java runtimes on all hardware architectures.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;zstd&#34;&gt;ZSTD&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Zstandard combines a dictionary matching stage (LZ77) with a large search window and fast entropy coding stage using both finite-state entropy and Huffman coding. Compression speed can differ by more than 20x between the fastest and slowest levels, but decompression is uniformly fast, with less than a 20% difference between the fastest and slowest levels.&lt;/li&gt;
&lt;li&gt;ZStandard is the most flexible available compression codec option. At level 1 it provides compression ratio similar to LZ4, with slightly lower performance. At mid levels it provides compression ratio similar to DEFLATE with better performance, and at high levels it provides dense compression similar to LZMA with LZMA-like compression speed, while providing universally fast decompression.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;data-block-encoding-types&#34;&gt;Data Block Encoding Types&lt;/h3&gt;
&lt;p&gt;HBase provides five data block encoding types:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;NONE&lt;/li&gt;
&lt;li&gt;Prefix&lt;/li&gt;
&lt;li&gt;Diff&lt;/li&gt;
&lt;li&gt;Fast Diff&lt;/li&gt;
&lt;li&gt;Prefix Tree&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;none-1&#34;&gt;None&lt;/h4&gt;
&lt;p&gt;None means no encoding is applied and is the default.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ColumnFamily without encoding&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The following table shows a hypothetical ColumnFamily without data block encoding.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;Key Length&lt;/th&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;Value Length&lt;/th&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;Key&lt;/th&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;Value&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;24&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;RowKey:Family:Qualifier0&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;24&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;RowKey:Family:Qualifier1&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;25&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;RowKey:Family:QualifierN&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;25&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;RowKey2:Family:Qualifier1&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;25&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;RowKey2:Family:Qualifier2&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h4 id=&#34;prefix&#34;&gt;Prefix&lt;/h4&gt;
&lt;p&gt;Usually keys often have the same prefix and only the last part differs.&lt;/p&gt;
&lt;p&gt;For example, the first key may be &lt;code&gt;RowKey:Family:Qualifier0&lt;/code&gt;, and the next key may be &lt;code&gt;RowKey:Family:Qualifier1&lt;/code&gt;. Prefix encoding adds an extended column that stores the length of the prefix shared between the current key and the previous key. In this example, if the first key is completely different from the previous key, the prefix length is 0. Since the first 23 characters of the second key are the same, the prefix length becomes 23.&lt;/p&gt;
&lt;p&gt;Of course, if two keys have nothing in common, Prefix provides no benefit.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ColumnFamily with Prefix encoding&lt;/strong&gt;&lt;br&gt;
The following is the same data with Prefix data encoding applied.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;Key Length&lt;/th&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;Value Length&lt;/th&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;Prefix Length&lt;/th&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;Key&lt;/th&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;Value&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;24&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;0&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;RowKey:Family:Qualifier0&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;1&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;23&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;1&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;1&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;23&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;N&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;19&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;6&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;2:Family:Qualifier1&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;1&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;24&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h4 id=&#34;diff&#34;&gt;Diff&lt;/h4&gt;
&lt;p&gt;Diff encoding extends Prefix encoding. Rather than treating the Key as one sequence of bytes, it splits each Key Field so each part of the Key can be compressed more efficiently.&lt;/p&gt;
&lt;p&gt;Two new fields, timestamp and type, are added.&lt;/p&gt;
&lt;p&gt;If the ColumnFamily is the same as the previous row, it is omitted from the current row. If key length, value length, and type are the same as the previous row, the fields are omitted.&lt;/p&gt;
&lt;p&gt;Also, to improve compression, timestamp is not stored in full but as a difference from the previous row&amp;rsquo;s timestamp. In the prefix example, if there are two row keys and timestamp matches exactly and type is the same, the second row does not need to store value length or type, and the timestamp value in the second row becomes 0 instead of a full timestamp.&lt;/p&gt;
&lt;p&gt;Because write and scan speed become slower, Diff encoding is disabled by default even though more data can be cached.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ColumnFamily with Diff encoding&lt;/strong&gt;&lt;br&gt;
This table shows the same ColumnFamily with Diff encoding applied.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;Flags&lt;/th&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;Key Length&lt;/th&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;Value Length&lt;/th&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;Prefix Length&lt;/th&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;Key&lt;/th&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;Timestamp&lt;/th&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;Type Value&lt;/th&gt;
          &lt;th&gt;&lt;/th&gt;
          &lt;th&gt;&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;0&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;24&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;512&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;0&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;RowKey:Family:Qualifier0&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;1340466835163&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;4&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;5&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;-&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;320&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;23&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;1&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;0&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;-&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;3&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;-&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;-&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;23&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;N&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;120&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;8&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;0&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;25&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;576&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;6&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;2:Family:Qualifier1&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;25&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;4&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;5&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;-&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;3384&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;24&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;2&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;1124&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;-&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;&amp;hellip;&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h4 id=&#34;fast-diff&#34;&gt;Fast Diff&lt;/h4&gt;
&lt;p&gt;Fast Diff works similarly to Diff but is implemented faster. It also adds one more field that stores a single bit to track whether the data itself is the same as the previous row. If it is the same, the data is not stored again.&lt;/p&gt;
&lt;p&gt;Use the Fast Diff codec when keys are long or there are many columns.&lt;/p&gt;
&lt;p&gt;The data format is almost the same as Diff encoding, so there is no separate image to explain.&lt;/p&gt;
&lt;h4 id=&#34;prefix-tree&#34;&gt;Prefix Tree&lt;/h4&gt;
&lt;p&gt;Prefix Tree encoding was introduced as an experimental feature in HBase 0.96. Prefix Tree encoding provides memory savings similar to Prefix, Diff, and Fast Diff encoders, but provides faster random access at the cost of slower encoding speed. It was a good idea, but it was rarely used and was removed in HBase 2.0.0.&lt;/p&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://hbase.apache.org/book.html#compression&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Appendix D: Compression and Data Block Encoding In HBase&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>HBase</category>
      
    </item>
    
    <item>
      <title>HBase Data Versioning</title>
      <link>https://www.devkuma.com/en/docs/hbase/data-versioning/</link>
      <pubDate>Thu, 22 Jun 2023 19:13:23 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/hbase/data-versioning/</guid>
      <description>
        
        
        &lt;h2 id=&#34;data-versioning&#34;&gt;Data Versioning&lt;/h2&gt;
&lt;p&gt;As one of HBase&amp;rsquo;s special features, multiple versions can be stored for a specific column value in each cell.&lt;/p&gt;
&lt;p&gt;This is implemented using a timestamp for each version and is sorted in descending order. It uses Unix time converted to milliseconds as a long integer type.&lt;/p&gt;
&lt;p&gt;HBase manages data versions by default. When data is stored with the same Row key, the most recent data is versioned by timestamp and stored in descending order, so the most recent value is found first when reading from storage files.&lt;/p&gt;
&lt;p&gt;Timestamp can also be entered explicitly. By default, HBase keeps up to three changes for each cell, and because scan queries in descending order, the latest data is queried.&lt;/p&gt;
&lt;p&gt;You can also query all stored versions of data as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;get &amp;#39;t1&amp;#39;, &amp;#39;rowkey1&amp;#39;, {COLUMN =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;cf1&amp;#39;, TIMESTAMP =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; ts1}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It is also possible to set a timestamp range and view the value at that point.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;get &amp;#39;t1&amp;#39;, &amp;#39;rowkey1&amp;#39;, {TIMERANGE =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; [start_timestamp, end_timestamp]}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Versioning is usually assigned automatically, but it can also be specified manually.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Automatic versioning
&lt;ul&gt;
&lt;li&gt;Version differences can occur if server times in the cluster are not the same.&lt;/li&gt;
&lt;li&gt;Timestamp can be set when executing the Put method, but generally automatic versioning within the server is recommended.&lt;/li&gt;
&lt;li&gt;The most recent three versions are managed by default, but because Major Compaction has a long cycle, old versions that have not yet been deleted may still exist.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Manual versioning
&lt;ul&gt;
&lt;li&gt;Can be implemented by overriding the timestamp.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/hbase/hbase-data-versioning.png&#34; alt=&#34;Data Versioning&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;does-deleting-reveal-an-older-version-of-a-column-even-when-hbase-versions1&#34;&gt;Does deleting reveal an older version of a column even when HBase VERSIONS=1?&lt;/h2&gt;
&lt;p&gt;Earlier, it was mentioned that the most recent three versions are managed by default, but because Major Compaction has a long cycle, old versions that have not yet been deleted may still exist.&lt;/p&gt;
&lt;p&gt;This section introduces a related issue that can occur.&lt;/p&gt;
&lt;h3 id=&#34;applying-versions&#34;&gt;Applying VERSIONS&lt;/h3&gt;
&lt;p&gt;Apply &lt;code&gt;VERSIONS&lt;/code&gt; to the ColumnFamily as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;create &amp;#39;t1&amp;#39;, {NAME =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;f1&amp;#39;, VERSIONS =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; 2}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;hbase(main):001:0&amp;gt; create &amp;#39;t1&amp;#39;, {NAME =&amp;gt; &amp;#39;f1&amp;#39;, VERSIONS =&amp;gt; 2}
Created table t1
Took 5.9091 seconds
=&amp;gt; Hbase::Table - t1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Next, register data in order.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;put &amp;#39;t1&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;f1:name1&amp;#39;, &amp;#39;test1&amp;#39;
put &amp;#39;t1&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;f1:name1&amp;#39;, &amp;#39;test2&amp;#39;
put &amp;#39;t1&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;f1:name1&amp;#39;, &amp;#39;test2&amp;#39;
put &amp;#39;t1&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;f1:name1&amp;#39;, &amp;#39;test4&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;hbase(main):002:0&amp;gt; put &amp;#39;t1&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;f1:name1&amp;#39;, &amp;#39;test1&amp;#39;
Took 0.7153 seconds
hbase(main):003:0&amp;gt; put &amp;#39;t1&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;f1:name1&amp;#39;, &amp;#39;test2&amp;#39;
Took 0.0318 seconds
hbase(main):004:0&amp;gt; put &amp;#39;t1&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;f1:name1&amp;#39;, &amp;#39;test3&amp;#39;
Took 0.0418 seconds
hbase(main):005:0&amp;gt; put &amp;#39;t1&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;f1:name1&amp;#39;, &amp;#39;test4&amp;#39;
Took 0.0255 seconds
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then delete one by one with the &lt;code&gt;delete&lt;/code&gt; command and check the result.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;delete &amp;#39;t1&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;f1:name1&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;hbase(main):013:0&amp;gt; scan &amp;#39;t1&amp;#39;
ROW                                                                  COLUMN+CELL
 101                                                                 column=f1:name1, timestamp=1687426826665, value=test4
1 row(s)
Took 0.3049 seconds
hbase(main):014:0&amp;gt; delete &amp;#39;t1&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;f1:name1&amp;#39;
Took 0.0160 seconds
hbase(main):015:0&amp;gt; scan &amp;#39;t1&amp;#39;
ROW                                                                  COLUMN+CELL
 101                                                                 column=f1:name1, timestamp=1687426822568, value=test3
1 row(s)
Took 0.1760 seconds
hbase(main):016:0&amp;gt; delete &amp;#39;t1&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;f1:name1&amp;#39;
Took 0.0605 seconds
hbase(main):017:0&amp;gt; scan &amp;#39;t1&amp;#39;
ROW                                                                  COLUMN+CELL
 101                                                                 column=f1:name1, timestamp=1687426817569, value=test2
1 row(s)
Took 0.0710 seconds
hbase(main):018:0&amp;gt; delete &amp;#39;t1&amp;#39;, &amp;#39;101&amp;#39;, &amp;#39;f1:name1&amp;#39;
Took 0.0337 seconds
hbase(main):019:0&amp;gt; scan &amp;#39;t1&amp;#39;
ROW                                                                  COLUMN+CELL
 101                                                                 column=f1:name1, timestamp=1687426813634, value=test1
1 row(s)
Took 0.0265 seconds
hbase(main):020:0&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can see that the previously registered data is queried in order.&lt;/p&gt;
&lt;h2 id=&#34;question-about-versions&#34;&gt;Question about VERSIONS&lt;/h2&gt;
&lt;p&gt;The question here is that &lt;code&gt;VERSIONS&lt;/code&gt; was said to store only one version, but even when &lt;code&gt;VERSIONS =&amp;gt; 2&lt;/code&gt; is specified, more versions of the column appear to be maintained. At first glance, this looks suspiciously like a bug.&lt;/p&gt;
&lt;p&gt;Searching online, a person with the same question was found.&lt;br&gt;
&lt;a href=&#34;https://user.hbase.apache.narkive.com/VnZTqJHA/delete-reveals-older-version-of-a-column-even-when-versions-1&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Delete reveals older version of a column even when VERSIONS=1&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The answer to that question says the following.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Older versions do not actually disappear until compaction occurs. Compaction should be performed once a day unless the major compaction setting is changed, or whenever a Region is split.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This issue occurs because Major Compaction has not yet been performed.&lt;/p&gt;
&lt;h2 id=&#34;how-to-check-versions-application&#34;&gt;How to check VERSIONS application&lt;/h2&gt;
&lt;p&gt;Then how can &lt;code&gt;VERSIONS&lt;/code&gt; be checked? Use the &lt;code&gt;get&lt;/code&gt; command and query details with &lt;code&gt;VERSIONS =&amp;gt; 4&lt;/code&gt; as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;get &amp;#39;t1&amp;#39;, &amp;#39;101&amp;#39;, {COLUMN=&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;f1:name1&amp;#39;,VERSIONS =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; 4 }
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):005:0&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; get &amp;#39;t1&amp;#39;, &amp;#39;101&amp;#39;, {COLUMN=&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;f1:name1&amp;#39;, VERSIONS =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; 4 }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;COLUMN                                                               CELL
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; f1:name1                                                            timestamp=1687427184339, value=test4
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; f1:name1                                                            timestamp=1687427181122, value=test2
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1 row(s)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Took 0.5028 seconds
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hbase(main):006:0&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As shown above, you can see two records according to &lt;code&gt;VERSIONS =&amp;gt; 2&lt;/code&gt; specified when creating the table.&lt;/p&gt;

      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>HBase</category>
      
    </item>
    
    <item>
      <title>HBase BloomFilter</title>
      <link>https://www.devkuma.com/en/docs/hbase/bloom-filter/</link>
      <pubDate>Fri, 23 Jun 2023 19:01:58 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/hbase/bloom-filter/</guid>
      <description>
        
        
        &lt;h2 id=&#34;what-is-bloomfilter&#34;&gt;What is BloomFilter?&lt;/h2&gt;
&lt;p&gt;BloomFilter is a fast search algorithm for multi-hash-function mapping proposed by Bloom in 1970.
This algorithm is generally used in situations where it is necessary to quickly determine whether an element belongs to a set, starting from the premise that strict 100% accuracy is not required.&lt;/p&gt;
&lt;p&gt;For detailed theory, refer to the &lt;a href=&#34;https://www.devkuma.com/docs/data-structure/bloom-filter/&#34;&gt;Bloom Filter data structure explained simply&lt;/a&gt; page.&lt;/p&gt;
&lt;h2 id=&#34;hbase-bloomfilter&#34;&gt;HBase BloomFilter&lt;/h2&gt;
&lt;p&gt;HBase BloomFilter data is stored in StoreFile metadata, and once written, a StoreFile is immutable, so it cannot be updated.&lt;/p&gt;
&lt;p&gt;BloomFilter is a configuration property at the Column family level. If BloomFilter is configured on a table, HBase includes a data fragment of the BloomFilter structure when creating a StoreFile called a MetaBlock.
MetaBlock and DataBlock, which contain actual KeyValue data, are used together in LRU BlockCacheMaintenance.&lt;/p&gt;
&lt;p&gt;Therefore, configuring BloomFilter introduces specific storage and memory cache overhead.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/hbase/hbase-bloom-filter.png&#34; alt=&#34;BloomFilter&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;how-to-configure-hbase-bloomfilter&#34;&gt;How to configure HBase BloomFilter&lt;/h2&gt;
&lt;p&gt;When searching for whether a specific Row key is included, it reduces unnecessary block loading compared to the existing block index, improving overall cluster throughput.&lt;/p&gt;
&lt;p&gt;Bloom filters should be selected according to cell size, number of cells, data storage method, read method, and similar factors.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;According to the HBase documentation, BloomFilter is recommended in most cases.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;BloomFilter has three parameters: &lt;code&gt;NONE&lt;/code&gt; (default), &lt;code&gt;ROW&lt;/code&gt;, and &lt;code&gt;ROWCOL&lt;/code&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ROW&lt;/code&gt;: Indicates a row-level Bloom filter that filters StoreFiles based on the KeyValue row.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ROWCOL&lt;/code&gt;: Indicates a column-level Bloom filter that filters StoreFiles based on the KeyValue row plus column.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Therefore, the space overhead of &lt;code&gt;ROWCOL&lt;/code&gt; is higher than that of &lt;code&gt;ROW&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The more StoreFiles there are in the Region, the better the BloomFilter effect. The fewer StoreFiles there are in the Region, the better HBase read performance becomes.&lt;/p&gt;
&lt;p&gt;Configure the Column family in HBase to enable the BloomFilter command as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;create &amp;#39;t1&amp;#39;,{name =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;c1&amp;#39;, BLOOMFILTER =&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; &amp;#39;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;ROW or ROWCOL&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&amp;#39;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
      </description>
      
      <category>Database</category>
      
      <category>NoSQL</category>
      
      <category>HBase</category>
      
    </item>
    
    <item>
      <title>Cassandra</title>
      <link>https://www.devkuma.com/en/docs/cassandra/</link>
      <pubDate>Fri, 28 Oct 2022 01:02:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/cassandra/</guid>
      <description>
        
        
        &lt;h2 id=&#34;cassandra-overview&#34;&gt;Cassandra overview&lt;/h2&gt;
&lt;p&gt;Cassandra is an open source distributed database management system with high scalability and availability.&lt;br&gt;
Cassandra was originally developed at Facebook to store large amounts of data, and its source code was released in 2008.
After Facebook adopted HBase, a separate product modeled on Google&amp;rsquo;s Bigtable, the number of companies adopting Cassandra was limited for a while. Recently, however, companies such as Apple and Netflix have adopted Cassandra for their large-scale systems from the perspective of availability, so it is attracting attention again.&lt;/p&gt;
&lt;p&gt;Because Cassandra is an open source project, the source code can be obtained and used in production for free. There is also a commercial product edition from DataStax that provides tested support.&lt;/p&gt;
&lt;p&gt;The major release 4.0.0 was released in July 2021.&lt;/p&gt;
&lt;p&gt;This major release advanced features as follows.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Added experimental support for Java 11 and transient replication&lt;/li&gt;
&lt;li&gt;Added Virtual Tables, which publish metrics and YAML configuration information&lt;/li&gt;
&lt;li&gt;Added audit logging useful for compliance and debugging&lt;/li&gt;
&lt;li&gt;Added Full Query Logging (FQL) for live traffic capture and replay&lt;/li&gt;
&lt;li&gt;Optimized the internode messaging protocol&lt;/li&gt;
&lt;li&gt;Improved streaming used to exchange data between cluster nodes&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;main-features-of-cassandra&#34;&gt;Main features of Cassandra&lt;/h2&gt;
&lt;p&gt;The main features of Cassandra are as follows.&lt;/p&gt;
&lt;h3 id=&#34;masterless-architecture&#34;&gt;Masterless architecture&lt;/h3&gt;
&lt;p&gt;Most database cluster architectures use a master-slave method, but Cassandra uses a masterless method.&lt;br&gt;
In this method, each node is equivalent, and there is no master that supervises the nodes. Therefore, there is no single point of failure. Also, depending on replication settings, data registered on each node is automatically propagated to other nodes, enabling high availability.&lt;/p&gt;
&lt;h3 id=&#34;schema-definitions-exist&#34;&gt;Schema definitions exist&lt;/h3&gt;
&lt;p&gt;Unlike document DBs such as MongoDB and key-value stores such as Redis, Cassandra has schema definitions. This makes it easier for developers and operators to understand data contents during application development and operation.
Also, unlike RDBs, Cassandra does not completely depend on schemas and can have somewhat flexible table structures, such as inserting multiple values into one column.&lt;/p&gt;
&lt;h3 id=&#34;performance-scales-linearly&#34;&gt;Performance scales linearly&lt;/h3&gt;
&lt;p&gt;Cassandra can scale processing by adding nodes.&lt;br&gt;
Cassandra officially claims that performance scales linearly, and a &lt;a href=&#34;http://techblog.netflix.com/2011/11/benchmarking-cassandra-scalability-on.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;benchmark conducted by Netflix&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt; supports this.&lt;br&gt;
This scaling performance is thought to be one reason Cassandra is adopted in large-scale systems such as Apple&amp;rsquo;s iCloud.&lt;/p&gt;
&lt;h3 id=&#34;sql-like-queries-available-cql&#34;&gt;SQL-like queries available (CQL)&lt;/h3&gt;
&lt;p&gt;Cassandra can be operated with SQL-like queries called CQL (Cassandra Query Language).
Basic queries such as &lt;code&gt;SELECT&lt;/code&gt;, &lt;code&gt;UPDATE&lt;/code&gt;, and &lt;code&gt;DELETE&lt;/code&gt; can be executed almost exactly like SQL. &lt;code&gt;GROUP BY&lt;/code&gt; has been implemented and supported since version 3.4.3. However, aggregations such as &lt;code&gt;JOIN&lt;/code&gt; are not implemented.&lt;br&gt;
There are also restrictions on functions and sorting such as &lt;code&gt;ORDER BY&lt;/code&gt;, so care is required.&lt;/p&gt;
&lt;h2 id=&#34;cassandra-license&#34;&gt;Cassandra license&lt;/h2&gt;
&lt;p&gt;Cassandra is released under the Apache License version 2, and anyone can freely use, modify, and redistribute it for free, regardless of commercial or non-commercial use.&lt;/p&gt;
&lt;h2 id=&#34;cassandra-operating-environment&#34;&gt;Cassandra operating environment&lt;/h2&gt;
&lt;p&gt;Cassandra is a Java application.&lt;/p&gt;
&lt;p&gt;The latest version of Oracle Java Standard Edition 8 or OpenJDK 8 is required. Java 11 is still experimental support and is not recommended for production use.&lt;br&gt;
To use cqlsh, the latest version of Python 3.6 or later is required.&lt;/p&gt;
&lt;h2 id=&#34;cassandra-download&#34;&gt;Cassandra download&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;http://cassandra.apache.org/download/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;http://cassandra.apache.org/download/&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;

      </description>
      
      <category>Cassandra</category>
      
      <category>NoSQL</category>
      
    </item>
    
  </channel>
</rss>
