1 hbase简介

  • hbase是面向列的分布式数据库(DBMS)
  • 可伸缩(存储在HDFS中,regionServer可以扩容)
  • 高可用,可靠
  • 高性能,避免并发
  • 面向列,底层存储的数据KV/表结构是以列族为单元
  • 稀疏性:每行的数据的属性可能不一致(半结构化数据)
  • 数据多版本 以列族为单位 cf1 VERSIONS=3
  • 无模式 schema结构不明确

场景

  1. 表数据的行数几千万条
  2. 并发性
  3. hbase不支持SQL ,不适合做报表
  4. HashMap/根据key(mid)获取数据比较快 快速获取数据的维度单一,例如:

“忠实粉丝”——-> user数据

M

今天的用户 date

20~30岁 —->

签数据/用户画像

依赖环境

  1. zookeeper
  2. HDFS底层存储
  3. JDK
  4. 时间同步

HBASE架构

  • Hmaster
  • HRegionServer
  • region: 表的行范围数据
  • HDFS存储数据

安装部署

start-hbase.sh启动

http://linux01:16010

hbase-shell客户端

  • hbase shell
  • help
  • version whoami status
  • create put scan alter
  • list desc create_namespace

数据在HDFS上存储的位置信息

/hbase/data/default/table_name/region_name/列族s/hfile文件

hbase hfile -p -f hfile的路径

K: V:

2 SHELL-CMD

2.1 DDL

alter, alter_async, alter_status, clone_table_schema, create, describe,

disable: 禁用表

  1. disable 'table_name' -- 禁用表 禁用的表示不能对表的数据进行操作的
  2. 禁用的表示可以修改表结构的
  3. alter 'tb_a1' , 'delete'=>'cf3'

enable,启用禁用的表

  1. enable 'tb_a1'

disable_all,

enable_all,

  1. hbase(main):021:0> disable_all 't.*'
  2. tb_a1
  3. tb_a2
  4. tb_a3
  5. tb_a4
  6. tb_aa
  7. Disable the above 5 tables (y/n)?
  8. y
  9. 5 tables successfully disabled
  1. hbase(main):022:0> enable_all 't.*'
  2. tb_a1
  3. tb_a2
  4. tb_a3
  5. tb_a4
  6. tb_aa
  7. Enable the above 5 tables (y/n)?
  8. y
  9. 5 tables successfully enabled
  10. Took 8.3687 seconds

drop #删除表

  1. disable 'tb_a2'
  2. drop 'tb_a2'

drop_all,

  1. disable_all
  2. drop_all

exists, 查看表是否存在

  1. hbase(main):036:0> exists 'tb_a1'
  2. Table tb_a1 does exist
  3. Took 0.0096 seconds
  4. => true

get_table 类似于别名

  1. t_user = get_table 'tb_ods_app_wx_user'

is_disabled, 是否是禁用状态

is_enabled, 是否是启用状态

  1. hbase(main):014:0> is_disabled 'tb_a1'
  2. true Took 0.0108 seconds
  3. hbase(main):016:0> is_enabled 'tb_a2'
  4. true

list查看系统中所有的表

  1. list 'doit24:.*' -- 查看指定名称空间下的表

list_regions — 查看表的所有的region信息

shell命令、常用api、热点问题 - 图1

shell命令、常用api、热点问题 - 图2

表如何才能有多个region呢?

  • 表的数据行数达到阈值, region会自动的拆分
  • 手动的强制拆分 / 指定切割点

shell命令、常用api、热点问题 - 图3

  1. split 'tb_name' , 'rk003'
  2. list_regions 'tb_name'

