HBase 客户端类型 (三)

HBase | HBase从介绍到Java客户端开发 文章目录HBase入门认识HBase介绍HBaseHBase架构RegionServer集群结构HBase逻辑存储结构HBase物理存储结构HBase安装前期准备HBase安装步骤Hbase启动HBase验证备份masterHBase命令HBase 命令介绍HBase Shell命令介绍status命令命名空间namespace相关命令介绍create_namespace命令drop_namesp... 阅读详情

继  HBase 客户端类型 (二)

4. HBase Shell 交互接口

HBase shell 是 HBase 集群的命令行接口。可以使用它连接到本地或远程服务器并与之交互。shell 提供了客户端和系统管理操作。

 


4.1 基础 (Basics)
-----------------------------------------------------------------------------------------------------------------------------------------
体验 shell 的第一步就是启动它:

    $ $HBASE_HOME/bin/hbase shell
    HBase Shell; enter 'help<RETURN>' for list of supported commands.
    Type "exit<RETURN>" to leave the HBase Shell
    Version 1.0.0, r6c98bff7b719efdb16f71606f3b7d8229445eb81, \
    Sat Feb 14 19:49:22 PST 2015
    hbase(main):001:0>

HBase shell 是基于 JRuby 的,JRuby 是基于 Ruby 实现的 Java 虚拟机。更确切地说,它使用的是交互式 Ruby Shell(Interactive Ruby Shell, IRB)
即输入 Ruby 命令并立刻得到响应。HBase 携带的 Ruby 脚本扩展了 IRB,带有基于 Java API 的特殊命令。它继承了内置的命令历史和命令补全的支持,
以及所有的 Ruby 命令。


    NOTE:
    -------------------------------------------------------------------------------------------------------------------------------------
    没有必要在机器上安装 Ruby, 因为 HBase 自带了执行 JRuby shell 必要的 JAR 文件。用户使用所提供的脚本在 Java 上启动 shell。
    
    
