Operation and maintenance of large data HBase

HBase questions:

  1. Start Hbase database data first TV platform, which requires the use of RegionServer master node. Start Hbase shell in Linux Shell, view the version information of HBase. (Relational database command language. Please use lower case)
    [root @ Master ~] # hbase shell
    HBase Shell; the Enter 'Help' for List of Supported Commands.
    Type "Exit" to the Leave at The HBase Shell
    Version 1.1.2.2.6.1.0-129 , r718c773662346de98a8ce6fd3b5f64e279cb87d4, Wed May 31 03:27:31 UTC 2017

    hbase(main):001:0> version
    1.1.2.2.6.1.0-129, r718c773662346de98a8ce6fd3b5f64e279cb87d4, Wed May 31 03:27:31 UTC 2017

  2. Start Hbase database data first TV platform, which requires the use of RegionServer master node. Start Hbase shell in Linux Shell, view the status information of HBase. (Relational database command language. Please use lower case)
    [root @ Master ~] # hbase shell
    HBase Shell; the Enter 'Help' for List of Supported Commands.
    Type "Exit" to the Leave at The HBase Shell
    Version 1.1.2.2.6.1.0-129 , r718c773662346de98a8ce6fd3b5f64e279cb87d4, Wed May 31 03:27:31 UTC 2017

    hbase(main):002:0> status
    1 active master, 0 backup masters, 2 servers, 0 dead, 1.0000 average load

  3. Start Hbase database data first TV platform, which requires the use of RegionServer master node. Start Hbase shell in Linux Shell, view into the HBase shell of the current system user. (Relational database command language. Please use lower case)
    [root @ Master ~] # hbase shell
    HBase Shell; the Enter 'Help' for List of Supported Commands.
    Type "Exit" to the Leave at The HBase Shell
    Version 1.1.2.2.6.1.0-129 , r718c773662346de98a8ce6fd3b5f64e279cb87d4, Wed May 31 03:27:31 UTC 2017

    hbase(main):001:0> whoami
    root (auth:SIMPLE)
    groups: root

  4. Creating the HBase database table xiandian_user, column families for the info, created after the completion of view xiandian_user table description. (Relational database command language. Please use lower case)
    [root @ Master ~] # hbase shell
    HBase Shell; the Enter 'Help' for List of Supported Commands.
    Type "Exit" to the Leave at The HBase Shell
    Version 1.1.2.2.6.1.0-129 , r718c773662346de98a8ce6fd3b5f64e279cb87d4, Wed May 31 03:27:31 UTC 2017

    hbase(main):002:0> create 'xiandian_user','info'
    0 row(s) in 5.0880 seconds

    => Hbase::Table - xiandian_user
    hbase(main):006:0> desc 'xiandian_user'
    Table xiandian_user is ENABLED
    xiandian_user
    COLUMN FAMILIES DESCRIPTION
    {NAME => ‘info’, BLOOMFILTER => ‘ROW’, VERSIONS => ‘1’, IN_MEMORY => ‘false’, KEEP_DELETED_CELLS => ‘FALSE’, DATA_BLOCK_ENCODING => ‘NONE’, TT
    L => ‘FOREVER’, COMPRESSION => ‘NONE’, MIN_VERSIONS => ‘0’, BLOCKCACHE => ‘true’, BLOCKSIZE => ‘65536’, REPLICATION_SCOPE => ‘0’}
    1 row(s) in 0.0410 seconds

  5. Create a table xiandian_user in HBase Shell, column family for the info, and list the query, then delete the table, and list queries.
    [the root Master @ ~] # hbase shell
    HBase Shell;. Enter 'Help' List of Supported Commands for
    the Type "Exit" to Leave The HBase Shell
    Version 1.1.2.2.6.1.0-129, r718c773662346de98a8ce6fd3b5f64e279cb87d4, Wed On May 31 is 03:27:31 UTC 2017

    hbase(main):002:0> create 'xiandian_user','info'
    0 row(s) in 5.0880 seconds

    => Hbase::Table - xiandian_user

    hbase(main):009:0> disable 'xiandian_user'
    0 row(s) in 4.4040 seconds
    hbase(main):011:0> drop 'xiandian_user'
    0 row(s) in 2.4780 seconds

    hbase(main):012:0> list
    TABLE
    0 row(s) in 0.0070 seconds

    => []

  6. HBase open security authentication, and set permissions to read and write and perform a table xiandian_user have root user in HBase Shell. After setup is complete, use the command to view the relevant information of their competence. (Relational database command language. Please use lowercase)
    Parameters hbase.security.authorization
    Parameter Value true
    [the root @ Master ~] # su hbase
    [HBase @ Master ~] # hbase shell
    HBase Shell; Enter 'Help' for List of Supported Commands.
    The Type "Exit" to Leave The HBase Shell
    1.1.2.2.6.1.0-129 Version, r718c773662346de98a8ce6fd3b5f64e279cb87d4, Wed 31 is 03:27:31 UTC 2017 On May
    HBase (main): 002: 0> grant 'root','RWX','xiandian_user'
    0 Row (S) in 1.1550 seconds The
    HBase (main): 003: 0> user_permission 'xiandian_user'
    the User namespace, the Table, Family, Qualifier: the Permission
    the root default, xiandian_user ,: [the Permission: Actions = the READ, the WRITE, EXEC]
    . 1 Row (S) in 0.0870 seconds The

  7. Created in Hbase Shell Table xiandian, insert a set of data into a table xiandian for xiandian, row1, info: name, xiaoming, after inserting the lookup table xiandian in rowkey row1 the record.
    [the root Master @ ~] # su hbase
    [@ Master HBase the root] $ hbase shell
    HBase Shell;. Enter 'Help' List of Supported Commands for
    the Type "Exit" to Leave The HBase Shell
    Version 1.1.2.2.6.1.0-129, r718c773662346de98a8ce6fd3b5f64e279cb87d4, Wed May 31 03:27:31 UTC 2017

    hbase(main):001:0> create 'xiandian','info'
    0 row(s) in 4.8830 seconds

    => Hbase::Table - xiandian
    hbase(main):002:0> put 'xiandian','row1','info:name','xiaoming'
    0 row(s) in 0.1610 seconds

    hbase(main):003:0> scan 'xiandian'
    ROW COLUMN+CELL
    row1 column=info:name, timestamp=1557058474382, value=xiaoming
    1 row(s) in 0.0370 seconds

  8. Create a table xiandian in Hbase Shell, the column family is "info" and then query all of the records in the table.
    [the root Master @ ~] # su hbase
    [@ Master HBase the root] $ hbase shell
    HBase Shell;. Enter 'Help' List of Supported Commands for
    the Type "Exit" to Leave The HBase Shell
    Version 1.1.2.2.6.1.0-129, r718c773662346de98a8ce6fd3b5f64e279cb87d4, Wed May 31 03:27:31 UTC 2017

    hbase(main):006:0> create 'xiandian','info'
    0 row(s) in 2.5460 seconds

    => Hbase::Table - xiandian
    hbase(main):007:0> scan 'xiandian'
    ROW COLUMN+CELL
    0 row(s) in 0.0130 seconds

  9. Log hbase database, use the command to create a table, column family is member_id ',' address', ' info', created after the finish to see the details of the table, and later found column families' member_id 'this column family is superfluous, need delete, use the command to delete the column family and see the details, and finally see if the table is enabled in.
    [the root Master @ ~] # su hbase
    [@ Master HBase the root] $ hbase shell
    HBase Shell;. Enter 'Help' List of Supported Commands for
    the Type "Exit" to Leave The HBase Shell
    Version 1.1.2.2.6.1.0-129, r718c773662346de98a8ce6fd3b5f64e279cb87d4, Wed May 31 03:27:31 UTC 2017

    hbase(main):027:0> create 'xiandian','member_id','address','info'
    0 row(s) in 2.2860 seconds

    => Hbase::Table – xiandian
    hbase(main):028:0> disable ‘xiandian’
    0 row(s) in 4.3800 seconds

    hbase(main):029:0> alter 'xiandian','delete' => 'member_id'
    Updating all regions with the new schema…
    1/1 regions updated.
    Done.
    0 row(s) in 3.2900 seconds
    hbase(main):030:0> desc 'xiandian'
    Table xiandian is DISABLED
    xiandian
    COLUMN FAMILIES DESCRIPTION
    {NAME => ‘address’, BLOOMFILTER => ‘ROW’, VERSIONS => ‘1’, IN_MEMORY => ‘false’, KEEP_DELETED_CELLS => ‘FALSE’, DATA_BLOCK_ENCODING => ‘NONE’,
    TTL => ‘FOREVER’, COMPRESSION => ‘NONE’, MIN_VERSIONS => ‘0’, BLOCKCACHE => ‘true’, BLOCKSIZE => ‘65536’, REPLICATION_SCOPE => ‘0’}
    {NAME => ‘info’, BLOOMFILTER => ‘ROW’, VERSIONS => ‘1’, IN_MEMORY => ‘false’, KEEP_DELETED_CELLS => ‘FALSE’, DATA_BLOCK_ENCODING => ‘NONE’, TT
    L => ‘FOREVER’, COMPRESSION => ‘NONE’, MIN_VERSIONS => ‘0’, BLOCKCACHE => ‘true’, BLOCKSIZE => ‘65536’, REPLICATION_SCOPE => ‘0’}
    2 row(s) in 0.0170 seconds
    hbase(main):033:0> is_enable 'xiandian'
    false
    0 row(s) in 0.0140 seconds

  10. Log hbase database, create a table, column family for the 'address', 'info', after you have created, insert data into the table, after the insertion is completed, use the command in accordance with the requirements of the query necessary information.
    [the root Master @ ~] # su hbase
    [@ Master HBase the root] $ hbase shell
    HBase Shell;. Enter 'Help' List of Supported Commands for
    the Type "Exit" to Leave The HBase Shell
    Version 1.1.2.2.6.1.0-129, r718c773662346de98a8ce6fd3b5f64e279cb87d4, Wed May 31 03:27:31 UTC 2017

    hbase(main):001:0> create 'xiandian', 'adress','info'
    0 row(s) in 2.5070 seconds

    => Hbase::Table - xiandian
    hbase(main):018:0> put 'xiandian','row1','address','cq'
    0 row(s) in 0.0130 seconds

    hbase(main):019:0> put 'xiandian','row1','info:name','tp'
    0 row(s) in 0.0160 seconds

    hbase(main):020:0> scan 'xiandian'
    ROW COLUMN+CELL
    row1 column=address:, timestamp=1557141328204, value=cq
    row1 column=info:name, timestamp=1557141482938, value=tp
    1 row(s) in 0.0220 seconds

  11. After logging hbase database, create a table, column family for the 'address', 'info', you've created, insert data into the table, then insert query this information, and modify the information, after the change, modify and query modification before after the information.
    [the root Master @ ~] # su hbase
    [@ Master HBase the root] $ hbase shell
    HBase Shell;. Enter 'Help' List of Supported Commands for
    the Type "Exit" to Leave The HBase Shell
    Version 1.1.2.2.6.1.0-129, r718c773662346de98a8ce6fd3b5f64e279cb87d4, Wed May 31 03:27:31 UTC 2017

    hbase(main):001:0> create 'xiandian', 'adress','info'
    0 row(s) in 2.5070 seconds

    => Hbase::Table – xiandian
    hbase(main):018:0> put 'xiandian','row1','address','cq'
    0 row(s) in 0.0130 seconds

    hbase(main):019:0> put 'xiandian','row1','info:name','tp'
    0 row(s) in 0.0160 seconds

    hbase(main):020:0> scan 'xiandian'
    ROW COLUMN+CELL
    row1 column=address:, timestamp=1557141328204, value=cq
    row1 column=info:name, timestamp=1557141482938, value=tp
    1 row(s) in 0.0220 seconds
    hbase(main):021:0> put 'xiandian','row1','info:name','tp'
    0 row(s) in 0.0080 seconds

    hbase(main):022:0> scan 'xiandian'
    ROW COLUMN+CELL
    row1 column=address:, timestamp=1557141328204, value=cq
    row1 column=info:name, timestamp=1557141689559, value=tp
    1 row(s) in 0.0180 seconds

  12. After logging hbase database, create a table, column family for the 'address', 'info', you've created, insert data into the table, after the insertion is completed, use the scan command to query the table specifies the information startrow.
    [the root Master @ ~] # su hbase
    [@ Master HBase the root] $ hbase shell
    HBase Shell;. Enter 'Help' List of Supported Commands for
    the Type "Exit" to Leave The HBase Shell
    Version 1.1.2.2.6.1.0-129, r718c773662346de98a8ce6fd3b5f64e279cb87d4, Wed May 31 03:27:31 UTC 2017

    hbase(main):001:0> create 'xiandian', 'adress','info'
    0 row(s) in 2.5070 seconds

    => Hbase::Table – xiandian
    hbase(main):018:0> put 'xiandian','row1','address','cq'
    0 row(s) in 0.0130 seconds

    hbase(main):019:0> put 'xiandian','row1','info:name','tp'
    0 row(s) in 0.0160 seconds
    hbase(main):023:0> scan 'xiandian',{LIMIT=>1}
    ROW COLUMN+CELL
    row1 column=address:, timestamp=1557141328204, value=cq
    row1 column=info:name, timestamp=1557141689559, value=tp
    1 row(s) in 0.0080 seconds

  13. In a relational database system, namespace namespace is a logical grouping table, the table in the same group have similar uses. After logging hbase database, create a namespace called newspace and a list query, and then create a table in this namespace, column family for the 'address', 'info', you've created, to the table insert data, insert it done, scan commands only the lookup table specific information.
    [the root Master @ ~] # su hbase
    [@ Master HBase the root] $ hbase shell
    HBase Shell;. Enter 'Help' List of Supported Commands for
    the Type "Exit" to Leave The HBase Shell
    Version 1.1.2.2.6.1.0-129, r718c773662346de98a8ce6fd3b5f64e279cb87d4, Wed May 31 03:27:31 UTC 2017

    hbase(main):001:0> create_namespace 'newspace'
    0 row(s) in 0.3830 seconds
    hbase(main):002:0> list_namespace
    NAMESPACE
    default
    hbase
    newspace
    3 row(s) in 0.0240 seconds

    hbase(main):012:0> create 'newspace:xiandian','address','info'
    0 row(s) in 2.3070 seconds

    => Hbase::Table - newspace:xiandian
    hbase(main):014:0> put 'newspace:xiandian','row1','address:home','chongqing'
    0 row(s) in 0.1410 seconds

    hbase(main):015:0> put 'newspace:xiandian','row1','info:name','lisi'
    0 row(s) in 0.0120 seconds
    hbase(main):016:0> scan 'newspace:xiandian'
    ROW COLUMN+CELL
    row1 column=address:home, timestamp=1557162220928, value=chongq
    ing
    row1 column=info:name, timestamp=1557162576266, value=lisi
    1 row(s) in 0.2120 seconds