locate_region 查看key所在的region的位置信息

  1. locate_region 'tb_a1' , 'rk003'
  2. HOST REGION
  3. linux03:16020 {ENCODED => c1a08f08a64dd91da77c5bf97e4f6dd3, NAME => 'tb_a1,rk003,1625192839094.c1a08f08a64dd91da77c5bf97
  4. e4f6dd3.', STARTKEY => 'rk003', ENDKEY => ''}
  5. 1 row(s)
  6. c1a08f08a64dd91da77c5bf97e4f6dd3 -- REGION文件夹

show_filters能实现 where 条件查询 但是性能很低

  1. scan 'tb_a1', {FILTER => "ValueFilter (=, 'binary:zss')"} -- 获取值是zss的数据
  2. scan 'tb_a1', {ROWPREFIXFILTER => 'rk00'} rk00开头的行数据
  3. DependentColumnFilter
  4. KeyOnlyFilter
  5. ColumnCountGetFilter
  6. SingleColumnValueFilter
  7. PrefixFilter
  8. SingleColumnValueExcludeFilter
  9. FirstKeyOnlyFilter
  10. ColumnRangeFilter
  11. ColumnValueFilter
  12. TimestampsFilter
  13. FamilyFilter
  14. QualifierFilter 属性
  15. ColumnPrefixFilter
  16. RowFilter 行键
  17. MultipleColumnPrefixFilter
  18. InclusiveStopFilter
  19. PageFilter
  20. ValueFilter

2.2 DML

append 追加 在已有的单元格的后面添加子串

  1. append 'tb_a1' , 'a0001' , 'cf1:name' , '_abc'
  2. a0001 column=cf1:name, timestamp=1625195924514, value=zss
  3. a0001 column=cf1:name, timestamp=1625195924514, value=zss_abc
  4. -- 如果单元格不存在 , 创建新的单元格 类似于put操作
  5. hbase(main):012:0> append 'tb_a1' , 'a0002' , 'cf1:name' , '_abc'
  6. CURRENT VALUE = _abc
  7. Took 0.0134 seconds

count, 统计表数据行数

  1. hbase(main):014:0> count 'tb_a1'
  2. 6 row(s)
  3. Took 0.0675 seconds
  4. => 6

delete 只能删除单元格

  1. delete 'tb_a1' , 'a0001' , 'cf1:name'

deleteall 删除整行 ,或者 一个单元格

  1. delete 'tb_a1' , 'a0001' 删除行
  2. delete 'tb_a1' , 'a0001' , 'cf1:name' 删除单元格

get获取数据 行为单位 根据rowkey 开发中使用比较多

  1. get 'tb_a1' , 'a0001' 一行
  2. get 'tb_a1' , 'a0001' ,'cf1:age' 一个单元格
  3. hbase(main):044:0> get 'tb_a1' , 'a0001' ,'cf1:age' , 'cf2:job' 多个单元格
  4. COLUMN CELL
  5. cf1:age timestamp=1625198011401, value=23 cf2:job timestamp=1625198030308, value=coder
  6. get 'tb_a1' , 'rk001' , 'cf2:account'
  7. get 'tb_a1' , 'rk001' , {COLUMN=>'cf2:account' , VERSIONS=>2}

incr 增加一个自增的字段 用来计数

  1. incr 'tb_name' , 'rk' , 'cf:col' , 20 初始值
  2. incr 'tb_name' , 'rk' , 'cf:col' , 2 累加2
  3. incr 'tb_name' , 'rk' , 'cf:col' , 1 累加1

get_counter 获取incr字段的值

  1. get_counter 'tb_a1' , 'rk006' , 'cf1:age'

get_splits 获取表的切割点

  1. hbase(main):026:0> get_splits 'tb_a1'
  2. Total number of splits = 2
  3. rk003

put 单元格数据进行put操作
每次Put都会进行RPC[网络]请求 , 多次交互 ,效率低

  1. 缓存一批写一次 ,减少请求次数

  2. HBASE 是一个分布式数据库 , 存储大量的数据 , 假如我们已经存在了大量的静态数据在HDFS中

  1. [文件] --->MR ---->输出到hbase的表写以hfile的格式

scan 全表检索数据 /臃肿/数据量大 一般不用

truncate ;删除数据 ,删除原来的切割点,region信息/ 仅仅保留表的基本结构 l列族

  1. truncate 'tb_a1'

2 JAVA-API

2.1 添加依赖

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5. <modelVersion>4.0.0</modelVersion>
  6. <groupId>org.example</groupId>
  7. <artifactId>doit24_hbase</artifactId>
  8. <version>1.0-SNAPSHOT</version>
  9. <!--JDK的版本-->
  10. <properties>
  11. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  12. <maven.compiler.source>1.8</maven.compiler.source>
  13. <maven.compiler.target>1.8</maven.compiler.target>
  14. </properties>
  15. <dependencies>
  16. <!--zookeeper-->
  17. <dependency>
  18. <groupId>org.apache.zookeeper</groupId>
  19. <artifactId>zookeeper</artifactId>
  20. <version>3.4.6</version>
  21. </dependency>
  22. <!--hadoop-->
  23. <dependency>
  24. <groupId>org.apache.hadoop</groupId>
  25. <artifactId>hadoop-auth</artifactId>
  26. <version>3.1.1</version>
  27. </dependency>
  28. <dependency>
  29. <groupId>org.apache.hadoop</groupId>
  30. <artifactId>hadoop-client</artifactId>
  31. <version>3.1.1</version>
  32. </dependency>
  33. <dependency>
  34. <groupId>org.apache.hadoop</groupId>
  35. <artifactId>hadoop-common</artifactId>
  36. <version>3.1.1</version>
  37. </dependency>
  38. <!-- HBASE依赖 -->
  39. <dependency>
  40. <groupId>org.apache.hbase</groupId>
  41. <artifactId>hbase-client</artifactId>
  42. <version>2.2.5</version>
  43. </dependency>
  44. <dependency>
  45. <groupId>org.apache.hbase</groupId>
  46. <artifactId>hbase-server</artifactId>
  47. <version>2.2.5</version>
  48. </dependency>
  49. <!-- 使用mr程序操作hbase 数据的导入 -->
  50. <dependency>
  51. <groupId>org.apache.hbase</groupId>
  52. <artifactId>hbase-mapreduce</artifactId>
  53. <version>2.2.5</version>
  54. </dependency>
  55. <!--json解析-->
  56. <dependency>
  57. <groupId>com.google.code.gson</groupId>
  58. <artifactId>gson</artifactId>
  59. <version>2.8.5</version>
  60. </dependency>
  61. </dependencies>
  62. <build>
  63. <plugins>
  64. <plugin>
  65. <groupId>org.apache.maven.plugins</groupId>
  66. <artifactId>maven-compiler-plugin</artifactId>
  67. <version>3.5.1</version>
  68. <configuration>
  69. <source>1.8</source>
  70. <target>1.8</target>
  71. </configuration>
  72. </plugin>
  73. <plugin>
  74. <groupId>org.apache.maven.plugins</groupId>
  75. <artifactId>maven-assembly-plugin</artifactId>
  76. <version>2.6</version>
  77. <configuration>
  78. <!-- get all project dependencies -->
  79. <descriptorRefs>
  80. <descriptorRef>jar-with-dependencies</descriptorRef>
  81. </descriptorRefs>
  82. <!-- MainClass in mainfest make a executable jar -->
  83. <archive>
  84. <manifest>
  85. <!--<mainClass>util.Microseer</mainClass> -->
  86. </manifest>
  87. </archive>
  88. </configuration>
  89. <executions>
  90. <execution>
  91. <id>make-assembly</id>
  92. <!-- bind to the packaging phase -->
  93. <phase>package</phase>
  94. <goals>
  95. <goal>single</goal>
  96. </goals>
  97. </execution>
  98. </executions>
  99. </plugin>
  100. </plugins>
  101. </build>
  102. </project>

2.2 入门示例1

  1. package com._51doit.hbase.day02;
  2. import org.apache.hadoop.conf.Configuration;
  3. import org.apache.hadoop.hbase.HBaseConfiguration;
  4. import org.apache.hadoop.hbase.TableName;
  5. import org.apache.hadoop.hbase.client.Admin;
  6. import org.apache.hadoop.hbase.client.Connection;
  7. import org.apache.hadoop.hbase.client.ConnectionFactory;
  8. import org.apache.hadoop.hbase.client.Table;
  9. import java.io.IOException;
  10. /**
  11. * Author: Hang.Z
  12. * Date: 21/07/02
  13. * Description:
  14. * 使用java操作Hbase
  15. * 连接zookeeper,获取HBase信息
  16. *
  17. * 1 获取一个连接对象
  18. * 2 conn获取Table对象
  19. * 3 Table DML有关
  20. * get scan put delete incr append
  21. * 4 Admin DDL
  22. * namespace
  23. * tools
  24. */
  25. public class Hbase01_Demo {
  26. public static void main(String[] args) throws Exception {
  27. Configuration conf = HBaseConfiguration.create();
  28. // 设置zookeeper的地址
  29. conf.set("hbase.zookeeper.quorum","linux01:2181,linux02:2181,linux03:2181");
  30. // 获取hbase的连接对象
  31. Connection conn = ConnectionFactory.createConnection(conf);
  32. // 表名
  33. TableName tableName = TableName.valueOf("tb_a1");
  34. // 表对象
  35. Table table = conn.getTable(tableName);
  36. Admin admin = conn.getAdmin();
  37. // 释放连接
  38. conn.close();
  39. }
  40. }

创建获取连接HBASE的工具类

  1. package doit.day02;
  2. import org.apache.hadoop.conf.Configuration;
  3. import org.apache.hadoop.hbase.HBaseConfiguration;
  4. import org.apache.hadoop.hbase.client.Connection;
  5. import org.apache.hadoop.hbase.client.ConnectionFactory;
  6. import java.io.IOException;
  7. /**
  8. * Author: Hang.Z
  9. * Date: 21/07/02
  10. * Description:
  11. */
  12. public class HbaseUtils {
  13. /**
  14. * 获取hbase的连接对象
  15. * @return
  16. * @throws Exception
  17. */
  18. public static Connection getConnection() throws Exception {
  19. Configuration conf = HBaseConfiguration.create();
  20. // 设置zookeeper的地址
  21. conf.set("hbase.zookeeper.quorum","linux01:2181,linux02:2181,linux03:2181");
  22. // 获取hbase的连接对象
  23. Connection conn = ConnectionFactory.createConnection(conf);
  24. return conn ;
  25. }
  26. }

2.3 获取所有的名称空间/所有的表

  1. package com._51doit.hbase.day02;
  2. import org.apache.hadoop.conf.Configuration;
  3. import org.apache.hadoop.hbase.HBaseConfiguration;
  4. import org.apache.hadoop.hbase.NamespaceDescriptor;
  5. import org.apache.hadoop.hbase.TableName;
  6. import org.apache.hadoop.hbase.client.Admin;
  7. import org.apache.hadoop.hbase.client.Connection;
  8. import org.apache.hadoop.hbase.client.ConnectionFactory;
  9. /**
  10. * Author: Hang.Z
  11. * Date: 21/07/02
  12. * Description:
  13. * 1 list 命令
  14. * 获取系统中所有的表名
  15. * 2 获取所有的namespace
  16. */
  17. public class Hbase02_Demo2 {
  18. public static void main(String[] args) throws Exception{
  19. Configuration conf = HBaseConfiguration.create();
  20. conf.set("hbase.zookeeper.quorum","linux01:2181,linux02:2181,linux03:2181");
  21. Connection conn = ConnectionFactory.createConnection(conf);
  22. Admin admin = conn.getAdmin();
  23. // 获取所有的名称空间
  24. NamespaceDescriptor[] namespaceDescriptors = admin.listNamespaceDescriptors();
  25. for (NamespaceDescriptor namespaceDescriptor : namespaceDescriptors) {
  26. String name = namespaceDescriptor.getName();
  27. System.out.println(name);
  28. }
  29. // admin 获取所有的表
  30. TableName[] tableNames = admin.listTableNames();
  31. // 遍历
  32. for (TableName tableName : tableNames) {
  33. // 获取表名 字节数组
  34. byte[] name = tableName.getName();
  35. // 封装String打印结果
  36. // System.out.println(new String(name));
  37. }
  38. conn.close();
  39. }
  40. }

2.4 建表(一个列族)

  1. package doit.day02;
  2. import org.apache.hadoop.hbase.HTableDescriptor;
  3. import org.apache.hadoop.hbase.TableName;
  4. import org.apache.hadoop.hbase.client.*;
  5. /**
  6. * Author: Hang.Z
  7. * Date: 21/07/02
  8. * Description:
  9. * 建表:表名:至少一个列族
  10. * create tb_name , cf
  11. * 建表 createTable(tableDescriptor);
  12. * 参数 表的描述器
  13. * 构建器 --> 构建
  14. * 1 表的描述器构建器
  15. * ---添加列族描述器
  16. * 2 build 表的描述器
  17. * 1 列族描述器构建器
  18. * 2 build 列族描述器
  19. */
  20. public class Hbase03_CreateTable01 {
  21. public static void main(String[] args) throws Exception {
  22. Connection conn = HbaseUtils.getConnection();
  23. Admin admin = conn.getAdmin();
  24. /**
  25. * 表的描述器构建器
  26. * 描述器构建器 构建表的描述器
  27. * 列族描述器构建器
  28. * 构建列族描述器
  29. * TableDescriptor
  30. */
  31. TableDescriptorBuilder tableDescriptorBuilder = TableDescriptorBuilder.newBuilder(TableName.valueOf("tb_user"));
  32. // 列族描述器构建器
  33. ColumnFamilyDescriptorBuilder columnFamilyDescriptorBuilder = ColumnFamilyDescriptorBuilder.newBuilder("cf".getBytes());
  34. ColumnFamilyDescriptor familyDescriptor = columnFamilyDescriptorBuilder.build();
  35. // 将列族描述器 添加到表中
  36. tableDescriptorBuilder.setColumnFamily(familyDescriptor) ;
  37. // 构建表描述器
  38. TableDescriptor tableDescriptor = tableDescriptorBuilder.build();
  39. // 建表
  40. admin.createTable(tableDescriptor);
  41. conn.close();
  42. }
  43. }

2.5 建表(多列族)

  1. package doit.day02;
  2. import org.apache.hadoop.hbase.TableName;
  3. import org.apache.hadoop.hbase.client.*;
  4. import java.util.ArrayList;
  5. import java.util.List;
  6. /**
  7. * Author: Hang.Z
  8. * Date: 21/07/02
  9. * Description:
  10. * 创建多列族的表
  11. */
  12. public class Hbase04_CreateTable02 {
  13. public static void main(String[] args) throws Exception {
  14. Connection conn = HbaseUtils.getConnection();
  15. Admin admin = conn.getAdmin();
  16. // 表的描述器构建器
  17. TableDescriptorBuilder tbbuild = TableDescriptorBuilder.newBuilder(TableName.valueOf("tb_teacher"));
  18. // 列族的描述器构建器 cf1
  19. ColumnFamilyDescriptorBuilder cf1Build = ColumnFamilyDescriptorBuilder.newBuilder("cf1".getBytes());
  20. // 构建表述器
  21. ColumnFamilyDescriptor cf1 = cf1Build.build();
  22. // 列族的描述器构建器 cf2
  23. ColumnFamilyDescriptorBuilder cf2Build = ColumnFamilyDescriptorBuilder.newBuilder("cf2".getBytes());
  24. // 构建表述器
  25. ColumnFamilyDescriptor cf2 = cf2Build.build();
  26. // 列族的描述器存入集合
  27. List<ColumnFamilyDescriptor> cfs = new ArrayList<>() ;
  28. cfs.add(cf1);
  29. cfs.add(cf2);
  30. tbbuild.setColumnFamilies(cfs);
  31. //构建表的描述器
  32. TableDescriptor tableDescriptor = tbbuild.build();
  33. admin.createTable(tableDescriptor);
  34. admin.close();
  35. conn.close();
  36. }
  37. }

2.6 建表(多列族,并且设置列族属性)

  1. package doit.day02;
  2. import org.apache.hadoop.hbase.TableName;
  3. import org.apache.hadoop.hbase.client.*;
  4. import java.util.ArrayList;
  5. import java.util.List;
  6. /**
  7. * Author: Hang.Z
  8. * Date: 21/07/02
  9. * Description:
  10. * 创建多列族的表,设置他们的属性
  11. */
  12. public class Hbase05_CreateTable03 {
  13. public static void main(String[] args) throws Exception {
  14. Connection conn = HbaseUtils.getConnection();
  15. Admin admin = conn.getAdmin();
  16. // 表的描述器构建器
  17. TableDescriptorBuilder tbbuild = TableDescriptorBuilder.newBuilder(TableName.valueOf("tb_teacher2"));
  18. // 列族的描述器构建器
  19. ColumnFamilyDescriptorBuilder cf1Build = ColumnFamilyDescriptorBuilder.newBuilder("cf1".getBytes());
  20. /**
  21. * 设置当前列族的参数
  22. */
  23. cf1Build.setMaxVersions(3) ;
  24. // 构建表述器
  25. ColumnFamilyDescriptor cf1 = cf1Build.build();
  26. // 列族的描述器构建器
  27. ColumnFamilyDescriptorBuilder cf2Build = ColumnFamilyDescriptorBuilder.newBuilder("cf2".getBytes());
  28. /**
  29. * 设置当前列族的参数
  30. * 设置列族数据的过期时间 单位 s 妙
  31. */
  32. cf2Build.setTimeToLive(240) ;
  33. // 构建表述器
  34. ColumnFamilyDescriptor cf2 = cf2Build.build();
  35. // 设置多个列族
  36. List<ColumnFamilyDescriptor> cfs = new ArrayList<>() ;
  37. cfs.add(cf1);
  38. cfs.add(cf2);
  39. tbbuild.setColumnFamilies(cfs);
  40. //构建描述器
  41. TableDescriptor tableDescriptor = tbbuild.build();
  42. admin.createTable(tableDescriptor);
  43. admin.close();
  44. conn.close();
  45. }
  46. }

2.7 创建预分region表

  1. package doit.day02;
  2. import org.apache.hadoop.hbase.TableName;
  3. import org.apache.hadoop.hbase.client.*;
  4. import java.util.ArrayList;
  5. import java.util.List;
  6. /**
  7. * Author: Hang.Z
  8. * Date: 21/07/02
  9. * Description:
  10. * 创建预分region表
  11. */
  12. public class Hbase06_CreatePreRegionTable04 {
  13. public static void main(String[] args) throws Exception {
  14. Connection conn = HbaseUtils.getConnection();
  15. Admin admin = conn.getAdmin();
  16. // 表的描述器构建器
  17. TableDescriptorBuilder tbbuild = TableDescriptorBuilder.newBuilder(TableName.valueOf("tb_pre_region2"));
  18. // 列族的描述器构建器
  19. ColumnFamilyDescriptorBuilder cf1Build = ColumnFamilyDescriptorBuilder.newBuilder("cf1".getBytes());
  20. /**
  21. * 设置当前列族的参数
  22. */
  23. cf1Build.setMaxVersions(3) ;
  24. // 构建表述器
  25. ColumnFamilyDescriptor cf1 = cf1Build.build();
  26. // 列族的描述器构建器
  27. ColumnFamilyDescriptorBuilder cf2Build = ColumnFamilyDescriptorBuilder.newBuilder("cf2".getBytes());
  28. /**
  29. * 设置当前列族的参数
  30. * 设置列族数据的过期时间 单位 s 妙
  31. */
  32. cf2Build.setTimeToLive(240) ;
  33. // 构建表述器
  34. ColumnFamilyDescriptor cf2 = cf2Build.build();
  35. // 设置多个列族
  36. List<ColumnFamilyDescriptor> cfs = new ArrayList<>() ;
  37. cfs.add(cf1);
  38. cfs.add(cf2);
  39. tbbuild.setColumnFamilies(cfs);
  40. //构建描述器
  41. TableDescriptor tableDescriptor = tbbuild.build();
  42. /**
  43. * 参数一
  44. * 参数二 , 分割点 在hbase中所有数据都是字节数组
  45. * a.getBytes()
  46. * [a.getBytes(),o.getBytes()]
  47. * a0001
  48. * z001
  49. */
  50. byte[][] keys = new byte[][]{"f".getBytes(),"o".getBytes(),"x".getBytes()} ;
  51. admin.createTable(tableDescriptor , keys);
  52. admin.close();
  53. conn.close();
  54. }
  55. }

3 热点问题

问题描述,HBASE在数据量很小的时候,默认只会为数据分配一个region,随着数据量的增多,越来越多的数据存储在同一台机器,而不是分布在多台机器上,此时查询速度就会变慢,插入数据也会变慢。这就是热点问题。

shell命令、常用api、热点问题 - 图4

解决方案:

在创建表的时候,指定切割点,手动将表分为多个region,将数据根据切割点合理的分配在不同的节点上。

shell命令、常用api、热点问题 - 图5

shell端

  1. create 'tb_pre_region' , 'cf' , SPLITS=>['f','o','x']

Java端

  1. byte[][] keys = new byte[][]{"f".getBytes(),"o".getBytes(),"x".getBytes()} admin.createTable(tableDescriptor , keys);