shell 启动后,可以输入 help 获得帮助文本:

    hbase(main):001:0> help
    HBase Shell, version 1.0.0,
    r6c98bff7b719efdb16f71606f3b7d8229445eb81, \
    Sat Feb 14 19:49:22 PST 2015
    Type 'help "COMMAND"', (e.g. 'help "get"' -- the quotes are necessary)
    \
    for help on a specific command.
    Commands are grouped. Type 'help "COMMAND_GROUP"', (e.g. 'help
    "general"') \
    for help on a command group.
    COMMAND GROUPS:
    Group name: general
    Commands: status, table_help, version, whoami
    Group name: ddl
    Commands: alter, alter_async, alter_status, create, describe,
    disable, \
    disable_all, drop, drop_all, enable, enable_all, exists,
    get_table, \
    is_disabled, is_enabled, list, show_filters
    ...
    SHELL USAGE:
    Quote all names in HBase Shell such as table and column names.
    Commas
    delimit command parameters. Type <RETURN> after entering a command to run it.
    Dictionaries of configuration used in the creation and alteration of tables
    are Ruby Hashes. They look like this:
    ...

如帮助文本中所描述的,可以请求特定命令的帮助,在调用 help 时将命令添加到后面,或者 help  命令后连接一个组名称,打印出这个组内所有命令的
帮助信息。命令或者组名称(command or group name) 必须使用引号括起来。

离开 shell, 输入 exit 或 quit:

    hbase(main):002:0> exit
    $

shell 也包含特定的命令行选项,添加 -h 或 --help, 切换到命令行时会看到这些命令行选项:

    $ $HBASE_HOME/bin/hbase shell -h
    Usage: shell [OPTIONS] [SCRIPTFILE [ARGUMENTS]]

    --format=OPTION     Formatter for outputting results. Valid options are: console, html. (Default: console)

    -d | --debug Set DEBUG log levels.
    -h | --help This help


    Debugging:
    -------------------------------------------------------------------------------------------------------------------------------------
    将 -d 或 --debug 开关添加到 shell 启动命令启用调试模式(debug mode), 即将日志级别切换到 DEBUG, 并且使 shell 打印出任何 backtrace 信息,
    其类似于 Java 中的 stacktraces 信息。
    
    如果已经在 shell 中,可以使用 debug 命令在调试模式间切换:
    
        hbase(main):001:0> debug
        Debug mode is ON
        hbase(main):002:0> debug
        Debug mode is OFF

    可以使用 debug? 命令检查调试模式:
    
        hbase(main):003:0> debug?
        Debug mode is OFF
    
    非调试模式下,shell 的日志级别为 ERROR, 并且不会在控制台上打印 backtrace 信息。
    
有一个选项用于切换在 shell 中的输出格式,至本文为止,虽然 CLI 帮助说也支持 html, 但只有 console 可用。设置除 console 以外的格式会产生错误
消息。    


shell 启动脚本自动使用 $HBASE_HOME 目录配置相同的目录。用户可以使用其它设置覆盖这个位置,但最重要的是可以连接到不同的集群。新建一个包含
hbase-site.xml 文件的单独的目录,配置 hbase.zookeeper.quorum 属性指向一个不同的集群,然后像下面这样启动 shell:

    $ HBASE_CONF_DIR="/<your-other-config-dir>/" bin/hbase shell

注意,必须指定一个完整的目录,而不仅仅是 hbase-site.xml 文件。

 

4.2 命令 (Commands)
-----------------------------------------------------------------------------------------------------------------------------------------
命令被分组为五个不同的类别,分别代表了它们的语义关系。在输入命令时,必须遵循下列原则:


    ● 引用名称 (Quote Names)
    -------------------------------------------------------------------------------------------------------------------------------------
    命令需要表或列的名称时,要将名称用单引号或双引号括起来。通常建议使用单引号。


    ● 引用值 (Quote Values)
    -------------------------------------------------------------------------------------------------------------------------------------
    shell 支持使用十六进制数或八进制表示二进制的输入和输出。必须使用双引号将它们括起来,否则 shell 会将它们解释为字面文本(literal)。
    
        hbase> get 't1', "key\x00\x6c\x65\x6f\x6e"
        hbase> get 't1', "key\000\154\141\165\162\141"
        hbase> put 't1', "test\xef\xff", 'f1:', "\x01\x33\x70"

    注意上述的混合引用,必须确保使用正确的引用,否则无法获取预期的结果。在单引号中的文本被当做字面文本(literal), 而双引号中的文本是被替换的
    (interpolated), 也就是说,它会转换八进制或十六进制数值为多个字节。
    
    
    ● 使用逗号分隔参数 (Comma Delimiters for Parameters)
    -------------------------------------------------------------------------------------------------------------------------------------
    使用逗号分隔命令参数。例如:
    
        hbase(main):001:0> get 'testtable', 'row-1', 'colfam1:qual1'

    
    ● Ruby 哈希属性 (Ruby Hashes for Properties)
    -------------------------------------------------------------------------------------------------------------------------------------
    对于某些命令,需要输入带有 key/value 对的 map 属性。使用 Ruby 哈希形式:
    
        {'key1' => 'value1', 'key2' => 'value2', ...}
    
    keys/value 对被包含在花括号中,key 和 value 之间使用 "=>" 分隔。通常 key 是预定义的常量,例如 NAME, VERSIONS, or COMPRESSION, 并且不
    需要引号括起来。例如:
    
        hbase(main):001:0> create 'testtable', { NAME => 'colfam1', VERSIONS => 1, TTL => 2592000, BLOCKCACHE => true }
    
    
    限制输出 (Restricting Output)
    -------------------------------------------------------------------------------------------------------------------------------------
    get 命令有一个可选参数可以用于限制被打印值的长度。这对有多个列含有不同长度的值很有用。为了快速获得实际列的整体视图,可以抑制太长的值
    打印完整的数据,否则控制台很快就变得难以控制。
    
    下面的例子中,插入一个很长的值,并在之后的检索时使用 MAXLENGTH 参数限制了长度:

    hbase(main):001:0> put 'testtable','rowlong','colfam1:qual1','abcdefghijklmnopqrstuvwxyzabcdefghi \
    jklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcde \
    ...
    xyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'
    
    hbase(main):018:0> get 'testtable', 'rowlong', MAXLENGTH => 60
    COLUMN CELL
    colfam1:qual1 timestamp=1306424577316, value=abcdefghijklmnopqrstuvwxyzabc

    MAXLENGTH 从行的开始处计算,也就是说,包括列的名称。设置的值为控制台的宽度或略小,这样可以在一行中显示每个列。

    
对于任何的命令,可以通过输入 help '<command>' 获取详细的帮助信息,例如:

    hbase(main):001:0> help 'status'
    Show cluster status. Can be 'summary', 'simple', 'detailed', or 'replication'. The default is 'summary'. Examples:
    hbase> status
    hbase> status 'simple'
    hbase> status 'summary'
    hbase> status 'detailed'
    hbase> status 'replication'
    hbase> status 'replication', 'source'
    hbase> status 'replication', 'sink'    
    
    
大多数命令都有一个直接匹配的客户端 API 或管理 API。后面几节将简要介绍每个命令以及这些 API 的功能。它们按照目的分组,并按分组中的命令排列:


    Command Groups in HBase Shell
    +-------------------+---------------------------------------------------------------------------------------------------
    | Group                | Description
    +-------------------+---------------------------------------------------------------------------------------------------
    | general            | Comprises general commands that do not fit into any other category, for example status.
    +-------------------+---------------------------------------------------------------------------------------------------
    | configuration        | Some configuration properties can be changed at runtime, and reloaded with these commands
    +-------------------+---------------------------------------------------------------------------------------------------
    | ddl                | Contains all commands for data-definition tasks, such as creating a table
    +-------------------+---------------------------------------------------------------------------------------------------
    | namespace            | Similar to the former, but for namespace related operations.
    +-------------------+---------------------------------------------------------------------------------------------------
    | dml                | Has all the data-maipulation commands, which are used to insert or delete data, for example.
    +-------------------+---------------------------------------------------------------------------------------------------
    | snapshots            | Tables can be saved using snapshots, which are created, deleted, restored, etc.
    +-------------------+---------------------------------------------------------------------------------------------------
    | tools                | There are tools supplied with the shell that can help run expert-level, cluster wide operations.    
    +-------------------+---------------------------------------------------------------------------------------------------
    | replication        | All replication related commands are within this group, for example, adding a peer cluster
    +-------------------+---------------------------------------------------------------------------------------------------
    | security            | The contained commands handle security related tasks
    +-------------------+---------------------------------------------------------------------------------------------------
    | visibility labels    | These commands handle cell label related functionality, such as adding or listing labels
    +-------------------+---------------------------------------------------------------------------------------------------

可以使用任何组名称来获得帮助信息,使用 help '<groupname>' 语法,与命令的帮助语法相同。例如输入 help ddl 会打印出数据定义命令的完整帮助文本

 

■ 通用命令 (General Commands)
-----------------------------------------------------------------------------------------------------------------------------------------
general 命令列于下表:

    General Shell Commands
    +---------------+---------------------------------------------------------------------------------------------------------------
    | Command        | Description
    +---------------+---------------------------------------------------------------------------------------------------------------
    | status        | Returns various levels of information contained in the ClusterStatus class. See the help to get the simple,    
    |                | summary, and detailed status information
    +---------------+---------------------------------------------------------------------------------------------------------------
    | version        | Returns the current version, repository revision, and compilation date of your HBase cluster.  
    |                | See ClusterStatus.getHBaseVersion()
    +---------------+---------------------------------------------------------------------------------------------------------------
    | table_help    | Prints a help text explaining the usage of table references in the Ruby shell
    +---------------+---------------------------------------------------------------------------------------------------------------
    | whoami        | Shows the current OS user and group membership known to HBase about the shell user
    +---------------+---------------------------------------------------------------------------------------------------------------

没有任何限定符运行 status 与执行 status 'summary' 相同,都打印出活动的和死掉的服务器数量,以及平均负载。平均负载是每台服务器持有的平均
region 的数量。status 'simple' 打印出有关活动服务器和死掉的服务器的详细信息,它们的服务器名,对于活动服务器还有高级的统计信息,类似于
web UI 中包含的请求数量,堆内存信息,磁盘以及 memstore 信息等等。最后,对于 detailed 版本的 status 命令,除了以上信息,还会打印出每个
region 当前所在的服务器信息。

另一组通用命令是与运行时更新服务器配置相关的:

    Configuration Commands
    +-------------------+-----------------------------------------------------------------------------------------------------------
    | Commands            | Description
    +-------------------+-----------------------------------------------------------------------------------------------------------
    | update_config        | Update the configuration for a particular server. The name must be given as a valid server name
    +-------------------+-----------------------------------------------------------------------------------------------------------
    | update_all_config    | Updates all region servers
    +-------------------+-----------------------------------------------------------------------------------------------------------

可以先用 status 命令获取服务器列表,然后使用返回的服务器名称调用更新配置命令。注意,需要对返回的服务器名称格式做些调整:服务
器名称组件由逗号分隔,而不是冒号或空格,如下示例:

    hbase(main):001:0> status 'simple'
    1 live servers
    127.0.0.1:62801 1431177060772
    ...
    Aggregate load: 0, regions: 4

    hbase(main):002:0> update_config '127.0.0.1,62801,1431177060772'
    0 row(s) in 0.1290 seconds

    hbase(main):003:0> update_all_config
    0 row(s) in 0.0560 seconds

 

■ 名称空间和数据定义命令 (Namespace and Data Definition Commands)
-----------------------------------------------------------------------------------------------------------------------------------------
namespace 组的命令提供 shell 的功能,用于处理创建,修改,以及删除名称空间。


    Namespace Shell Commands:
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | Commands                | Description
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | create_namespace        | Creates a namespace with the provided name.
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | drop_namespace        | Removes the namespace, which must be empty, that is, it must not contain any tables.
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | alter_namespace        | Changes the namespace details by altering its configuration properties
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | describe_namespace    | Prints the details of an existing namespace
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | list_namespace        | Lists all known namespaces
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | list_namespace_tables    | Lists all tables contained in the given namespace
    +-----------------------+-------------------------------------------------------------------------------------------------------


数据定义(data definition) 命令列于下表,大多数来源于管理 API (administrative API):

    Data Definition Shell Commands
    +---------------+---------------------------------------------------------------------------------------------------------------
    | Commands        | Description
    +---------------+---------------------------------------------------------------------------------------------------------------
    | alter            | Modifies an existing table schema using modifyTable().
    +---------------+---------------------------------------------------------------------------------------------------------------
    | alter_async    | Same as above, but returns immediately without waiting for the changes to take effect
    +---------------+---------------------------------------------------------------------------------------------------------------
    | alter_status    | Can be used to query how many regions have the changes applied to them. Use this after making asynchronous
    |                | alterations.
    +---------------+---------------------------------------------------------------------------------------------------------------
    | create        | Creates a new table. See the createTable() call
    +---------------+---------------------------------------------------------------------------------------------------------------
    | describe        | Prints the HTableDescriptor. A shortcut for this command is desc
    +---------------+---------------------------------------------------------------------------------------------------------------
    | disable        | Disables a table. See the disableTable() method.
    +---------------+---------------------------------------------------------------------------------------------------------------
    | disable_all    | Uses a regular expression to disable all matching tables in a single command
    +---------------+---------------------------------------------------------------------------------------------------------------
    | drop            | Drops a table. See the deleteTable() method
    +---------------+---------------------------------------------------------------------------------------------------------------
    | drop_all        | Drops all matching tables. The parameter is a regular expression
    +---------------+---------------------------------------------------------------------------------------------------------------
    | enable        | Enables a table. See the enableTable() call
    +---------------+---------------------------------------------------------------------------------------------------------------
    | enable_all    | Using a regular expression to enable all matching tables
    +---------------+---------------------------------------------------------------------------------------------------------------
    | exists        | Checks if a table exists. It uses the tableExists() call
    +---------------+---------------------------------------------------------------------------------------------------------------
    | is_disabled    | Checks if a table is disabled. See the isTableDisabled() method
    +---------------+---------------------------------------------------------------------------------------------------------------
    | is_enabled    | Checks if a table is enabled. See the isTableEnabled() method
    +---------------+---------------------------------------------------------------------------------------------------------------
    | list            | Returns a list of all user tables. Uses the listTables() method
    +---------------+---------------------------------------------------------------------------------------------------------------
    | show_filters    | Lists all known filter classes.
    +---------------+---------------------------------------------------------------------------------------------------------------
    | get_table        | Returns a table reference that can used in scripting
    +---------------+---------------------------------------------------------------------------------------------------------------

以 _all 结尾的命令接受正则表达式经命令应用到所有匹配的表。例如,假设系统中有一个名为 test 的表:

    hbase(main):001:0> drop_all '.*'
    test

    Drop the above 1 tables (y/n)?
    y
    1 tables successfully dropped

    hbase(main):002:0> drop_all '.*'
    No tables matched the regex .*

 

■ 数据操纵命令 (Data Manipulation Commands)
-----------------------------------------------------------------------------------------------------------------------------------------
数据操纵(data manipulation)命令列于下表,它们大多数由客户端 API 提供:

    Data Manipulation Shell Commands
    +-------------------+-----------------------------------------------------------------------------------------------------------
    | Commands            | Description
    +-------------------+-----------------------------------------------------------------------------------------------------------
    | put                | Stores a cell. Uses the Put class
    +-------------------+-----------------------------------------------------------------------------------------------------------
    | get                | Retrieves a cell. See the Get class
    +-------------------+-----------------------------------------------------------------------------------------------------------
    | delete            | Deletes a cell
    +-------------------+-----------------------------------------------------------------------------------------------------------
    | deleteall            | Similar to delete but does not require a column. Deletes an entire family or row
    +-------------------+-----------------------------------------------------------------------------------------------------------
    | append            | Allows to append data to cells
    +-------------------+-----------------------------------------------------------------------------------------------------------
    | incr                | Increments a counter. Uses the Increment class
    +-------------------+-----------------------------------------------------------------------------------------------------------
    | get_counter        | Retrieves a counter value. Same as the get command but converts the raw counter value into a readable number
    +-------------------+-----------------------------------------------------------------------------------------------------------
    | scan                | Scans a range of rows. Relies on the Scan class
    +-------------------+-----------------------------------------------------------------------------------------------------------
    | count                | Counts the rows in a table. Uses a Scan internally
    +-------------------+-----------------------------------------------------------------------------------------------------------
    | truncate            | Truncates a table, which is the same as executing the disable and drop commands, followed by a create,
    |                    | using the same schema
    +-------------------+-----------------------------------------------------------------------------------------------------------
    | truncate_preserve    | Same as the previous command, but retains the regions with their start and end keys.
    +-------------------+-----------------------------------------------------------------------------------------------------------


多个命令有扩展的可选参数,在 shell 中查看帮助获取详细信息。


    格式化二进制数据 (Formatting Binary Data)
    -------------------------------------------------------------------------------------------------------------------------------------
    在 get 操作期间打印 cell 值时,shell 隐式使用 Bytes.toStringBinary() 转换二进制数据。可以在基于列的设置上改变这种行为,通过设定不同的
    格式化方法。该方法必须接受一个 byte[] 数组并返回一个可打印的值的表现形式。它作为列名的一部分定义,作为 get 调用的可选参数输入:
    
        <column family>[:<column qualifier>[:format method]]
    
    对于 get 调用,可以忽略任何的列信息,但如果添加了信息,它们可以作为列族,或者列族和列限定符。第三个可选部分就是格式化方法,指向一个
    Bytes 类的方法,或者一个自定义类的方法。因为其隐式地指明了列族和列限定符,因此意味着只能对一个特定的列指定一个格式化方法,而不能对整个
    列族,甚至整个行设定。
    
    下表列出了两个选项及其示例:
    
    Possible Format Methods
    +---------------+-------------------------------+--------------------------------------------------------------------------------
    | Method        | Examples                        | Description
    +---------------+-------------------------------+--------------------------------------------------------------------------------
    | Bytes Method    | toInt, toLong                    | Refers to a known method from the Bytes class.
    +---------------+-------------------------------+--------------------------------------------------------------------------------
    | CustomMethod    | c(CustomFormatClass).format    | Specifies a custom class and method converting byte[] to text.
    +---------------+-------------------------------+--------------------------------------------------------------------------------

    Bytes Method 是对显式的 Bytes 类简单的快捷方式,例如,colfam:qual:c(org.apache.hadoop.hbase.util.Bytes).toInt 与 colfam:qual:toInt
    相同。下面的示例使用了不同的命令展示讨论的内容:
    
    hbase(main):001:0> create 'testtable', 'colfam1'
    0 row(s) in 0.2020 seconds
    => Hbase::Table - testtable

    hbase(main):002:0> incr 'testtable', 'row-1', 'colfam1:cnt1'
    0 row(s) in 0.0580 seconds

    hbase(main):003:0> get_counter 'testtable', 'row-1', 'col
    fam1:cnt1', 1
    COUNTER VALUE = 1

    hbase(main):004:0> get 'testtable', 'row-1', 'colfam1:cnt1'
    COLUMN CELL
    colfam1:cnt1 timestamp=..., value=\x00\x00\x00\x00\x00\x00\x00\x01
    1 row(s) in 0.0150 seconds

    hbase(main):005:0> get 'testtable', 'row-1', { COLUMN => 'colfam1:cnt1' }
    COLUMN CELL
    colfam1:cnt1 timestamp=..., value=\x00\x00\x00\x00\x00\x00\x00\x01
    1 row(s) in 0.0160 seconds

    hbase(main):006:0> get 'testtable', 'row-1', { COLUMN => ['colfam1:cnt1:toLong'] }
    COLUMN CELL
    colfam1:cnt1 timestamp=..., value=1
    1 row(s) in 0.0050 seconds

    hbase(main):007:0> get 'testtable', 'row-1', 'colfam1:cnt1:toLong'
    COLUMN CELL
    colfam1:cnt1 timestamp=..., value=1
    1 row(s) in 0.0060 seconds

    
    
■ 快照命令 (Snapshot Commands)
-----------------------------------------------------------------------------------------------------------------------------------------
这些命令反应了管理 API 功能。可以给一个表创建快照,用于之后的恢复或克隆,以及列出所有可用的快照等等。

    Snapshot Shell Commands
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | Command                | Description
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | snapshot                | Creates a snapshot. Use the SKIP_FLUSH => true option to not flush the table before the snapshot.
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | clone_snapshot        | Clones an existing snapshot into a new table
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | restore_snapshot        | Restores a snapshot under the same table name as it was created
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | delete_snapshot        | Deletes a specific snapshot. The given name must match the name of a previously created snapshot
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | delete_all_snapshot    | Deletes all snapshots using a regular expression to match any number of names
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | list_snapshots        | Lists all snapshots that have been created so far
    +-----------------------+-------------------------------------------------------------------------------------------------------

创建一个快照可以指定模式,类似于 API 调用指定的模式,即可以强制刷写表的内存中的数据(默认行为),或者只创建以及在磁盘上的文件的快照。

    hbase(main):001:0> create 'testtable', 'colfam1'
    0 row(s) in 0.4950 seconds
    => Hbase::Table - testtable
    hbase(main):002:0> for i in 'a'..'z' do \
    for j in 'a'..'z' do put 'testtable', "row-#{i}#{j}", "col
    fam1:#{j}", \
    "#{j}" end end
    0 row(s) in 0.0830 seconds
    0 row(s) in 0.0070 seconds
    ...

    hbase(main):003:0> count 'testtable'
    676 row(s) in 0.1620 seconds

    => 676

    hbase(main):004:0> snapshot 'testtable', 'snapshot1', { SKIP_FLUSH => true }
    0 row(s) in 0.4300 seconds
    hbase(main):005:0> snapshot 'testtable', 'snapshot2'
    0 row(s) in 0.3180 seconds

    hbase(main):006:0> list_snapshots
    SNAPSHOT TABLE + CREATION TIME
    snapshot1 testtable (Sun May 10 20:05:11 +0200 2015)
    snapshot2 testtable (Sun May 10 20:05:18 +0200 2015)
    2 row(s) in 0.0560 seconds

    => ["snapshot1", "snapshot2"]
    hbase(main):007:0> disable 'testtable'
    0 row(s) in 1.2010 seconds

    hbase(main):008:0> restore_snapshot 'snapshot1'
    0 row(s) in 0.3430 seconds

    hbase(main):009:0> enable 'testtable'
    0 row(s) in 0.1920 seconds

    hbase(main):010:0> count 'testtable'
    0 row(s) in 0.0130 seconds
    => 0
    
    hbase(main):011:0> disable 'testtable'
    0 row(s) in 1.1920 seconds

    hbase(main):012:0> restore_snapshot 'snapshot2'
    0 row(s) in 0.4710 seconds

    hbase(main):013:0> enable 'testtable'
    0 row(s) in 0.3850 seconds

    hbase(main):014:0> count 'testtable'
    676 row(s) in 0.1670 seconds
    => 676

 

■ 工具命令 (Tool Commands)
-----------------------------------------------------------------------------------------------------------------------------------------
tools 命令列于下表,这些命令都由管理 API 提供。这些命令很多是低级别的,也就是说,可能具有破坏性动作,因此确保仔细阅读每个命令的 shell 帮助
以理解它们的影响。

    Tools Shell Commands
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | Command                | Description
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | assign                | Assigns a region to a server
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | balance_switch        | Toggles the balancer switch
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | balancer                | Starts the balancer
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | close_region            | Closes a region. Uses the closeRegion() method
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | compact                | Starts the asynchronous compaction of a region or table. Uses compact()
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | compact_rs            | Compact all regions of a given region server. The optional boolean flag decided between major and minor
    |                        | compactions
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | flush                    | Starts the asynchronous flush of a region or table. Uses flush()
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | major_compact            | Starts the asynchronous major compaction of a region or table. Uses majorCompact()
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | move                    | Moves a region to a different server. See the move() call
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | split                    | Splits a region or table. See the split() call
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | merge_region            | Merges two regions, specified as hashed names. The optional boolean flag allows merging of
    |                        | non-subsequent regions
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | unassign                | Unassigns a region. See the unassign() call
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | wal_roll                | Rolls the WAL, which means close the current and open a new one
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | catalogjanitor_run    | Runs the system catalog janitor process, which operates in the background and cleans out obsolete files
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | catalogjanitor_switch    | Toggles the system catalog janitor process, either enabling or disabling it
    +-----------------------+-------------------------------------------------------------------------------------------------------
    |catalogjanitor_enabled    | Returns the status of the catalog janitor background process
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | zk_dump                | Dumps the ZooKeeper details pertaining to HBase. This is a special function offered by an internal class.
    |                        | The web-based UI of the HBase Master exposes the same information
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | trace                    | Starts or stops a trace, using the HTrace framework
    +-----------------------+-------------------------------------------------------------------------------------------------------

 

■ 复制命令 (Replication Commands)
-----------------------------------------------------------------------------------------------------------------------------------------

    Replication Shell Commands
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | Command                | Description
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | add_peer                | Adds a replication peer
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | remove_peer            | Removes a replication peer
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | enable_peer            | Enables a replication peer
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | disable_peer            | Disables a replication peer
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | list_peers            | List all previously added peers
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | list_replicated_tables| Lists all tables and column families that have replication enabled on the current cluster
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | set_peer_tableCFs        | Sets specific column families that should be replicated to the given peer
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | append_peer_tableCFs    | Adds the given column families to the specified peer’s list of replicated column families
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | remove_peer_tableCFs    | Removes the given list of column families from the list of replicated families for the given peer
    +-----------------------+-------------------------------------------------------------------------------------------------------
    | show_peer_tableCFs    | Lists the currently replicated column families for the given peer
    +-----------------------+-------------------------------------------------------------------------------------------------------

大多数的命令需要一个 peer ID, 应用各自的功能到指定的 peer 配置。可以添加一个 peer, 之后移除它,对已存在的 peer 启用或禁用复制,列出所有已知的
peer 或复制的表。

 

■ 安全命令 (Security Commands)
-----------------------------------------------------------------------------------------------------------------------------------------
这组命令可以划分为两个部分,一部分是访问控制列表(access control list),另一部分是 visibility label 相关的命令。对于访问控制列表组可以授权
(grant), 吊销(revoke), 以及列出用户许可权限。注意,这些命令只有在 AccessController 协处理器启用时可用。

    Security Shell Commands
    +-------------------+-----------------------------------------------------------------------------------------------------------
    | Command            | Description
    +-------------------+-----------------------------------------------------------------------------------------------------------
    | grant                | Grant the named access rights to the given user
    +-------------------+-----------------------------------------------------------------------------------------------------------
    | revoke            | Revoke the previously granted rights of a given user
    +-------------------+-----------------------------------------------------------------------------------------------------------
    | user_permission    | Lists the current permissions of a user. The optional regular expression filters the list
    +-------------------+-----------------------------------------------------------------------------------------------------------


第二组安全相关的命令处理 cell 级别可视性标签(visibility labels), 再次提醒需要一些额外的配置才能使其工作,这里是在服务器进程中
启用额外的 VisibilityController 协处理器。

    Visibility Label Shell Commands
    +---------------+---------------------------------------------------------------------------------------------------------------
    | Command        | Description
    +---------------+---------------------------------------------------------------------------------------------------------------
    | add_labels    | Adds a list of visibility labels to the system
    +---------------+---------------------------------------------------------------------------------------------------------------
    | list_labels    | Lists all previously defined labels. An optional regular expression can be used to filter the list
    +---------------+---------------------------------------------------------------------------------------------------------------
    | set_auths        | Assigns the given list of labels to the provided user ID.
    +---------------+---------------------------------------------------------------------------------------------------------------
    | get_auths        | Returns the list of assigned labels for the given user
    +---------------+---------------------------------------------------------------------------------------------------------------
    | clear_auths    | Removes all or only the specified list of labels from the named user.
    +---------------+---------------------------------------------------------------------------------------------------------------
    |set_visibility    | Adds a visibility expression to one or more cell    
    +---------------+---------------------------------------------------------------------------------------------------------------

 

4.3 脚本应用 (Scripting)
-----------------------------------------------------------------------------------------------------------------------------------------
在 shell 中,可以交互式执行命令,立刻得到反馈信息。有时候,只想发送一个命令,或许是一个脚本由调度维护系统(如 cron 或 at)调用。用户还可以
通过管道(piping) 的形式运行命令:

    $ echo "status" | bin/hbase shell
    HBase Shell; enter 'help<RETURN>' for list of supported commands.
    Type "exit<RETURN>" to leave the HBase Shell
    Version 1.0.0, r6c98bff7b719efdb16f71606f3b7d8229445eb81, \
    Sat Feb 14 19:49:22 PST 2015
    status
    1 servers, 2 dead, 3.0000 average load

一旦命令运行完成,shell 会关闭并将控制返回给调用者。最后,可以输入整个脚本,由 shell 启动时执行:

    $ cat ~/hbase-shell-status.rb
    status
    $ bin/hbase shell ~/hbase-shell-status.rb
    1 servers, 2 dead, 3.0000 average load
    HBase Shell; enter 'help<RETURN>' for list of supported commands.
    Type "exit<RETURN>" to leave the HBase Shell
    Version 1.0.0, r6c98bff7b719efdb16f71606f3b7d8229445eb81, Sat Feb
    14 19:49:22 PST 2015

    hbase(main):001:0> exit

一旦脚本执行完成,可以继续在 shell 中工作,或者正常退出。也有选项可以使用原生 JRuby 解释器执行脚本,直接将它作为一个 Java 应用程序执行。
hbase 脚本设置的类路径(class path) 能够使用任何必要的 Java 类。下面示例简单地从远程集群检索 table 列表:

    $ cat ~/hbase-shell-status-2.rb
    include Java
    import org.apache.hadoop.hbase.HBaseConfiguration
    import org.apache.hadoop.hbase.client.HBaseAdmin
    import org.apache.hadoop.hbase.client.ConnectionFactory
    conf = HBaseConfiguration.create
    connection = ConnectionFactory.createConnection(conf)
    admin = connection.getAdmin
    tables = admin.listTables
    tables.each { |table| puts table.getNameAsString() }

    $ bin/hbase org.jruby.Main ~/hbase-shell-status-2.rb
    testtable

由于 HBase shell 基于 JRuby’s IRB, 因此可以使用 IRB 内置特性,如,命令补全和命令历史(command completion and history)。启用或配置这些特性
要在用户的 home 目录中创建一个 .irbrc 文件,该文件会在 shell 启动时读取:

    $ cat ~/.irbrc
    require 'irb/ext/save-history'
    IRB.conf[:SAVE_HISTORY] = 100
    IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
    Kernel.at_exit do
        IRB.conf[:AT_EXIT].each do |i|
            i.call
        end
    end

启用命令历史能保存执行过的 shell 命令。命令补全功能已由 HBase 脚本启用了。

交互式解释器具有执行 HBase 类和功能函数的优点,例如,某些应用要求写一个 Java 应用程序。下面的示例将从 Bytes.toBytes() 调用输出的二进制输出
转换为整型值:

    hbase(main):001:0>
    org.apache.hadoop.hbase.util.Bytes.toInt( "\x00\x01\x06[".to_java_bytes)
    => 67163

注意 shell 如何将前三个不可见的字符编码为十六进制值,而第四个字符"[" 则作为一个字符打印。

另一个例子是将一个日期转换为 Linux 纪元数,再转换回人类可读的日期:

    hbase(main):002:0> java.text.SimpleDateFormat.new("yyyy/MM/dd HH:mm:ss").parse("2015/05/12 20:56:29").getTime
    => 1431456989000
        
    hbase(main):002:0> java.util.Date.new(1431456989000).toString
    => "Tue May 12 20:56:29 CEST 2015"

也可以在一个循环中添加很多的 cell, 例如,使用测试数据填充表:

    hbase(main):003:0> for i in 'a'..'z' do for j in 'a'..'z' do \
    put 'testtable', "row-#{i}#{j}", "colfam1:#{j}", "#{j}" end end

一个更复杂的循环填充计数器可能类似如下:

    hbase(main):004:0> require 'date';
    import java.lang.Long
    import org.apache.hadoop.hbase.util.Bytes
    (Date.new(2011, 01, 01)..Date.today).each { |x| put "testtable", "daily", \
    "colfam1:" + x.strftime("%Y%m%d"), Bytes.toBytes(Long.new(rand * 4000).longValue).to_a.pack("CCCCCCCC") }

shell 的 JRuby 代码封装了很多 Java 类,例如 Table, Admin 为其自己的版本,更便于访问它们自己的功能,在执行复杂的脚本任务时,可以使用这些类
执行 table_help 命令,可以访问内建的帮助文本,说明如何使用 shell 封装的类,以及特别是 table 参考。这时可能会比较好奇,为什么 shell 执行某些
特定命令,如 create 时,它的响应有时会带有哈希箭头(hash rocket, or fat comma, 即 =>):

    hbase(main):005:0> create 'testtable', 'colfam1'
    0 row(s) in 0.1740 seconds
    
    => Hbase::Table - testtable

create 命令实际上返回一个引用,指向一个 Hbase::Table 实例,也就是指向新创建的 testtable. 可以利用这个引用在一个变量中对其排序,并且可以
使用 shell 的双 tab (double tab) 特性获取它提供的所有功能(functions it exposes):

        NOTE:
        ---------------------------------------------------------------------------------------------------------------------------------
        进行下面的步骤时要删除之前创建的测试表,使用 disable 'testtable' , 然后在执行 drop 'testtable'
    
    hbase(main):006:0> tbl = create 'testtable', 'colfam1'
    0 row(s) in 0.1520 seconds
    => Hbase::Table - testtable
    hbase(main):006:0> tbl. TAB TAB
    ...
    tbl.append         tbl.close
    tbl.delete
    tbl.deleteall     tbl.describe
    tbl.disable
    ...
    tbl.help         tbl.incr
    tbl.name
    tbl.put         tbl.snapshot
    tbl.table
    ...    

可以看到 table Ruby 类(这里是变量名 tbl)显露出的具有相同名称的所有 shell 命令。例如 put 命令实际上是 table.put 方法的快捷方式。table.help
打印出与 table_help 相同的内容,table.table 是 Java Table 实例的引用。如果没有其它选择可用,可以使用后者访问原生 API.

获取同一 Ruby table 引用的另一个方法时利用 get_table 命令,如果表已经存在这个方法很有用。

    hbase(main):006:0> tbl = get_table 'testtable'
    0 row(s) in 0.0120 seconds

    => Hbase::Table - testtable

一旦拥有了引用,就可以使用匹配的方法调用任何命令,不需要再输入表的名称:

    hbase(main):007:0> tbl.put 'row-1', 'colfam1:qual1', 'val1'
    0 row(s) in 0.0050 seconds

使用给定的值插入到测试表的命名的行和列。以同样的方法可以访问数据:

    hbase(main):008:0> tbl.get 'row-1'
    COLUMN CELL
    colfam1:qual1 timestamp=1431506646925, value=val1
    1 row(s) in 0.0390 seconds

也可以使用 tbl.scan 等方法读取数据。所有与表相关的命令,都将表名作为第一个参数,也应使用表引用语法。输入 tbl.help '<command>' 命令以查看
shell 内置的命令帮助,通常也包含引用语法的示例。

一般的管理操作也是直接作用到一个表上,例如,enable, disable, 以及 drop 等,通过输入 tbl.enable, tbl.flush 等执行操作。注意,删除(drop)
一个表之后,它的引用就变得没用了,再使用它是未定义的,不建议这样使用。

最后,另一个例子是围绕自定义序列化和格式化的。假设已存储 Java 对象到一个表中,并且打算重建实例,打印出所存储对象的文本表示。之前已经看到,
可以在通过 get 命令获取列时提供一个自定义的格式化方法。另外,HBase 携带的 Apache Commons Lang artifacts 使用其包含的 SerializationUtils 类
该类有静态的 serialize() 和 deserialize() method, 可以处理任何实现了 Serializable 接口的 Java 对象。下面的示例深入 shell 环境中,必须创建
自己的 Put 实例。这是必要的,因为 shell 提供的 put 命令假设其值为一个字符串。让我们的例子工作,需要访问原生 Put 类方法:

    hbase(main):004:0> import org.apache.commons.lang.SerializationUtils
    => Java::OrgApacheCommonsLang::SerializationUtils

    hbase(main):002:0> create 'testtable', 'colfam1'
    0 row(s) in 0.1480 seconds

    hbase(main):003:0> p = org.apache.hadoop.hbase.client.Put.new("row-1000".to_java_bytes)
    => #<Java::OrgApacheHadoopHbaseClient::Put:0x6d6bc0eb>

    hbase(main):004:0> p.addColumn("colfam1".to_java_bytes,
    "qual1".to_java_bytes, SerializationUtils.serialize(java.util.ArrayList.new([1,2,3])))
    => #<Java::OrgApacheHadoopHbaseClient::Put:0x6d6bc0eb>

    hbase(main):005:0> t.table.put(p)

    hbase(main):006:0> scan 'testtable'
    ROW COLUMN+CELL
    row-1000 column=colfam1:qual1, timestamp=1431353253936, \
    value=\xAC\xED\x00\x05sr\x00\x13java.util.ArrayListx\x81\xD2\x1D
    \x99...
    \x03sr\x00\x0Ejava.lang.Long;\x8B\xE4\x90\xCC\x8F#\xDF
    \x02\x00\x01J...
    \x10java.lang.Number\x86\xAC\x95\x1D\x0B\x94\xE0\x8B
    \x02\x00\x00xp...
    1 row(s) in 0.0340 seconds

    hbase(main):007:0> get 'testtable', 'row-1000', 'colfam1:qual1:c(SerializationUtils).deserialize'
    COLUMN CELL
    colfam1:qual1 timestamp=1431353253936, value=[1, 2, 3]
    1 row(s) in 0.0360 seconds

    hbase(main):008:0> p.addColumn("colfam1".to_java_bytes, "qual1".to_java_bytes, SerializationUtils.serialize( \
    java.util.ArrayList.new(["one", "two", "three"])))
    => #<Java::OrgApacheHadoopHbaseClient::Put:0x6d6bc0eb>
    hbase(main):009:0> t.table.put(p)
    hbase(main):010:0> scan 'testtable'
    ROW COLUMN+CELL
    row-1000 column=colfam1:qual1, timestamp=1431353620544, \
    value=\xAC\xED\x00\x05sr\x00\x13java.util.ArrayListx\x81\xD2\x1D\x99 \
    \xC7a\x9D\x03\x00\x01I\x00\x04sizexp\x00\x00\x00\x03w
    \x04\x00\x00\x00 \
    \x03t\x00\x03onet\x00\x03twot\x00\x05threex
    1 row(s) in 0.4470 seconds
    
    hbase(main):011:0> get 'testtable', 'row-1000', 'colfam1:qual1:c(SerializationUtils).deserialize'
    COLUMN CELL
    colfam1:qual1 timestamp=1431353620544, value=[one, two, three]
    1 row(s) in 0.0190 seconds

首先导入 org.apache.commons.lang.SerializationUtils 类(已在 HBase shell 类路径中), 然后创建了一个测试表,跟一个自定义 Put 实例。设置了 put
实例两次,一次序列化数字数组,一次序列化字符串数组。之后调用封装的 Table 实例的 put 方法,并扫描内容验证序列化内容。

每一次序列化之后,调用了 get 命令,通过自定义的格式化方法指向 deserialize() method. 它解析原始字节反序列化为一个 Java 对象,然后打印出来。
由于 shell 应用 toString() 调用,因此可以看到打印出的数组的原始内容,如 [one, two, three]. 这确认了直接在 shell 中重建了序列化的 Java 对象。

 

参考:

HBase 客户端类型 (一)

HBase 客户端类型 (二)

HBase 客户端类型 (三)

HBase 客户端类型 (四)

 

参考:

    《HBase - The Definitive Guide - 2nd Edition》Early release —— 2015.7 Lars George

HBase安装和Shell客户端操作指南 HBase是一个分布式、可扩展的面向列的NoSQL数据库,它运行在Apache Hadoop之上。本文将详细介绍如何安装HBase以及使用HBase的Shell客户端进行数据库操作。 阅读详情

相关推荐

大数据HBase(四):HBase的相关操作-客户端命令式

HBase的相关操作客户端命令式 我们可以以shell的方式来维护和管理HBase。例如:执行建表语句、执行增删改查操作等等 1、进入HBase客户端命令操作界面 $ bin/hbase shell 2、查看帮助命令 hbase(main):001:0> help ......

Lansonli(蓝深李)的博客 2910

连接Hbase客户端工具,可视化界面

连接Hbase客户端工具,可视化界面,下面从使用和修改源码改进Hbase客户端工具的方法。 一、下载和使用 下载 下载地址:http://www.zrscsoft.com/sitepic/12046.html 连接Hbase客户端工具,可视化界面,包含三大部分: 1).可以直接使用的,用于连接HBase的客户端,是个可视化工具 ...

一火的专栏 4万+

HBaseClient:HBase客户端数据管理软件

HBaseClient HBase客户端数据管理软件 概要说明 类似PL/SQL,是一个HBase数据库的客户端数据管理软件。是免费开源的软件。 基于XJava,使用xml配置文件绘制可视化界面。 可视化界面操作 表 表的定义、编辑、删除; 数据 数据的添加、编辑、删除; 数据的全部清空、多条删除、多条复制; 查询 主键的精确; 关键字的模糊查询 关键字的模糊查询过滤显示; 数据查询结果的分页显示操作,并且对查询关键字高亮显示; 导出 表结构的导出; 表结构及数据的导出; 导入 文件批量put命令导入(支持中文) 批量put命令执行(支持中文) 非可视化界面的命令操作 HBase命令的执行 导入 文件批量put命令导入(支持中文) 批量put命令执行(支持中文) 下载 date version size support 2018-05-24 65.9M 支持HBase 1.x 2018-0

Hbase-之Client与服务端交互步骤流程解析

Hbase之Client与服务端交互 官网参考地址,请注意~~~~~~~ 1、 Client访问交互 Hbase的Client怎么与Server端进行交互的呢?具体步骤可以分为以下几步 首先Client通过访问hbase:meta元数据表找到指定范围row所处的regions,以及对应的RegionServers; 在确定region之后,Client不会与Master进行交互,而是直接与RegionServer交互,让其开启对指定region的服务; 然后RegionServer开始处理对应的read

shufangreal的博客 1448

ISP之LSC(Lens Shading Correction)

LSC - Lens Shading Correction即镜头暗影校正。

IQ_WXY的博客 5098

阿里云CDN HTTPS 证书配置流程

可以使用HTTPS方式访问资源,如果浏览器中URL旁边出现锁的HTTPS标识,表示HTTPS安全加速已生效。: 证书配置完成后,需要留意证书过期时间并在证书过期前手动配置新的证书。注意 ⚠️ 一定是需要复制 以下标识之间的内容。如果已在阿里云数字证书管理服务中购买了证书,请选择。,该证书将在阿里云数字证书管理服务中保存。如果使用第三方服务商签发的证书,请选择。第四步,在指定域名的左侧导航栏,单击。第二步,在左侧导航栏,单击。开关,并配置证书相关参数。页面,找到目标域名,单击。中选择已购买的证书。

w风雨无阻w的专栏 2210

分布式数据库HBase

HBase

小马哥的博客 1818

【rt-thread实战解析】从零到一:基于STM32与LAN8720A的以太网驱动配置全流程

本文详细解析了在RT-Thread操作系统上为STM32F407配置LAN8720A以太网驱动的全流程。从硬件连接自查、CubeMX工程创建、PHY复位函数编写,到RT-Thread工程配置、LwIP协议栈集成,最后进行实际上电测试与网络调试,手把手指导开发者避开常见陷阱,实现稳定的以太网连接。

m2n3b4v5c6的博客 526

Hbase学习(三)-- Hbase客户端

对于使用Hbase,通常情况下是Hbase客户端到Hbase服务端再到HDFS客户端这么一个路径,所以使用Hbase时需要对Hbase客户端有较好的理解。实际上,由于Hbase的复杂性以及Region的定位设计在客户端上(hbase:meta元数据表缓存在客户端上用于定位region),导致Hbase客户端并不足够轻量级。 Hbase客户端实现: Hbase提供了多种语言的客户端,由于Hbase是通过Java语言实现的,所以非Java语言需要先访问ThriftServer,然后通过Jav...

qq_38787854的博客 7737

电子纸价签实战:基于SSD1680的墨水屏驱动开发与优化

本文详细介绍了基于SSD1680驱动芯片的电子纸价签开发实战,涵盖硬件连接、驱动框架搭建、核心流程解析及性能优化。重点剖析了初始化配置、波形文件加载、图像数据写入与刷新触发等关键步骤,并提供了功耗优化、显示效果提升及代码健壮性等实用避坑指南,帮助开发者高效实现稳定低功耗的墨水屏驱动。

weixin_28278377的博客 231

ORACLE 12C RAC 启动报错,错误代码 ORA-27300,ORA-27301,ORA-27302

非一体机,12.2 无任何补丁,2套X86服务器,1节点集群异常(数据库正常,还有会话),2节点正常工作,负载不高,硬件、空间均未检查到异常,多路径存在掉线的情况,但通过Mulitpath -ll 看又是正常的,2根私有网络,其中一根不同,sysctl中配置的稀疏模式。5、再次加成crs alert ohas等集群日志,以及根据现象和错误再次到后台sr中查找可用信息,发现有一个类似问题,12.2 RAC 无任何补丁,报同样错误,解决方案为重启两套服务器。查询MOS文档以及后台文档,排除上面指出的问题。

weixin_42344665的博客 1465

HBase 客户端类型

HBase自带了很多用于各种编程语言客户端。 1. 介绍 (Introduction) ---------------------------- 从目前非常流行的语言和环境可以访问 HBase。可以直接使用客户端 API, 或者通过一些中间代理访问,将用户请求翻译成 API 调用。这些代理将原生的 Java API 包装成其它协议的 API,这样客户端就可以使用这些对外提供的 API ...

xiaoyaGrace的博客 332

大语言模型的三种主要架构 Decoder-Only、Encoder-Only、Encoder-Decoder

f基于 Transformer 模型以非灰色显示:decoder-only 模型在蓝色分支,encoder-only 模型在粉色分支,encoder-decoder 模型在绿色分支。模型在时间线上的垂直位置表示它们的发布日期。开源模型由实心方块表示,而闭源模型由空心方块表示。右下角的堆积条形图显示了各公司和机构的模型数量。从时间轴上,我们可以看到:2021年前,当 OpenAI 决定在,他们实际上是在逆流而上。

u010899985的博客 2万+

hbase 客户端超时、重连设置

hbase 客户端超时、重试策略设置

zychun1991的博客 1万+

Allegro技巧----相同模块复用实现快速布局

使用Allegro软件进行PCB Layout设计时,当电路图中有很多路相同的模块,使用模块复用的的操作方法,可以显著提高工作效率,同时也可以使PCB布局在整体上显得美观。 如图,有8个相同的ADC采样电路模块,它们在原理图中的电路也是一样的,对于这多个相同的电路模块,如果一个个元器件布局很明显做了很多重复机械的劳动,效率低下;但是强大的Allegro软件早就考虑到了这点,只需要在PCB中做好其中的一个,则其余相同的模块通过复用的方式,可以快速完成,方便省事还美观。 具体步骤: 1.首先完成一个模块的PC

sinat_15677011的博客 5655

STM32入门教程:WiFi通信

第四步:初始化串口 在生成的代码中,您可以找到一个名为 "USARTx_Init" 的函数,其中 "x" 是您选择的串口号。然后,我们使用 "AT+CIPSEND" 命令发送UDP数据,接收到服务器的回复,并在终端上显示收到的数据。在配置向导中,您可以选择启用USART串口功能,并根据您的硬件连接,将串口设置为与WiFi模块连接的串口。在上述代码中,我们使用了 "HAL_UART_Receive" 函数来接收串口数据,并使用 printf 来在终端上显示收到的数据。如果有任何问题,请随时向我提问。

2401_85258012的博客 1078

hbase(三)--使用java客户端操作hbase

hbase(三)–使用java客户端操作hbase 文章目录hbase(三)--使用java客户端操作hbase一、简介二、开发步骤2.1 添加maven依赖2.2 定义连接属性文件hbase-site-paper.xml2.3 hbase操作 一、简介 这里介绍使用hbase的java客户端进行操作。 二、开发步骤 2.1 添加maven依赖 <dependency> &lt...

panda-star的博客 706

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

hbase的java客户端

hbase提供了java客户端去操作数据,我们通过创建一个maven项目来实现简单的数据操作。 pom.xml添加hbase插件 <dependency> <groupId>org.apache.hbase</groupId> <artifactId>hbase-client</artifactId> <version&...

qq_25542879的博客 909

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

hbase客户端操作

hbase客户端操作  移除点击此处添加图片说明文字 集群全部搭建完毕:  移除点击此处添加图片说明文字 ​1.首先启动zookeeper集群,在bin下执行,每台都要启动 ./zkServer.sh start​​ 2.找到hadoop的sbin执行: ./start-all.sh 3.找到hbase的bin下执行: ./start-hbase.sh  移除点

大壮的博客 5683

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

HBase 客户端类型 (二)

3.Framework Clients --- 在更直接的网关客户端之后,现在要讨论第二类客户端,将它们统称为框架(framework)。这类客户端提供了更高级的抽象,一般使用 domain specific language (DSL) 的形式。包括,例如 SQL, 关系数据库系统与外部客户端的混合用语(lingua franca),以及 MapReduce, 原始的处理框架,用于编写和执行 长...

heima201907的博客 325

Hbase的客户端连接及使用

package cn.edu360.hbase.demo; import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HColumnDescri...

weixin_42279393的博客 2915

Apache HBase 客户端与 API 使用完全指南

Apache HBase 是一个开源的分布式列存储数据库,基于 Hadoop 生态系统构建,专为处理海量非结构化数据而设计。作为 Google Bigtable 的开源实现,HBase 提供了高可靠性、高性能和强一致性的数据存储能力。 本文将深入探讨 HBase 客户端 API 的使用,涵盖从基础连接到高级操作的完整流程,帮助开发者快速掌握 HBase 的核心编程接口。 ## 核心概念解析 ...

gitblog_00961的博客 1224

HBase 客户端类型 (四)

5.HBase Web-based UI HBase 提供了基于 web 的用户接口(UI), 利用此接口,可以观察集群的状态及其所存储的表。大多数功能时只读的,但也有几个选择性操作可以通过 web UI 触发。另一方面,可以通过 metrics 可以获取非常详细的信息。可以在各种 UI 组件间导航,快速获取当前状态,包括内存使...

xiaoyaGrace的博客 414

Hbase:实验三-HBase多种客户端的使用

1实验目的 掌握REST客户端访问HBase。 掌握MapReduce批量操作HBase。 2实验内容 本实验将使用2种客户端对HBase进行操作。 3实验知识点 安装REST服务器; 使用curl工具,向REST服务器发送URL语法的命令; 编写MapReduce程序操作HBase; 4. 实验时长 4学时 5. 实验环境 需要一台台服务器,并且该服务器已经安装好单机版HBase,该服务器的登录用户名是:root,登录密码是:123456。 软件环境: 1)JDK-1.8.0_...

m0_62670963的博客 1520

dotnetcore 与 hbase 之三——c# for hbase 客户端的使用

说明 在上一篇文章dotnetcore 与 hbase 之二——thrift 客户端的制作中已经可以找到 c# hbase 客户端的使用方法了,为什么这里单独列出一篇文章来讲述呢?最简单的理由就是,本篇将为客户端的使用讲述一些简化性工作以及需要注意的事项。为此,我们做了一些工作HbaseNetCore。 存在的差异 在 c# hbase 客户端中,接口基本只接受或返回 byte 数组型的...

weixin_30307921的博客 990
上一篇: HBase 客户端类型 (二)
下一篇: HBase 客户端类型 (四)
devalone
博客等级 码龄17年 108粉丝 80原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值