region预切割 SPLITS => ['row20000','row25000','row50000','row75000']
创建命名空间
create_namespace 'test'
建表时 预切割region
create 'test:t1','f1',SPLITS => ['row20000','row25000','row50000','row75000']
16010 查看预切分的region
1 @Test 2 public void putData2() throws Exception { 3 4 //初始化hbase 的conf 5 Configuration conf = HBaseConfiguration.create(); 6 7 //通过连接工厂创建连接 8 Connection conn = ConnectionFactory.createConnection(conf); 9 //得到相应数据库的表 10 HTable table = (HTable) conn.getTable(TableName.valueOf("test:t1")); 11 12 //设置自动刷写为false 13 table.setAutoFlush(false,false); 14 15 //put列表 16 List<Put> list = new LinkedList<Put>(); 17 18 long start = System.currentTimeMillis(); 19 for (int i = 1; i < 100000; i++) { 20 //Bytes.toBytes()可以将任意类型转换成字节数组 21 Put put = new Put(Bytes.toBytes("row" + i));// Put( 键值row-key ) 22 23 put.addColumn(Bytes.toBytes("f1"), Bytes.toBytes("name"), Bytes.toBytes("tom"+i));// 向当前row-key的列族添加数据 addColumn(列族,列限定符,值) 24 put.addColumn(Bytes.toBytes("f1"), Bytes.toBytes("id"), Bytes.toBytes(i+"")); 25 put.addColumn(Bytes.toBytes("f1"), Bytes.toBytes("age"), Bytes.toBytes(i % 100 +"")); 26 list.add(put); //把一条数据加载放到list集合中 27 } 28 29 table.put(list);//把集合中的数据上传到表中 30 table.flushCommits();//表提交刷新 31 32 table.close(); 33 conn.close(); 34 35 System.out.println(System.currentTimeMillis() - start); 36 37 }
刷新到磁盘
hbase(main):005:0> flush 'test:t1'
16010查看传入数据后的 region 和regionserver

50070 查看Store
分别查看5个region的大小
[centos@s101 ~]$ hadoop dfs -du /user/hbase/data/test/t1/33488729d265256907af7e03682078a1
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· 一文读懂知识蒸馏
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下