Get a row from hbase shell

To retrieve a row from HBase by its row key using the HBase shell, you can use the get command. Here’s the syntax and an example to help you do this:

Syntax

get 'table_name', 'row_key'

Example

Suppose you have an HBase table named my_table and you want to retrieve a row with the row key row1. Here’s how you can do it:

hbase(main):001:0> get 'my_table', 'row1'

This command fetches the row with the specified row key (row1) from my_table.

Additional Options

The get command also supports additional options for specifying column families and versions. Here are some useful options:

  1. Specify a Column Family and Column:

    get 'table_name', 'row_key', 'column_family:column'
    

    For example, to retrieve only the name column in the info column family:

    get 'my_table', 'row1', 'info:name'
    
  2. Retrieve Multiple Versions:

    get 'table_name', 'row_key', {COLUMN => 'column_family:column', VERSIONS => 3}
    

    This command retrieves the latest 3 versions of the specified column.

  3. Display Result in JSON Format:

    get 'table_name', 'row_key', {FORMAT => 'json'}
    

Complete Example with Options

To get multiple versions of a specific column in JSON format:

get 'my_table', 'row1', {COLUMN => 'info:name', VERSIONS => 3, FORMAT => 'json'}

This command will output the latest 3 versions of the name column in the info family in JSON format.

댓글

이 블로그의 인기 게시물

PYTHONPATH, Python 모듈 환경설정

You can use Sublime Text from the command line by utilizing the subl command

git 명령어

[gRPC] server of Java and client of Typescript

[Ubuntu] Apache2.4.x 설치

Create topic on Kafka with partition count, 카프카 토픽 생성하기

리눅스의 부팅과정 (프로세스, 서비스 관리)

Auto-populate a calendar in an MUI (Material-UI) TextField component

The pierce selector in Puppeteer