14. The master node login, create a new file on a local file called hbasetest.txt, compiles the content, requires a new table 'test', the column group of 'cf', then this bulk insert data table, the data as shown below :
'ROW1', 'CF2: A', 'VALUE1'
'ROW2', 'CF2: B', 'value2'
'Row3', 'CF2: C', 'value3'
'ROW4', 'CF2: D', 'value4'
after inserting the data lookup table scan is complete command, and then query row1 content only with the get command, and finally quit hbase shell.
HBase (main): 001: 0> create 'test','cf'
0 Row (S) in 2.6240 seconds The

=> Hbase::Table – test
[hbase@master ~]$ cat hbasetest.txt
put ‘test’,‘row1’,‘cf:a’,‘value1’
put ‘test’,‘row2’,‘cf:b’,‘value2’
put ‘test’,‘row3’,‘cf:c’,‘value3’
put ‘test’,‘row4’,‘cf:d’,‘value4’
scan ‘test’
get ‘test’,‘row1’
exit
[hbase@master ~]$ hbase shell hbasetest.txt
0 row(s) in 0.3310 seconds

0 row(s) in 0.0070 seconds

0 row(s) in 0.0460 seconds

0 row(s) in 0.0600 seconds

ROW COLUMN+CELL
row1 column=cf:a, timestamp=1558924005629, value=value1
row2 column=cf:b, timestamp=1558924005661, value=value2
row3 column=cf:c, timestamp=1558924005694, value=value3
row4 column=cf:d, timestamp=1558924005732, value=value4
4 row(s) in 0.0300 seconds

COLUMN CELL
cf:a timestamp=1558924005629, value=value1
1 row(s) in 0.0510 seconds

Guess you like

Origin blog.csdn.net/mn525520/article/details/93776427